Search code examples
video-streaminggoogle-tv

How to implement smooth streaming?


I read https://developers.google.com/tv/android/articles/hls?hl=en and not clearly understand what meaning "Adaptive Streaming - Automatically adapts to either congestion or bandwidth availability."? Is it works only when player starts, or wile playing too?

In my practice video starts with quality according to current bandwidth; For exmaple .m3u8 file contains list of links and bandwidths:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1950000
http://link1.M3U8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1500000
http://link2.M3U8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1200000
http://link3.M3U8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=950000
http://link4.M3U8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=800000
http://link5.M3U8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=700000
http://link6.M3U8

For example my current bandwidth 1600000, the player (VideoView) starts playing video from link 2. While playing, my bandwidth becomes 900000 but player still continues to play video from link 2 with buffering delays.

Is player works correctly, or he should switch to link 5?

If it is correct, can I somehow switch video link without restarting video?

Thank you!

Update: Test device Logitech Reveue, android 3.2. Video player - VideoView.


Solution

  • First off - the manifest your showing is HLS aka HTTP Live Streaming not Microsoft's SmoothStreaming.

    Each segment in HLS is typically 10 seconds.

    You don't mention what your player is, but I'll presume it's a GoogleTV since that's what you've tag'd the question with. Different players behave differently, however the basic idea is the same. The player measures the time it takes to get each segment, and if it is in time, it tends to keep it the same, if it took too long it will try to pick a bandwidth where it can get a segment or two before it needs to play it. If your seeing buffering delays that is an error. You should be able to look in the log file to see what the player is doing when playing content and why it's not switching to a different bandwidth.