How to sync two MediaPlayers or MediaElements in WPF?

I am trying to implement a system in WPF that plays two synchronized videos on two screens. I thought that if I linked the two corresponding MediaTimelines into one ParallelTimeline and controlled the time frame from the ParallelTimeline clock controller, the time slots of the multimedia timelines would be controlled from the same clock and thus play synchronously. Only this is not so, there is a huge delay between them. Is there any way to do this?

thanks

+4
source share
1 answer

If your two MediaTimelines are in the same storyboard (and it looks like them), you should be able to synchronize the elements by changing ParallelTimeline.SlipBehavior to SlipBehavior.Slip. This behavior “holds back” the progression of the timelines if the media element in the storyboard triggers buffering or load delay.

You can learn more about this here: http://msdn.microsoft.com/en-us/library/cc304465.aspx

0
source

Source: https://habr.com/ru/post/1304784/


All Articles