flutter 视频播放控件 Chewie video_play

依赖 

dependencies:    video_player: "0.7.2"
                 chewie: ^0.9.6

 

代码关系

import 'package:chewie/chewie.dart';
import 'package:flutter/cupertino.dart';
import 'package:video_player/video_player.dart';

final videoPlayerController = VideoPlayerController.network(
    'http://jzvd.nathen.cn/35b3dc97fbc240219961bd1fccc6400b/8d9b76ab5a584bce84a8afce012b72d3-5287d2089db37e62345123a1be272f8bxxxx.mp4');

final chewieController = ChewieController(
  videoPlayerController: videoPlayerController,
  aspectRatio: 1,
  autoPlay: true,
  looping: true,
);

final playerWidget = Chewie(
  controller: chewieController,
);


class VidoPlayChewie extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _VideoState();
  }


}
class _VideoState extends State{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return playerWidget;
  }
  @override
  void dispose() {
    videoPlayerController.dispose();
    chewieController.dispose();
    super.dispose();
  }
}

组件介绍 https://pub.dartlang.org/packages/chewie

发布了16 篇原创文章 · 获赞 5 · 访问量 3万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览