Reputation: 593
I'm trying to play a m3u8 URL in the VRVideoView Sample from Google https://developers.google.com/vr/android/samples/vrview. It's working well with mp4 or flv but I have the following error when trying with m3u8 :
com.google.vr.sdk.samples.simplevideowidget E/VrVideoPlayerInternal: 136877483.onPlayerError com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.extractor.ExtractorSampleSource$UnrecognizedInputFormatException: None of the available extractors (WebmExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor) could read the stream. at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:263) at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:149) at com.google.android.exoplayer.ExoPlayerImplInternal.incrementalPrepareInternal(ExoPlayerImplInternal.java:275) at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:205) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:154) at android.os.HandlerThread.run(HandlerThread.java:61) at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
Caused by: com.google.android.exoplayer.extractor.ExtractorSampleSource$UnrecognizedInputFormatException: None of the available extractors (WebmExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor) could read the stream. at com.google.android.exoplayer.extractor.ExtractorSampleSource$ExtractorHolder.selectExtractor(ExtractorSampleSource.java:899) at com.google.android.exoplayer.extractor.ExtractorSampleSource$ExtractingLoadable.load(ExtractorSampleSource.java:829) at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:209) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)
I can see in this error stack that the Exoplayer is used to play the video, but shouldn't it work with m3u8 ? Here is the URL I used : http://www.nacentapps.com/m3u8/index.m3u8.
Thanks for your help!
Upvotes: 4
Views: 1573
Reputation: 199
Handler mHandler = new Handler();
String userAgent = Util.getUserAgent(context, "Exo Player");
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
Reputation: 514
For playing m3u8 all you need to do is change the options input format to and it will
'Uri uri = Uri.parse("https:proper_url.m3u8");
VrVideoView.Options vrVideoView = new VrVideoView.Options();
vrVideoView.inputFormat = VrVideoView.Options.FORMAT_HLS;
videoWidgetView.loadVideo(uri, vrVideoView)'
Upvotes: 1
Reputation: 355
try replacing the url with the demo urls in the code example below, if it works, then you can reuse the example code in the github account provided below: https://github.com/google/ExoPlayer/tree/master/demo/src/main/java/com/google/android/exoplayer
if it doesn't work then the file must have some issue or exoplayer does not support it..
Upvotes: 0