This project has moved. For the latest updates, please go here.

How to play this file m3u8 ?

Jun 23, 2015 at 1:42 AM
Edited Jul 30, 2015 at 12:36 PM
i try but it cannot play this
link not work

Thanks!
Coordinator
Jun 23, 2015 at 9:02 PM
The server is returning the M3U8 playlist as an HTML document (complete with some javascript). It plays here if one forces the code to treat it as M3U8. I've checked in a fix to get the ContentType override in PlaylistManager to propagate from PlaylistManager in the HlsView apps. If you are using those app, you could set the MediaTrack.ContentType to ContentTypes.M3U8. If not, you should be able to find the call to "InitializeMediaStream()" in your code and set ContentType after that call, but before the call to CreateMediaStreamSourceAsync():
   InitializeMediaStream();

   _mediaStreamFacade.ContentType = ContentTypes.M3U8;

   var mss = await _mediaStreamFacade.CreateMediaStreamSourceAsync(track.Url, CancellationToken.None);
Let me know if that works for you.

I'll have a further look to see what that javascript does to the M3U8 parser.
Coordinator
Jun 23, 2015 at 9:38 PM
Well, it gets 404s from the server when it tries to use the HTML elements as relative URLs and that stops playback. I'm not sure what to do about that in the general case, but for playing this stream, try changing the code after the empty line check in "M3U8Parser.Parse()" from "continue" to "break" so that it looks like this:
    public void Parse(Uri baseUri, IEnumerable<string> lines)
    {
        _baseUrl = baseUri;

        _playlist.Clear();

        _lineNumber = 0;

        _hasMarker = false;

        foreach (var line in lines)
        {
            ++_lineNumber;

            if (string.IsNullOrWhiteSpace(line))
                break;

            if (line.StartsWith("#EXT"))
                HandleExt(line);
            else if (!line.StartsWith("#"))
            {
                var uri = new M3U8Uri
                {
                    Uri = line
                };

                if (_tags.Count > 0 || _sharedTags.Count > 0)
                {
                    uri.Tags = _tags.Union(_sharedTags).ToArray();

                    _tags.Clear();
                }

                _playlist.Add(uri);
            }
        }
    }
That way, it will stop parsing the file when it hits an empty line.
Jun 25, 2015 at 4:05 AM
Thanks! it very useful :)
Coordinator
Jul 2, 2015 at 4:55 AM
You're welcome.

One more thing: if you have any influence on the folks operating that server, then you might encourage them to have it return "application/vnd.apple.mpegurl" as the Content-Type and not inserting HTML/JavaScript in the .m3u8...
Jul 23, 2015 at 3:43 AM
Hi!
i play this file, it only played the first part and then stopped. To continue, I have to reopen.
no way to fix this or not?
Thanks!
http://112.197.2.154:1935/mlive/C048_SD_3/chunklist.m3u8?us=f9c1a4c308ea65315530bb809a100a47f04626c6bac3632d7a46b14478850a42f668f5319cd0c0deaee298cccf4bbb7d|1728515
Jul 26, 2015 at 8:26 AM
henric wrote:
The server is returning the M3U8 playlist as an HTML document (complete with some javascript). It plays here if one forces the code to treat it as M3U8. I've checked in a fix to get the ContentType override in PlaylistManager to propagate from PlaylistManager in the HlsView apps. If you are using those app, you could set the MediaTrack.ContentType to ContentTypes.M3U8. If not, you should be able to find the call to "InitializeMediaStream()" in your code and set ContentType after that call, but before the call to CreateMediaStreamSourceAsync():
   InitializeMediaStream();

   _mediaStreamFacade.ContentType = ContentTypes.M3U8;

   var mss = await _mediaStreamFacade.CreateMediaStreamSourceAsync(track.Url, CancellationToken.None);
Let me know if that works for you.

I'll have a further look to see what that javascript does to the M3U8 parser.
How to use for add plugin player framework in xaml ?
Coordinator
Jul 31, 2015 at 9:43 AM
Unfortunately, the plugin itself needs to be modified. This is why that bit is distributed in source form even in the download. I have looked at making it more configurable, but right now I don't have a better answer. Try something like this in StreamingMediaPlugin:
    playbackSession = new PlaybackSession(InitializeMediaStream())
    {
        ContentType = ContentTypes.M3U8
    };

    var playTask = PlayAsync(playbackSession, source, cancellationToken);
Jul 31, 2015 at 10:22 AM
Edited Sep 12, 2015 at 9:07 AM
Thanks