Is it possible to switch bandwidth manually when streaming Video in HLS? I mean Video on demand, not live video.
HLS: http://en.wikipedia.org/wiki/HTTP_Live_Streaming
It look like youtube switching quality.
And there is commercial product: http://www.longtailvideo.com/support/forums/jw-player/using-playlists/32487/hls-playlist/
You can, as long as you control the player and the feeding logic to the player, which includes downloading the content, determining the right bit rate stream etc. This is true for many devices and many app/player including youtube.
You cannot on iOS. In the case of iOS, you can only specify a PreferredPeakBitRate (AVPlayerItem property) and cannot (at least not yet) manually switch video streams.
Yes you can. But you'll have a little bit of manifest file parsing.
In HLS world, everything begins with a manifest file : .m3u8
Manifest files reference movie files (cut in little chunks) and other stuff like subtitles, audio and so on.
You generally read a master manifest which references differents sub-manifests - one per video encoding quality - containing the video files (.ts files)
Even with encrypted streams (like Apple Fairplay DRM), manifests are always clear raw text files.
Here's an example of different video variants according to relative bandwidth in a master manifest file:
#EXT-X-STREAM-INF:BANDWIDTH=409000,CODECS="mp4a.40.2,avc1.640015",RESOLUTION=480x270,AUDIO="audio-aacl-64",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
sub-manifest-1.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1409000,CODECS="mp4a.40.2,avc1.64001E",RESOLUTION=854x480,AUDIO="audio-aacl-128",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
sub-manifest-2.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2469000,CODECS="mp4a.40.2,avc1.64001F",RESOLUTION=1280x720,AUDIO="audio-aacl-128",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
sub-manifest-3.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3953000,CODECS="mp4a.40.2,avc1.640028",RESOLUTION=1920x1080,AUDIO="audio-aacl-128",SUBTITLES="textstream",CLOSED-CAPTIONS=NONE
sub-manifest-4.m3u8
In this example, just parse this file to retreive sub-manifest-1.m3u8
to get the sub manifest relative to the bandwith 409000.
If the master manifest URL was http://myserver.com/path/mastermanifest.m3u8
, the sub manifest URL will be http://myserver.com/path/sub-manifest-1.m3u8
Note that you can directly have absolute URLs for the sub manifest files. in this case, just use these URL directly.