Reputation: 342
I've been trying to stream video to Android devices using HLS, which is officially supported since HoneyComb. The problem is, when I use the Apple HLS test stream there seems to be no adaptivity. When I have a good connection i get a proper stream in high quality, but when I use 3G i get the same quality and streaming lags. I've been using the standard Android classes for this:
String Url = AppleUrl = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";
MediaController mMediaController = new MediaController(this);
VideoView mVideoView = (VideoView) findViewById(R.id.vid);
mVideoView.setVideoPath(Url);
mVideoView.setMediaController(mMediaController);
mVideoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});
When using VLC I get the same result, has anybody tested if Android really supports the adaptivity of HLS streaming?
UPDATE
Updated the stream URL to the multi track m3u8 playlist
Upvotes: 2
Views: 4564
Reputation: 342
So as it turns out Android does support HLS streaming but the adaptive bit rate switching part is left out. As soon as the connection gets better or worse and a different video track is chosen the stream freezes and soon after that the app crashes.
Upvotes: 3
Reputation: 7645
In your code example, the URL to the playlist is for a specific bitrate and it's not possible to do adaptive streaming unless the Android client knows about the alternate renditions.
You need to set a different URL to the VideoView
. Try this one which contains multiple bitrates: http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8
Upvotes: 1