chudongvip / awesome_video_player

This is a flutter package of video player. it's a very simple and easy to use.
MIT License
196 stars 36 forks source link

设置禁止进度条拖拽,但是播放的时候还是能拖拽 #28

Closed bhjSky closed 4 years ago

bhjSky commented 4 years ago

这个是界面代码: return Scaffold( backgroundColor: AppColors.videoBackground, body: Container( alignment: Alignment.center, child: AwsomeVideoPlayer( state.item.videoUrl, playOptions: VideoPlayOptions( seekSeconds: 30, //左侧垂直手势调节视频亮度的单位(0~1之间,不能小于0,不能大于1) brightnessGestureUnit: 0.05, //右侧垂直手势调节视频音量的单位(0~1之间,不能小于0,不能大于1) volumeGestureUnit: 0.05, //横行手势调节视频进度的单位秒数 progressGestureUnit: 0, allowScrubbing:false, loop: false, autoplay: true, startPosition: Duration(seconds: state.item.learnTime)), /// 自定义视频样式 videoStyle: VideoStyle(/// 自定义顶部控制栏 videoTopBarStyle: VideoTopBarStyle( height: 40, show: true, //是否显示 padding: EdgeInsets.symmetric(vertical: 8, horizontal: 10), popIcon: Icon( Icons.arrow_back_ios, size: 16, color: Colors.white, ), contents: [ Center( child: Container( padding: EdgeInsets.only(bottom: 4,left: 5), child: Text( state.item.name, style: whiteTextStyle() ), ), ) ], //自定义顶部控制栏中间显示区域 ),// 部控制栏右侧显示区域

      /// 自定义视频暂停时视频中部的播放按钮
      playIcon: Icon(
        Icons.play_circle_outline,
        size: 100,
        color: Colors.white,
      ),
      /// 暂停时是否显示视频中部播放按钮
      showPlayIcon: true,
      /// 自定义底部控制栏
      videoControlBarStyle: VideoControlBarStyle(
        /// 更改进度栏的播放按钮
        playIcon: Icon(
            Icons.play_arrow,
            color: Colors.white,
            size: 20
        ),
        /// 更改进度栏的暂停按钮
        pauseIcon: Icon(
          Icons.pause,
          color: Colors.red,
          size: 20,
        ),
        /// 更改进度栏的全屏按钮
        fullscreenIcon: Icon(
          Icons.fullscreen,
          size: 20,
          color: Colors.white,
        ),
        /// 更改进度栏的退出全屏按钮
        fullscreenExitIcon: Icon(
          Icons.fullscreen_exit,
          size: 20,
          color: Colors.red,
        ),
        /// 决定控制栏的元素以及排序,示例见上方图3
        itemList: [
          "play",
          "position-time", //当前播放时间
          "progress",//线形进度条

//"basic-progress",//矩形进度条 "duration-time", //视频总时长 // "time", //格式:当前时间/视频总时长 "fullscreen" ], ),

      videoLoadingStyle: VideoLoadingStyle(
        /// 重写部分(二选一)
        // 重写Loading的widget
        // customLoadingIcon: CircularProgressIndicator(strokeWidth: 2.0),
        // 重写Loading 下方的Text widget
        // customLoadingText: Text("加载中..."),
        /// 设置部分(二选一)
        // 设置Loading icon 下方的文字
        loadingText: "正在加载...",
        // 设置loading icon 下方的文字颜色
        loadingTextFontColor: Colors.white,
        // 设置loading icon 下方的文字大小
        loadingTextFontSize: 20,
      ),
    ),

    /// 视频初始化完成回调
    oninit: (controller) {
      dispatch(VideoDetailsActionCreator.initController(controller));
    },
    /// 视频播放进度回调
    ontimeupdate: (value) {
      dispatch(VideoDetailsActionCreator.recordPlayTime(value.position.inMilliseconds / 1000));
    },
    /// 顶部控制栏点击返回按钮
    onpop: (value) {
      dispatch(VideoDetailsActionCreator.onBackClick());
    },
  ),
),

); } 视频格式 m3u8