我正在尝试在Google
https://developers.google.com/vr/android/samples/vrview的VRVideoView示例中播放m3u8网址.它适用于mp4或flv但是在使用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)
我可以在这个错误堆栈中看到Exoplayer用于播放视频,但不应该与m3u8一起使用吗?这是我使用的URL:http://www.nacentapps.com/m3u8/index.m3u8.
谢谢你的帮助!
最佳答案 要播放m3u8,您需要做的就是将选项输入格式更改为
'Uri uri = Uri.parse("https:proper_url.m3u8");
VrVideoView.Options vrVideoView = new VrVideoView.Options();
vrVideoView.inputFormat = VrVideoView.Options.FORMAT_HLS;
videoWidgetView.loadVideo(uri, vrVideoView)'