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 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

你可能感兴趣的:(Flutter)