I'm getting m38u files to stream to a live TV channel. I've tried to open these files (as they are just list of files with the media type "MPEG/TS") and build a playlist out of them. But the transitions between the videos are bad, it pauses for a second or two before starting the next video.
I don't mind writing some server side code to solve this, but I need some guidance.
I don't know how you set up your playlist, but I guess this is how you do this:
- You have a MediaElement
- You subscribe to MediaElement.MediaEnded event
- You parse the m38u file and set the fist stream from the list to MediaElement.Source.
- You handle MediaElement.MediaEnded and each time you just set next stream from the list.
Is it true? If yes, then your issue is a step 4. Each time when you set new source - MediaElement requests the stream from server and buffers at least something to start show the video. I guess this is why you see 3 seconds transitions. This is how you need to solve this:
- You have the same MediaElement.
- You need to implement on your own IRandomAccessStream interface, which can download a stream to memory (if it is not really huge) or on disk, or just buffer stream with specific buffer size.
- You parse m38u file, initialize first your IRandomAccessStream and set it as a source.
- When for example first video on 90% time of it - you need to initialize second stream from playlist, start to download it with IRandomAccessStream.
- When MediaElement.MediaEnded will be fired - you will have buffered stream, which is ready for MediaElement, so you just need to set stream from step 4.