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

WP 8.1 and m3u8 playlist

Nov 19, 2014 at 8:54 AM
This is probably a very nooby question but a friend and I have found ourselves at a standstill, as we cannot get any further with our app.

We are trying to open a stream (m3u8) from Twitch Tv that looks like this:
#EXT-X-TWITCH-INFO:NODE="video8.ams01",CLUSTER="ams01",MANIFEST-CLUSTER="ams01",USER-IP="144.85.219.74",MANIFEST-NODE="video8.ams01"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="source",NAME="Source",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=2398898,RESOLUTION=1280x720,VIDEO="source"
http://video8.ams01.hls.twitch.tv/hls49/sirhcez_8161536112_52772821/source/index.m3u8?token=id=150606641873574234,bid=8161536112,exp=1389375037,node=video8-1.ams01.hls.justin.tv,nname=video8.ams01,fmt=source&sig=0729944f91b24cf1270aaf7645cf9a4b0303df3b&
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="high",NAME="High",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1760000,VIDEO="high"
http://video8.ams01.hls.twitch.tv/hls49/sirhcez_8161536112_52772821/high/index.m3u8?token=id=150606641873574234,bid=8161536112,exp=1389375037,node=video8-1.ams01.hls.justin.tv,nname=video8.ams01,fmt=high&sig=c1c24898f0e266a0ccd76979da055349e607874a&
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="medium",NAME="Medium",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,VIDEO="medium"
http://video8.ams01.hls.twitch.tv/hls49/sirhcez_8161536112_52772821/medium/index.m3u8?token=id=150606641873574234,bid=8161536112,exp=1389375037,node=video8-1.ams01.hls.justin.tv,nname=video8.ams01,fmt=medium&sig=65d5a189d65a4677118bcab71f31e59a7072da48&
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Low",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=596000,VIDEO="low"
http://video8.ams01.hls.twitch.tv/hls49/sirhcez_8161536112_52772821/low/index.m3u8?token=id=150606641873574234,bid=8161536112,exp=1389375037,node=video8-1.ams01.hls.justin.tv,nname=video8.ams01,fmt=low&sig=9bbc7083c2c340c356e6e8859e005b81530a9008&
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mobile",NAME="Mobile",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=164000,VIDEO="mobile"
http://video8.ams01.hls.twitch.tv/hls49/sirhcez_8161536112_52772821/mobile/index.m3u8?token=id=150606641873574234,bid=8161536112,exp=1389375037,node=video8-1.ams01.hls.justin.tv,nname=video8.ams01,fmt=mobile&sig=5d19cc0dee06a06ec3b828323641ac0363d72af2&
So this is where it gets difficult, we have literally no idea on how to actually open this stream through Windows Phone Streaming Media.

We were able to successfully import the library, but had no idea where to go from here.

I'm hoping that you could provide me with a little code snippet on where to go from here, as I'm very confused and this seems to be the only solution.
Nov 19, 2014 at 8:47 PM
A friend of mine helped me to get it to work :)
Coordinator
Nov 19, 2014 at 8:52 PM
Get a copy of the current source, open the HlsPlayer.VS2013.sln solution, set HlsPlayer.WP81 as the default startup project, set the architecture to x86. It shouldn't matter which emulator it is using, but I tend to use "Emulator 8.1 U1 WVGA 4 inch 512MB". Do a "Build Solution" to make sure that everything does build. Then start the debugger and make sure that the default stream plays.

If you prefer, you can use the latest alpha build instead of the source code.

If that works, go to HlsView.WinRT.Shared\TrackManager.cs and put your own URL (or URLs) there and try again.

If you prefer to use Player Framework, then use SamplePlayer.WP81 instead. The URL is set in SamplePlayer.WinRT.Shared\TrackManager.cs (or it can be set directly in SamplePlayer.WinRT.Shared\MainPage.xaml as the "Source" attribute for "<pf:MediaPlayer>".

You might also want to take a look at the Petri Louhelainen article linked from "Instructions on how to include HLS support for Universal/Windows Phone 8.1 RT-projects."

If you don't have it installed, you will probably want to install Player Framework v2.0. If you still have problems, make sure your Visual Studio is up to date (VS2013 is currently on Update 4). Check the "Updates" page in "Tools" -> "Extensions and Updates..." to make sure you aren't missing anything. If that still doesn't work, open a command line (cmd or PowerShell) and run Scripts\build2013.bat.
Coordinator
Nov 19, 2014 at 8:54 PM
Oops, I didn't see your response until I had posted mine.

Good to know that you got it working.
Nov 20, 2014 at 5:55 PM
I actually switched to your method where I create a stream using CreateMediaStreamSourceAsync method as I found it more reliable. However I'm still getting an error every now and then when I try to load a stream where it says it failed to decode. Any ideas? Image
Nov 20, 2014 at 5:59 PM
Edited Nov 20, 2014 at 6:21 PM
When this happens, there is a quick glance of the video and then it stops :P

I'm using the dll's from Source\App\WinRT\HlsView.WP81\bin\ARM\Debug (SM.Media, SM.Media.Builder, SM.Media.Platform.WinRT, SM.TsParser)

I'm using VS 2013 Community Edition with Update 4 :)

Also I can take the stream and open it in VLC and it's able to retrieve the stream successfully :)
Coordinator
Nov 20, 2014 at 6:49 PM
Is it apparently random or are you seeing it consistently with some streams and not with others? Are there any VOD streams that do this consistently?

Does the debug output window show anything of note?

Which version of the phonesm code are you using?

Thanks.

BTW, if you want the same folder structure as with the binary builds, run the "Scripts/buildAll.bat" and then take a look in the "Distribution" directory. It does run the 2012 build scripts, so it requires VS2012, but you should still be able to run the individual 2013 scripts.
Nov 25, 2014 at 8:39 PM
The error occured because we had enabled Stereo3DVideoRenderMode="Stereo" >_> sorry for the inconvenience.
Coordinator
Nov 28, 2014 at 9:21 AM
No problem...