You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.1 KiB
80 lines
2.1 KiB
3 years ago
|
// import 'package:flutter/material.dart';
|
||
|
// import 'package:video_player/video_player.dart';
|
||
|
|
||
|
// class VideoWidget extends StatefulWidget {
|
||
|
// final String url;
|
||
|
// final bool play;
|
||
|
|
||
|
// const VideoWidget({Key key, @required this.url, @required this.play})
|
||
|
// : super(key: key);
|
||
|
// @override
|
||
|
// _VideoWidgetState createState() => _VideoWidgetState();
|
||
|
// }
|
||
|
|
||
|
// class _VideoWidgetState extends State<VideoWidget> {
|
||
|
// VideoPlayerController _controller;
|
||
|
// Future<void> _initializeVideoPlayerFuture;
|
||
|
|
||
|
// @override
|
||
|
// void initState() {
|
||
|
// super.initState();
|
||
|
// _controller = VideoPlayerController.network(widget.url);
|
||
|
// _controller.addListener(checkVideo);
|
||
|
// _initializeVideoPlayerFuture = _controller.initialize().then((_) {
|
||
|
// setState(() {});
|
||
|
// });
|
||
|
|
||
|
// if (widget.play) {
|
||
|
// _controller.play();
|
||
|
// _controller.setLooping(true);
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// void checkVideo() {
|
||
|
// // Implement your calls inside these conditions' bodies :
|
||
|
// if (_controller.value.position ==
|
||
|
// Duration(seconds: 0, minutes: 0, hours: 0)) {
|
||
|
// print('video Started');
|
||
|
// }
|
||
|
|
||
|
// if (_controller.value.position == _controller.value.duration) {
|
||
|
// print('video Ended');
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// @override
|
||
|
// void didUpdateWidget(VideoWidget oldWidget) {
|
||
|
// if (oldWidget.play != widget.play) {
|
||
|
// if (widget.play) {
|
||
|
// _controller.play();
|
||
|
// _controller.setLooping(true);
|
||
|
// } else {
|
||
|
// _controller.pause();
|
||
|
// }
|
||
|
// }
|
||
|
// super.didUpdateWidget(oldWidget);
|
||
|
// }
|
||
|
|
||
|
// @override
|
||
|
// void dispose() {
|
||
|
// _controller.dispose();
|
||
|
// super.dispose();
|
||
|
// }
|
||
|
|
||
|
// @override
|
||
|
// Widget build(BuildContext context) {
|
||
|
// return FutureBuilder(
|
||
|
// future: _initializeVideoPlayerFuture,
|
||
|
// builder: (context, snapshot) {
|
||
|
// if (snapshot.connectionState == ConnectionState.done) {
|
||
|
// return VideoPlayer(_controller);
|
||
|
// } else {
|
||
|
// return Center(
|
||
|
// child: CircularProgressIndicator(),
|
||
|
// );
|
||
|
// }
|
||
|
// },
|
||
|
// );
|
||
|
// }
|
||
|
// }
|