Pergunta

I need to synchronize a video in diferrent devices with windows phone. So i get the hour from a ntp server and then convert it to miliseconds. Now i think i need to make a internal clock to count the time to launch the video. I have some difficultes to understand this. I don't see examples in the internet. Can anyone help me? I need to know how to do that.

Foi útil?

Solução

Your question is vey vague and missing lots of information relevant to what you're actually trying to achieve. However, by piecing together information from what I assume are your related other questions, here goes.

The simplest way of having a video play at the same time on multiple devices is to have it streamed in real time from a central server.

If it's not playing directly from a central server then there is a question about where the video file is downloaded from and how you define when the video should be started from. There is also a question about why/if it really needs to be played in sync.

Assuming that you have a central server to determine what to play when:

An NTP server only seems relevant to this scenario if the video content is shipped with the app or is fully downloaded. You can then use the NTP server to determine the difference between the devices time and that returned from the central server. (Note that you can't set the devices time via the available APIs.) You should then query the central server to find out where the video should be played from. I'd suggest having the server respond with a response that indicates the point to start playing back in a couple of seconds. i.e. the equivalent of "Play video X, skipping the first Y seconds/milliseconds/ticks and starting in Z seconds time.

If you don't have a central server to determine when to play what then, the only assumption I can make about how this scenario would work is if all devices have the content (or first download it before trying to play) and details about when that content should be played. A simple example of this would be a 1 hour video which is played on a loop. The NTP server could be used to find out what the actual current time is (subject to the difference allowed for the NTP request) and then start playing the track at the same position through at the time it is past the hour.

In the above scenarios when I state that content must be downlaoded before trying to play, this is to ensure that there aren't issues with the download being slower than playback as the time taken to buffer would get playback out of sync.

Hope this helps.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top