I'm using the MediaPlayer with a m3u8 audio stream. This results in a log error message: Error(1, -1010)
The first argument seems ok when I look at the error codes: https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_codes.h
Only -1010
, is strange.
When I use the apple video m3u8
url it's working great! This is the url:
http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8
The code I'm using is simple:
MediaPlayer mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setDataSource("http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8");
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.prepare();
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.setOnErrorListener(this);
mediaPlayer.setOnCompletionListener(this);
mediaPlayer.start();
} catch (IllegalArgumentException e1) {
e1.printStackTrace();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
Does anyone know if there is a limitation for audio only streams? I used multiple formats and different extensions.
Other question: does anyone have an URL of an m3u8 audio stream, so I can test other streams?
I'm currently attached to a project tackling this very subject. Now I know this doesn't really answer your question, but just for insight, even on Android 4.0+ M3U8 support is spotty at best, awful at worst.
E.g.:
Now short of patching the libraries via class extension (and having .so's for every other android minor version) we found no SDK/NDK-only solution; we gave up after a month of trial and error on our project (too costly).
The solution we implemented was: Try the SDK MediaPlayer. If that fails use a FFMPEG based player (developed in-house, using dranger, ffplay, android-fplayer and dolphin-player as inspiration).