我使用过video_player:^ 0.10.1 + 2,它在Ios上运行良好,但在Android上无法运行
_videoPlayerController1 = VideoPlayerController.network('带有.m3u8文件的网址');
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController1,
//aspectRatio: 3 / 2,
//aspectRatio: _videoPlayerController1.value.aspectRatio,
autoPlay: true,
looping: true,
routePageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondAnimation, provider) {
return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget child) {
return VideoScaffold(
child: Scaffold(
resizeToAvoidBottomPadding: false,
body: Container(
margin: EdgeInsets.only(bottom: 50),
alignment: Alignment.center,
color: Colors.black,
child: provider,
),
),
);
},
);
},
materialProgressColors: ChewieProgressColors(
playedColor: Colors.red,
handleColor: Colors.blue,
backgroundColor: Colors.grey,
bufferedColor: Colors.lightGreen,
),
placeholder: Container(
color: Colors.grey,
),
autoInitialize: true,
);
E / ExoPlayerImplInternal(13111):com.google.android.exoplayer2.upstream.HttpDataSource $ InvalidResponseCodeException:响应代码:404 E / ExoPlayerImplInternal(13111):位于com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:300) E / ExoPlayerImplInternal(13111):位于com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:83) E / ExoPlayerImplInternal(13111):位于com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:102) E / ExoPlayerImplInternal(13111):位于com.google.android.exoplayer2.upstream.DataSourceInputStream.open(DataSourceInputStream.java:65) E / ExoPlayerImplInternal(13111):位于com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:156) E / ExoPlayerImplInternal(13111):位于com.google.android.exoplayer2.upstream.Loader $ LoadTask.run(Loader.java:381) E / ExoPlayerImplInternal(13111):位于java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E / ExoPlayerImplInternal(13111):位于java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:641) E / ExoPlayerImplInternal(13111):位于java.lang.Thread.run(Thread.java:764)
答案 0 :(得分:0)
Flutter的video_player
插件使用docs中提到的Android上的ExoPlayer。每次检查ExoPlayer's GitHub issue tracker,它应该支持.m3u8格式。
如果您能够运行Android项目,建议您尝试在其demo app上播放.m3u8流链接,并查看其是否有效。如果.m3u8链接在ExoPlayer演示应用程序上有效,则video_player
插件中可能存在问题。否则,我建议在ExoPlayer's GitHub issue page上提交票证,以检查您所使用的媒体中是否存在问题。还请包括一个可访问的.m3u8流链接,可以对其进行测试以诊断问题。