Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 尝试从PushName中的参数访问视频url时出错_Flutter_Runtime Error_Video Streaming_Video Player - Fatal编程技术网

Flutter 尝试从PushName中的参数访问视频url时出错

Flutter 尝试从PushName中的参数访问视频url时出错,flutter,runtime-error,video-streaming,video-player,Flutter,Runtime Error,Video Streaming,Video Player,我正试图通过flifter中的pushNamed将URL传递到视频控制器 错误我面临的问题如下 I/ExoPlayerImpl(29662): Release 2d82dca [ExoPlayerLib/2.9.6] [ASUS_X00T_2, ASUS_X00TD, asus, 28] [goog.exo.core] I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4 E

我正试图通过flifter中的
pushNamed
将URL传递到
视频控制器

错误
我面临的问题如下


I/ExoPlayerImpl(29662): Release 2d82dca [ExoPlayerLib/2.9.6] [ASUS_X00T_2, ASUS_X00TD, asus, 28] [goog.exo.core]
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
E/BufferQueueProducer(29662): [SurfaceTexture-0-29662-5] cancelBuffer: BufferQueue has been abandoned
I/chatty  (29662): uid=10085(com.example.demo_app) JNISurfaceTextu identical 5 lines
E/BufferQueueProducer(29662): [SurfaceTexture-0-29662-5] cancelBuffer: BufferQueue has been abandoned
D/SurfaceUtils(29662): disconnecting from surface 0x7b16f15010, reason disconnectFromSurface
I/ExoPlayerImpl(29662): Init 3c27ac9 [ExoPlayerLib/2.9.6] [ASUS_X00T_2, ASUS_X00TD, asus, 28]
I/OMXClient(29662): IOmx service obtained
D/SurfaceUtils(29662): connecting to surface 0x7b17399010, reason connectToSurface
I/MediaCodec(29662): [OMX.qcom.video.decoder.avc] setting surface generation to 30373895
D/SurfaceUtils(29662): disconnecting from surface 0x7b17399010, reason connectToSurface(reconnect)
D/SurfaceUtils(29662): connecting to surface 0x7b17399010, reason connectToSurface(reconnect)
I/ExtendedACodec(29662): setupVideoDecoder()
I/ExtendedACodec(29662): Decoder will be in frame by frame mode
D/SurfaceUtils(29662): set up nativeWindow 0x7b17399010 for 1280x720, color 0x7fa30c06, rotation 0, usage 0x20002900
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
I/OMXClient(29662): IOmx service obtained
I/ACodec  (29662): codec does not support config priority (err -2147483648)
I/ACodec  (29662): codec does not support config priority (err -2147483648)
I/ACodec  (29662): codec does not support config operating rate (err -2147483648)
W/ExtendedACodec(29662): Failed to get extension for extradata parameter
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
D/SurfaceUtils(29662): set up nativeWindow 0x7b17399010 for 1280x720, color 0x7fa30c06, rotation 0, usage 0x20002900
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
I/chatty  (29662): uid=10085(com.example.demo_app) CodecLooper identical 1 line
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(29662): buffer descriptor with invalid usage bits 0x2000
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter (29662): https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
Lost connection to device.


DemoShowScreen
的代码如下


进口“包装:颤振/材料.省道”;
导入“../models/show.dart”;
导入“package:video_player/video_player.dart”;
类DemoShow扩展了StatefulWidget{
静态常量id=“显示屏幕”;
@凌驾
_DemoShowState createState();
}
类_DemoShowState扩展状态{
视频播放控制器\u控制器;
未来(Future)初始设定未来玩家;;
显示数据;
var媒体;
@凌驾
void initState(){
//创建并存储VideoPlayerController。VideoPlayerController
//提供多个不同的构造函数来播放来自资产、文件、,
//或者互联网。
媒体记者https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4';
_控制器=视频播放器控制器。网络(媒体);
//初始化控制器并存储将来使用的数据。
_initializeVideoPlayerFuture=_controller.initialize();
//使用控制器循环播放视频。
_控制器。设置循环(错误);
super.initState();
}
@凌驾
无效处置(){
//确保处置VideoPlayerController以释放资源。
_controller.dispose();
super.dispose();
}
@凌驾
小部件构建(构建上下文){
data=ModalRoute.of(context).settings.arguments;
设置状态(){
media=data.mediaUrl;
印刷品(媒体);
});
返回脚手架(
appBar:appBar(
title:Text(“${data.title}”,样式:Theme.of(context.textTheme.title,),
),
//使用FutureBuilder在等待加载时显示加载微调器
//VideoPlayerController完成初始化。
正文:SingleChildScrollView(
子:容器(
子:列(
儿童:[
未来建设者(
未来:_initializevideoplayer未来,
生成器:(上下文,快照){
if(snapshot.connectionState==connectionState.done){
//如果VideoPlayerController已完成初始化,请使用
//它提供的数据用于限制视频的纵横比。
返回AspectRatio(
aspectRatio:_controller.value.aspectRatio,
//使用VideoPlayer小部件显示视频。
子项:视频播放器(_控制器),
);
}否则{
//如果VideoPlayerController仍在初始化,则显示
//加载旋转器。
返回中心(子项:CircularProgressIndicator());
}
},
),
],
),
),
),
浮动操作按钮:浮动操作按钮(
已按下:(){
//在调用“setState”时结束播放或暂停。这样可以确保
//显示正确的图标。
设置状态(){
//如果正在播放视频,请将其暂停。
if(_controller.value.isPlaying){
_controller.pause();
}否则{
//如果视频暂停,请播放它。
_controller.play();
_控制器。seekTo(持续时间(秒:32));
}
});
},
//根据播放机的状态显示正确的图标。
子:图标(
_controller.value.isplay?图标。暂停:图标。播放箭头,
),
),//此尾随逗号使生成方法的自动格式设置更方便。
);
}
}
我试图用从pushNamed参数获得的
bee.mp4
URL替换
butterfly.mp4
URL

在屏幕上,我可以在视频播放器中看到
butterfly.mp4
帧,但它从不播放或更新
bee.mp4

此外,我还尝试调用
ModalRoute.of(context.settings.arguments)
initState
中,但以
null
结束,因此代码被删除

###更新代码后编辑 视频帧更改为当前视频,但我仍然面临播放视频的问题

带有无状态小部件的新代码


进口“包装:颤振/材料.省道”;
导入“../models/demo.dart”;
导入“package:video_player/video_player.dart”;
类DemoShowScreen扩展了无状态小部件{
静态常量id=“演示显示屏幕”;
视频播放控制器\u控制器;
未来(Future)初始设定未来玩家;;
@凌驾
小部件构建(构建上下文){
Show data=ModalRoute.of(context.settings.arguments);
_控制器=VideoPlayerController.network(data.mediaUrl);
_控制器。设置循环(错误);
返回脚手架(
正文:专栏(
儿童:[
容器(
孩子:未来建设者(
未来:_controller.initialize(),
生成器:(上下文,快照){
if(snapshot.connectionState==connectionState.done){
//如果VideoPlayerController已完成初始化,请使用
//它提供的数据用于限制视频的纵横比。
返回AspectRatio(
aspectRatio:_controller.value.aspectRatio,
//使用VideoPlayer小部件显示视频。
子项:视频播放器(_控制器),
);
}否则{
//如果VideoPlayerController仍在初始化,则显示
//加载旋转器。
返回中心(子项:CircularProgressIndicator());
}
},
),
),
],
),
浮动操作按钮:浮动操作按钮(
I/ExoPlayerImpl(22057): Release 877cbe7 [ExoPlayerLib/2.9.6] [ASUS_X00T_2, ASUS_X00TD, asus, 28] [goog.exo.core]
E/BufferQueueProducer(22057): [SurfaceTexture-0-22057-1] cancelBuffer: BufferQueue has been abandoned
I/chatty  (22057): uid=10085(com.example.demo_app) JNISurfaceTextu identical 5 lines
E/BufferQueueProducer(22057): [SurfaceTexture-0-22057-1] cancelBuffer: BufferQueue has been abandoned
D/SurfaceUtils(22057): disconnecting from surface 0x7b17aa2010, reason disconnectFromSurface
I/ExoPlayerImpl(22057): Init cf82360 [ExoPlayerLib/2.9.6] [ASUS_X00T_2, ASUS_X00TD, asus, 28]
I/OMXClient(22057): IOmx service obtained
D/SurfaceUtils(22057): connecting to surface 0x7b337e0010, reason connectToSurface
I/MediaCodec(22057): [OMX.qcom.video.decoder.avc] setting surface generation to 22586371
D/SurfaceUtils(22057): disconnecting from surface 0x7b337e0010, reason connectToSurface(reconnect)
D/SurfaceUtils(22057): connecting to surface 0x7b337e0010, reason connectToSurface(reconnect)
I/ExtendedACodec(22057): setupVideoDecoder()
I/ExtendedACodec(22057): Decoder will be in frame by frame mode
D/SurfaceUtils(22057): set up nativeWindow 0x7b337e0010 for 1280x720, color 0x7fa30c06, rotation 0, usage 0x20002900
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
I/OMXClient(22057): IOmx service obtained
I/ACodec  (22057): codec does not support config priority (err -2147483648)
I/ACodec  (22057): codec does not support config priority (err -2147483648)
I/ACodec  (22057): codec does not support config operating rate (err -2147483648)
W/ExtendedACodec(22057): Failed to get extension for extradata parameter
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
D/SurfaceUtils(22057): set up nativeWindow 0x7b337e0010 for 1280x720, color 0x7fa30c06, rotation 0, usage 0x20002900
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000
W/MapperHal(22057): buffer descriptor with invalid usage bits 0x2000 
class WebViewPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    ArgumentData data = ModalRoute.of(context).settings.arguments;
    return Scaffold(
body:DemoShow(data.url),
    );
  }
}