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

Switching videos declared in one m3u8 file

Jun 13, 2015 at 4:30 PM
Edited Jun 13, 2015 at 6:51 PM
Hey,

I've spend several hours with phonesm and can't find a way to switch between a video tracks in m3u8 file.

As a example here is a twitch.tv one:
`#EXTM3U
#EXT-X-TWITCH-INFO:NODE="video42.fra01",MANIFEST-NODE="video42.fra01",SERVER-TIME="1434212503.43",USER-IP="78.107.234.203",CLUSTER="fra01",MANIFEST-CLUSTER="fra01"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="chunked",NAME="Source",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2656937,RESOLUTION=1280x720,CODECS="avc1.4D4029,mp4a.40.2",VIDEO="chunked"
http://video42.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/chunked/py-index-live.m3u8?token=id=2432752156258269693,bid=14846628144,exp=1434298903,node=video42-1.fra01.hls.justin.tv,nname=video42.fra01,fmt=chunked&sig=bcb5c2ba291f04be57acd194371df031ae6cd6bd
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="high",NAME="High",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1760000,CODECS="avc1.66.31,mp4a.40.2",VIDEO="high"
http://video42.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/high/py-index-live.m3u8?token=id=2432752156258269693,bid=14846628144,exp=1434298903,node=video42-1.fra01.hls.justin.tv,nname=video42.fra01,fmt=high&sig=a6a236dca863ea77d7997ee64fe28b111b1abe7e
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="medium",NAME="Medium",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,CODECS="avc1.66.31,mp4a.40.2",VIDEO="medium"
http://video42.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/py-index-live.m3u8?token=id=2432752156258269693,bid=14846628144,exp=1434298903,node=video42-1.fra01.hls.justin.tv,nname=video42.fra01,fmt=medium&sig=f5f0a09a6a20d9896633293ddc1f60d07cc2cbf3
Is there a way to switch between these groups(GROUP-ID)?

Also. I'm trying hard to use MVVM pattern(no code behind xaml). Is there any way to bind tracks through Source property (using Media Player Framework for now)?

Or should I use HLSView? And where I can find more documentation on project? Samples are really basic.

Also I noticed that stream can suddenly stop:
BufferingManager.UpdateBuffering done buffering: duration 00:00:09.0500000 size 1708507 starting False memory 12.94 MiB
  Audio count 2507 size 872560 newest 00:19:31.8123333 oldest 00:18:38.3296667
  Video count 560 size 866302 newest 00:19:31.8000000 oldest 00:19:22.4670000
---- Completed http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008039-753z.ts at 6/13/2015 10:45:40 PM +04:00 (00:00:00.1332806).  Total memory: 13.35 MiB
BufferingManager.UpdateState start buffering: duration 00:00:00 size 898906 starting False memory 11.48 MiB
BufferingManager.ReportExhaustion()
  Audio count 2582 size 898906 newest 00:19:33.4550000 oldest 00:18:38.3723333
  Video count 0 size 0 newest 00:19:33.4500000 oldest 00:19:33.4500000
HlsPlaylistSegmentManager.ReadSubList(6/13/2015 10:45:52 PM +04:00)
HlsPlaylistSegmentManager.ReadSubList() refreshed playlist in 00:00:00.0602230
HlsPlaylistSegmentManager.UpdatePlaylist: playlist dynamic True segments 7 url http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/py-index-live.m3u8?token=id=3813263660049196975,bid=14846628144,exp=1434306386,node=video10-1.fra01.hls.justin.tv,nname=video10.fra01,fmt=medium&sig=68c02b1be1b693a95a9fc851aa79c586d951e183 loaded with 19 entries. index: 11 dynamic: True expires: 00:00:14 (6/13/2015 10:45:52 PM +04:00)
++++ Starting http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008040-Xykn.ts at 6/13/2015 10:45:53 PM +04:00.  Total memory: 11.54 MiB
BufferingManager.UpdateBuffering: 10.74% duration 00:00:00.0170000 size 900627 starting False memory 11.60 MiB
BufferingManager.UpdateBuffering: 18.52% duration 00:00:01.6670000 size 1084376 starting False memory 11.62 MiB
---- Completed http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008040-Xykn.ts at 6/13/2015 10:45:53 PM +04:00 (00:00:00.5221373).  Total memory: 11.68 MiB
++++ Starting http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008041-giEE.ts at 6/13/2015 10:45:53 PM +04:00.  Total memory: 11.68 MiB
BufferingManager.UpdateBuffering: 56.11% duration 00:00:05.0500000 size 1484213 starting False memory 11.72 MiB
---- Completed http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008041-giEE.ts at 6/13/2015 10:45:53 PM +04:00 (00:00:00.1886716).  Total memory: 11.80 MiB
++++ Starting http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008042-SUuZ.ts at 6/13/2015 10:45:53 PM +04:00.  Total memory: 11.81 MiB
BufferingManager.UpdateBuffering done buffering: duration 00:00:09.0670000 size 1914236 starting False memory 11.85 MiB
  Audio count 3019 size 1050705 newest 00:19:42.7776667 oldest 00:18:38.3723333
  Video count 560 size 890530 newest 00:19:42.7840000 oldest 00:19:33.4500000
---- Completed http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/index-0000008042-SUuZ.ts at 6/13/2015 10:45:53 PM +04:00 (00:00:00.1480242).  Total memory: 12.47 MiB
BufferingManager.UpdateState start buffering: duration 00:00:00 size 1094357 starting False memory 12.94 MiB
  Audio count 3143 size 1094357 newest 00:19:45.4656667 oldest 00:18:38.4150000
BufferingManager.ReportExhaustion()
  Video count 0 size 0 newest 00:19:45.4500000 oldest 00:19:45.4500000
HlsPlaylistSegmentManager.ReadSubList(6/13/2015 10:46:06 PM +04:00)
HlsPlaylistSegmentManager.ReadSubList() refreshed playlist in 00:00:00.1644571
HlsPlaylistSegmentManager.UpdatePlaylist: playlist dynamic True segments 7 url http://video10.fra01.hls.ttvnw.net/hls121/tru3ta1ent_14846628144_256623429/medium/py-index-live.m3u8?token=id=3813263660049196975,bid=14846628144,exp=1434306386,node=video10-1.fra01.hls.justin.tv,nname=video10.fra01,fmt=medium&sig=68c02b1be1b693a95a9fc851aa79c586d951e183 loaded with 20 entries. index: 12 dynamic: True expires: 00:00:13.9150000 (6/13/2015 10:46:06 PM +04:00)
Thank you.
Coordinator
Jun 15, 2015 at 11:15 PM
Have you tried the example code under "Selecting the Stream" on the Documentation page? That code is, unfortunately, only called when playback is started, so to change it during playback, one must first stop playback.

Apart from not blocking (e.g., switching onto the UI thread would be a bad idea), there is no particular restriction on what the callback can do. It could be a member function on one of your classes or some-such.