Concatenate videos

Topics: Windows 8 Xaml
Apr 14, 2014 at 11:30 PM
Hi,

Is it possible to play a list of videos as they are concatenated? i.e.
  1. Play one after another in the list, and
  2. The timeline slider acts as if there is only one video. e.g., if there are 4 videos, and each of them is 5 minutes, then the total length of timeline is 20 minutes. If the user drag the timeline slider to 16:00, the player will play 1:00 of the 3rd video, and
    3 (optional). If the source is a list of online URL, then after first video's download completes, start downloading the next video in background. (Thus as far as the user doesn't seek the video, it can be played without pausing when switching to the next video in the list)
I'd like to know if I want to implement the above, do I need to change the source code of the player framework? Or is there any way to avoid that?
I'm think about using 2 media players instead, one in foreground and another in background, if the foreground one finishes downloading, start downloading for the background one. Also properly handle the event when media completed and user seek, switch the two players when necessary. However, the main problem I found is that I don't know how to project the timeline slider in the way I want and whether the seeked event can give correct argument about the position (when it's outside of current video's range). Is that possible to do that without changing the source code of player framework?
Coordinator
Apr 16, 2014 at 9:47 PM
This is not built into the player framework, however I think it would be technically possible for you to build a custom MediaStreamSource that would take all the video streams or urls and then present them as a single video. the player framework would not need to change in any way to support this since to it everything would appear as a single video. It's also possible that someone has already done something like this -- I just haven't personally searched around on the internet to find out.
Apr 17, 2014 at 2:11 AM
Thank you for your reply. I will try your suggestion and post my result if it works. However, I have one more question. Since I want to handle progressive download url as source, does that means I need to implement the IRandomAccessStream from url, or is there any simple way to handle these url with MediaStreamSource?
Apr 23, 2014 at 6:31 AM
Hi, I implemented that in another way because there is too little documents and examples for MediaStreamSource so I don't know where to start (and it seems to be difficult).

I implemented it by inheriting InteractiveViewModel. By overloading the time related properties and seek related methods, I can achieve my requirements.
However, there are few fallbacks. One is that there is a black screen when switching source, but that's fast and acceptable.
Another is that I can't SeekWhileScrubbing, because if I switch the source and there is uncompleted seek task at that time, all the following seek tasks will be blocked.

I also implemented an IRandomAccessStream to treat progressive download as a Stream that MediaPlayer can use.

I created a CodePlex project with the source code.
https://concatvideoplayer.codeplex.com/
Coordinator
Apr 24, 2014 at 1:35 AM
Thanks for sharing! I do think the MSS approach would be ideal but this is definitely not a trivial task and your approach seems like a good alternative.