Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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
Android 播放视频时,颤振编解码器不支持配置优先级(错误-2147483648)_Android_Dart_Flutter - Fatal编程技术网

Android 播放视频时,颤振编解码器不支持配置优先级(错误-2147483648)

Android 播放视频时,颤振编解码器不支持配置优先级(错误-2147483648),android,dart,flutter,Android,Dart,Flutter,我在绘画项目中工作,我需要显示视频列表,效果很好。但是,当视频播放时,它会显示控制台中的某个编解码器不支持配置优先级(err-2147483648), 在这里,我使用ImagePicker从摄像机录制视频,并传送到VideoPlayerController class VideoScaling扩展了StatefulWidget{ @凌驾 _VideoScalingState createState()=>new _VideoScalingState(); } 类\u VideoScalingS

我在绘画项目中工作,我需要显示视频列表,效果很好。但是,当视频播放时,它会显示控制台中的某个
编解码器不支持配置优先级(err-2147483648)
, 在这里,我使用
ImagePicker
从摄像机录制视频,并传送到
VideoPlayerController

class VideoScaling扩展了StatefulWidget{
@凌驾
_VideoScalingState createState()=>new _VideoScalingState();
}
类\u VideoScalingState扩展状态{
视频播放控制器;
bool_isplay=false;
视频路径;
字符串;
视频播放器列表器;
列表_listOfVideos=[];
void\u video()异步{
_视频路径=
等待ImagePicker.pickVideo(来源:ImageSource.camera)。然后((p){
_videoP=p.path;
});
_startVideoPlayer();
}
视频播放控制器;
Future\u startVideoPlayer()异步{
//打印('path video:${u videoP}');
vcontroller=newvideoplayercontroller.file(新文件(_videoP));
videoPlayerListener=(){
if(videoController!=null&&videoController.value.size!=null){
//刷新状态以更新具有正确比率的视频播放器。
如果(已安装)设置状态((){});
videoController.RemovelListener(videoPlayerListener);
}
};
vcontroller.addListener(videoPlayerListener);
等待vcontroller.setLooping(真);
等待vcontroller.initialize();
等待videoController?.dispose();
如果(已安装){
设置状态(){
视频控制器=视频控制器;
_添加(视频控制器);
});
}
等待vcontroller.play();
}
void\u pause()异步{
等待vcontroller.play();
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
主体:新容器(
子:列(
crossAxisAlignment:crossAxisAlignment.center,
mainAxisAlignment:mainAxisAlignment.spaceAround,
儿童:[
视频控制器!=null
?立柱(
儿童:
.map((p)=>墨水池(
onTap:(){},
孩子:填充(
填充:所有边缘设置(10.0),
子:容器(
高度:200.0,
宽度:200.0,
儿童:视频播放器(p)),
),
))
.toList(可增长:false),
)
:容器(
颜色:颜色,红色,
),
_录制视频(上下文),
],
),
),
);
}
小部件\u录制视频(构建上下文){
返回行(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
图标按钮(
已按下:(){
_startVideoPlayer();
},
图标:图标(图标。播放箭头),
),
图标按钮(
已按下:(){
设置状态(){
视频控制器=空;
});
_视频();
},
图标:图标(图标。添加圆圈),
),
图标按钮(
已按下:(){
_暂停();
},
图标:图标(图标。停止),
),
],
);
}
}

有解决方案吗?没有,但我还没有尝试使用最新的颤振。它可能是在最新版本中,但不会发生。最新版本的问题相同:(哦,然后是坏消息。)(
class VideoScaling extends StatefulWidget {
  @override
  _VideoScalingState createState() => new _VideoScalingState();
}

class _VideoScalingState extends State<VideoScaling> {
  VideoPlayerController videoController;
  bool _isPlaying = false;
  var _videoPath;
  String _videoP;
  VoidCallback videoPlayerListener;
  List<VideoPlayerController> _listOfVideos = [];
  void _video() async {
    _videoPath =
        await ImagePicker.pickVideo(source: ImageSource.camera).then((p) {
      _videoP = p.path;
    });
    _startVideoPlayer();
  }

  VideoPlayerController vcontroller;
  Future<void> _startVideoPlayer() async {
    //  print('path video: ${_videoP}');
    vcontroller = new VideoPlayerController.file(new File(_videoP));
    videoPlayerListener = () {
      if (videoController != null && videoController.value.size != null) {
        // Refreshing the state to update video player with the correct ratio.
        if (mounted) setState(() {});
        videoController.removeListener(videoPlayerListener);
      }
    };
    vcontroller.addListener(videoPlayerListener);
    await vcontroller.setLooping(true);
    await vcontroller.initialize();
    await videoController?.dispose();
    if (mounted) {
      setState(() {
        videoController = vcontroller;
        _listOfVideos.add(videoController);
      });
    }
    await vcontroller.play();
  }

  void _pause() async {
   await vcontroller.play();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: new Container(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: <Widget>[
            videoController != null
                ? Column(
                    children: _listOfVideos
                        .map((p) => InkWell(
                              onTap: () {},
                              child: Padding(
                                padding: EdgeInsets.all(10.0),
                                child: Container(
                                    height: 200.0,
                                    width: 200.0,
                                    child: VideoPlayer(p)),
                              ),
                            ))
                        .toList(growable: false),
                  )
                : Container(
                    color: Colors.red,
                  ),
            _recordVideo(context),
          ],
        ),
      ),
    );
  }

  Widget _recordVideo(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        IconButton(
          onPressed: () {
            _startVideoPlayer();
          },
          icon: Icon(Icons.play_arrow),
        ),
        IconButton(
          onPressed: () {
            setState(() {
              videoController = null;
            });
            _video();
          },
          icon: Icon(Icons.add_circle),
        ),
        IconButton(
          onPressed: () {
            _pause();
          },
          icon: Icon(Icons.stop),
        ),
      ],
    );
  }
}