nitin tyagi
nitin tyagi

Reputation: 1186

Not able to play live video through ExoPlayer

I am using ExoPlayer for playing video in Android,. We are using the ExoPlayer for playing mp4 and live videos. But sometime we are getting the exception described below.

> 12-01 14:15:09.388 12080-12517/com.mse.monumentalsnetwork
> E/ExoPlayerImplInternal: Source error.
>                                                                                    com.google.android.exoplayer2.source.UnrecognizedInputFormatException:
> Input does not start with the #EXTM3U header.
>                                                                                        at
> com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:119)
>                                                                                        at
> com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser.parse(HlsPlaylistParser.java:43)
>                                                                                        at
> com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:115)
>                                                                                        at
> com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:315)
>                                                                                        at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
>                                                                                        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
>                                                                                        at java.lang.Thread.run(Thread.java:818)

So Please help me on it.

Upvotes: 4

Views: 4993

Answers (3)

Zafar Imam
Zafar Imam

Reputation: 319

In my case i was using different format like

format=mpd-time-csf then i changed it to format=m3u8-aapl then i was able to play azure streaming video.

Referece: HLS Dynamic packaging

Upvotes: 0

MazRoid
MazRoid

Reputation: 145

Check your URL. It could be that your URL contains a blank space, which you can replace like this:

String StringName= "Your URL".replaceAll(" ","%20");

Upvotes: 0

marcbaechinger
marcbaechinger

Reputation: 2789

The error indicates that you are using a HlsMediaSource while you want to play an MP4 file. It fails to parse the HLS manifest.

You need to use an ExtractorMediaSource for playing MP4:

DefaultHttpDataSourceFactory dataSource = new DefaultHttpDataSourceFactory(
    Util.getUserAgent(this, "your-user-agent"));
ExtractorMediaSource mediaSource = new ExtractorMediaSource.Factory(dataSource)
    .createMediaSource(uri, null, null);
player.setPlayWhenReady(true);
player.prepare(mediaSource);

The demo application of ExoPlayer has a createMediaSource method which demonstrates the creation of the available media sources.

Upvotes: 5

Related Questions