Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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 视频不可见,但音频在iOS、Flatter视频播放器中工作正常_Flutter - Fatal编程技术网

Flutter 视频不可见,但音频在iOS、Flatter视频播放器中工作正常

Flutter 视频不可见,但音频在iOS、Flatter视频播放器中工作正常,flutter,Flutter,这在android设备中运行良好,音频和视频都会相应地播放。但在iOS中,只有音频工作,没有视觉效果。 我正在iOS模拟器中运行应用程序。我还在GitHub上搜索了这个问题,人们认为它在真实设备上可以正常工作,但事实并非如此 这是我播放视频的全部代码 class UiPathVideoPage extends StatefulWidget { final String text; UiPathVideoPage({Key key, @required this.text}) : supe

这在android设备中运行良好,音频和视频都会相应地播放。但在iOS中,只有音频工作,没有视觉效果。 我正在iOS模拟器中运行应用程序。我还在GitHub上搜索了这个问题,人们认为它在真实设备上可以正常工作,但事实并非如此

这是我播放视频的全部代码

class UiPathVideoPage extends StatefulWidget {
  final String text;
  UiPathVideoPage({Key key, @required this.text}) : super(key: key);
  @override
  _UiPathVideoPageState createState() => _UiPathVideoPageState();
}

class _UiPathVideoPageState extends State<UiPathVideoPage> {
  VideoPlayerController _controller;
  ProgressDialog pr;
  @override void initState() {
    // TODO: implement initState


    super.initState();




    if(widget.text == 'Telecom') {
      _controller = VideoPlayerController.network(
          'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/04ea5f9ca1')
        ..initialize().then((_) {
          // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
          setState(() {});
          _controller.value.isPlaying
              ? _controller.pause()
              : _controller.play();

        });
    }
    if(widget.text == 'Finance'){
      _controller = VideoPlayerController.network(
          'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/o/VideoLibrary%273320d38f')
        ..initialize().then((_) {
          // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
          setState(() {});
          _controller.value.isPlaying
              ? _controller.pause()
              : _controller.play();
        });

    }
    if(widget.text == 'Sales'){
      _controller = VideoPlayerController.network(
          'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/o/VideoLibraryc498e')
        ..initialize().then((_) {
          // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
          setState(() {});
          _controller.value.isPlaying
              ? _controller.pause()
              : _controller.play();
        });

    }

    if(widget.text == 'Others'){

      _controller = VideoPlayerController.network(
          'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/o/VideoLibrary%2Fcea5f9ca1')
        ..initialize().then((_) {
          // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
          setState(() {});
          _controller.value.isPlaying
              ? _controller.pause()
              : _controller.play();

        });

    }

  }
  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    _controller.dispose();
  }
  @override
  Widget build(BuildContext context) {
    pr = new ProgressDialog(context);
    pr.style(
        message: 'Please Waiting...',
        borderRadius: 10.0,
        backgroundColor: Colors.white,
        progressWidget: CircularProgressIndicator(),
        elevation: 10.0,
        insetAnimCurve: Curves.easeInOut,
        progress: 0.0,
        maxProgress: 100.0,
        progressTextStyle: TextStyle(
            color: Colors.black, fontSize: 13.0, fontWeight: FontWeight.w400),
        messageTextStyle: TextStyle(
            color: Colors.black, fontSize: 19.0, fontWeight: FontWeight.w600)
    );
    return Container(
      child: Scaffold(
        backgroundColor: Colors.grey[200],
        appBar: AppBar(
          backgroundColor: Colors.grey[900],
          title: Text(""),
        ),
        body: Center(
            child:
            _controller.value.initialized
                ? AspectRatio(
              aspectRatio: _controller.value.aspectRatio,
              child: VideoPlayer(_controller),
            )
                : Container(
              child: Image.asset('assets/loading.gif'),
            )

        ),


        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {

              _controller.value.isPlaying
                  ? _controller.pause()
                  : _controller.play();
            });
          },
          child: Icon(
            _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
          ),
        ),
      ),
    );
  }
}
类UiPathVideoPage扩展StatefulWidget{
最终字符串文本;
UiPathVideoPage({Key-Key,@required this.text}):超级(Key:Key);
@凌驾
_UiPathVideoPageState createState()=>UiPathVideoPageState();
}
类_UiPathVideoPageState扩展了状态{
视频播放控制器\u控制器;
进步对话公关;
@重写void initState(){
//TODO:实现initState
super.initState();
如果(widget.text=='Telecom'){
_控制器=VideoPlayerController.network(
'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/04ea5f9ca1')
…初始化()。然后(u41;{
//确保在视频初始化后,甚至在按下播放按钮之前,显示第一帧。
setState((){});
_controller.value.isPlaying
?_控制器暂停()
:_controller.play();
});
}
如果(widget.text==“财务”){
_控制器=VideoPlayerController.network(
'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/o/VideoLibrary%273320d38f')
…初始化()。然后(u41;{
//确保在视频初始化后,甚至在按下播放按钮之前,显示第一帧。
setState((){});
_controller.value.isPlaying
?_控制器暂停()
:_controller.play();
});
}
如果(widget.text=='Sales'){
_控制器=VideoPlayerController.network(
'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/o/VideoLibraryc498e')
…初始化()。然后(u41;{
//确保在视频初始化后,甚至在按下播放按钮之前,显示第一帧。
setState((){});
_controller.value.isPlaying
?_控制器暂停()
:_controller.play();
});
}
如果(widget.text==“其他”){
_控制器=VideoPlayerController.network(
'https://firebasestorage.googleapis.com/v0/b/recycler-view-8483d.appspot.com/o/VideoLibrary%2Fcea5f9ca1')
…初始化()。然后(u41;{
//确保在视频初始化后,甚至在按下播放按钮之前,显示第一帧。
setState((){});
_controller.value.isPlaying
?_控制器暂停()
:_controller.play();
});
}
}
@凌驾
无效处置(){
//TODO:实现dispose
super.dispose();
_controller.dispose();
}
@凌驾
小部件构建(构建上下文){
pr=新建进度对话框(上下文);
公关风格(
信息:“请稍候…”,
边界半径:10.0,
背景颜色:Colors.white,
progressWidget:CircularProgressIndicator(),
标高:10.0,
insetAnimCurve:Curves.easeInOut,
进展:0.0,
maxProgress:100.0,
progressTextStyle:TextStyle(
颜色:Colors.black,fontSize:13.0,fontWeight:fontWeight.w400),
messageTextStyle:TextStyle(
颜色:Colors.black,fontSize:19.0,fontWeight:fontWeight.w600)
);
返回容器(
孩子:脚手架(
背景颜色:颜色。灰色[200],
appBar:appBar(
背景颜色:颜色。灰色[900],
标题:文本(“”),
),
正文:中(
儿童:
_controller.value.initialized
?AspectRatio(
aspectRatio:_controller.value.aspectRatio,
子项:视频播放器(_控制器),
)
:容器(
子级:Image.asset('assets/loading.gif'),
)
),
浮动操作按钮:浮动操作按钮(
已按下:(){
设置状态(){
_controller.value.isPlaying
?_控制器暂停()
:_controller.play();
});
},
子:图标(
_controller.value.isplay?图标。暂停:图标。播放箭头,
),
),
),
);
}
}

我正在寻求帮助,提前谢谢

请添加代码,而不是代码的屏幕截图。您找到解决方案了吗?我也面临同样的问题。找到解决办法了吗?请更新。