MediaPlayer Framework on GingerBread and Apple's HTTP Live Streaming Support
Asked Answered
F

2

5

According to the release notes, StageFright replaces the OpenCore framework in the GingerBread release. It seems that there have been numerous discussion that says: Apple's HTTP Live streaming is supported by default since Android 2.3. Even the Wikipedia mentions this.
However, when I try to run the test stream provided by Apple using the MediaPlayerDemo_Video.java bundled with API Demos I get the following exceptions:

setDataSource('http://devimages.apple.com/iphone/samples/bipbop/gear1/
prog_index.m3u8')
connect to devimages.apple.com:80/iphone/samples/bipbop/gear1/
prog_index.m3u8 @0
INFO/NuCachedSource2(34): ERROR_END_OF_STREAM
error (1, -2147483648)
ERROR/MediaPlayerDemo(667): error: Prepare failed.: status=0x1
java.io.IOException: Prepare failed.: status=0x1
at android.media.MediaPlayer.prepare(Native Method)
at
com.video.stream.MediaPlayerDemo_Video.playVideo(MediaPlayerDemo_Video.java:
125)
at
com.video.stream.MediaPlayerDemo_Video.surfaceCreated(MediaPlayerDemo_Video.java:
181)
  ...
    surfaceChanged called
    Displayed com.video.stream/.MediaPlayerDemo_Video: +1s652ms (total
    +7s427ms)
    GC_EXPLICIT freed 2K, 55% free 2514K/5511K, external 716K/1038K,
    paused 183ms
    GC_EXPLICIT freed 17K, 52% free 2782K/5767K, external 716K/1038K,
    paused 87ms
    GC_EXPLICIT freed 68K, 50% free 2972K/5895K, external 2544K/3109K,
    paused 104ms
    request time failed: java.net.SocketException: Address family not
    supported by protocol 

---relevant code(MediaPlayerDemo_Video.java):

path = "http://devimages.apple.com/iphone/samples/bipbop/gear1/
prog_index.m3u8";
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(path);
mMediaPlayer.setDisplay(holder);
mMediaPlayer.prepare();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnVideoSizeChangedListener(this);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

Questions:
1. Does GingerBread build really support Apple's HTTP Live Streaming protocol?
2. What went wrong above?

Please help.

Freebooter answered 19/1, 2011 at 13:25 Comment(4)
I had added a {{citation needed}} on the Wiki page and it seems the author has responded by changing the section.Freebooter
The Preview SDK for Honeycomb is available for download and is advertised to support m3U8. however, I was not able to play Apple's test stream on it.Freebooter
I've filed a bug for this: code.google.com/p/android/issues/…Freebooter
The actual SDK has been released and I have updated this thread with my findings.Freebooter
F
8

Alright, I have found some data and I am going to update this thread by answering my own question. If someone has suggestions or other considerations to bring to table please add.

  1. Stagefrightframework that comes with Honeycomb build supports HTTP Live Streaming. The documentation reads most parts of the draft specification without mentioning explicitly which parts.

  2. The video and audio should conform to media formats supported by Android.

  3. I was able to play content-protected streams employing AES-128 encryption. Though, the performance of the emulator(unfortunately, I did not have the device) was not good. Audio and Video were terribly out of sync. Streaming applications HAVE to be tested on real devices.

  4. You cannot stream your data over https. Also, in order to detect that the stream conforms to HTTPLive standard you'll have to replace "http://" part of the URL with "httplive://"

Freebooter answered 28/2, 2011 at 6:27 Comment(1)
Hello, i have done same thing which you said. i have tested in (URL with "httplive")2.2,2.3 and 4.0(URL with "http") it work fine but it is not working only in Xperia Neo v which have OS 2.3.4. can you tell what is reason of this issue please?Selfexplanatory
F
0

Gingerbread does support playing some HLS streams using the httplive:// scheme prefix but the codecs supported are very limited and it's very easy to construct a perfectly valid stream that crashes the media framework and fails to play.

My experiences have shown that this crash normally occurs while loading or decoding the first segment, even for encrypted content, but that the key does not get requested suggesting that the framework is ignoring the KEY lines.

Of course, for those who only need to support the very newest devices on the market, the support for HLS in ICS appears reasonable (though still imperfect) however those of us who need some kind of backwards compatibility are left decidedly out in the cold, and it seems the only option for streaming (as opposed to progressive download) is RTSP, which itself is poorly implimented in Android.

Flinty answered 11/9, 2012 at 13:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.