Micky
Micky

Reputation: 5728

Error playing HLS stream with Google Exoplayer on Android

Does the Google Exoplayer (https://github.com/google/ExoPlayer) support Http live streaming yet? Android supports it in general but when I try to play a .m3u8 HLS stream with Exoplayer on Android, I only get errors (see Log below). I used the minimal Exoplayer setup from Google IO (http://www.davekb.com/browse_programming_tips:android_minimal_exoplayer_use:txt)

Do I need to use different TrackRenderers than the MediaCodecVideoTrackRenderer and MediaCodecAudioTrackRenderer? If yes, which one?

Init 1.0.12
I/NuCachedSource2﹕ ERROR_END_OF_STREAM
D/WVMLogging﹕ Thu Aug 28 10:28:47 2014 (79a3a730):WVSession::SetError: status=1001,     desc=Invalid data format
E/WVMExtractorImpl﹕ WV_Setup returned status 1001 in WVMMediaSource::start

Upvotes: 2

Views: 4618

Answers (2)

Ankit Lathiya
Ankit Lathiya

Reputation: 199

You can use below code to play .m3u8 file before initializing:-

Handler mHandler = new Handler();

String userAgent = Util.getUserAgent(context, "YOUR_APPLICATION_NAME");

DataSource.Factory dataSourceFactory = new DefaultHttpDataSourceFactory(
                userAgent, null,
                DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
                1800000,
                true);

HlsMediaSource mediaSource = new HlsMediaSource(Uri.parse(mediaUrl),dataSourceFactory, 1800000,mHandler, null);

if (mediaUrl != null) {
    videoPlayer.prepare(mediaSource);
    videoPlayer.setPlayWhenReady(true);
}

Upvotes: 0

aeren
aeren

Reputation: 334

==================================================================

EDIT : dev-hls branch has been removed and I checked that master branch is good to go.

==================================================================

You can use dev-hls branch of exoPlayer.
It is still in development and not merged any part of it to master yet. But, It seems promising to me.

dev-hls branch: https://github.com/google/ExoPlayer/tree/dev-hls

Upvotes: 2

Related Questions