90 lines
2.5 KiB
Dart
90 lines
2.5 KiB
Dart
// import 'package:flutter/material.dart';
|
|
// import 'package:flutter_youtube_view/flutter_youtube_view.dart';
|
|
|
|
// class YoutubeDefaultWidget extends StatefulWidget {
|
|
// final String id;
|
|
// YoutubeDefaultWidget({this.id});
|
|
// @override
|
|
// _MyAppState createState() => _MyAppState();
|
|
// }
|
|
|
|
// class _MyAppState extends State<YoutubeDefaultWidget>
|
|
// implements YouTubePlayerListener {
|
|
// //double _currentVideoSecond = 0.0;
|
|
// //String _playerState = "";
|
|
// //FlutterYoutubeViewController _controller;
|
|
|
|
// @override
|
|
// void onCurrentSecond(double second) {
|
|
// // print("onCurrentSecond second = $second");
|
|
// // _currentVideoSecond = second;
|
|
// }
|
|
|
|
// @override
|
|
// void onError(String error) {
|
|
// print("onError error = $error");
|
|
// }
|
|
|
|
// @override
|
|
// void onReady() {
|
|
// print("onReady");
|
|
// }
|
|
|
|
// @override
|
|
// void onStateChange(String state) {
|
|
// // print("onStateChange state = $state");
|
|
// // setState(() {
|
|
// // _playerState = state;
|
|
// // });
|
|
// }
|
|
|
|
// @override
|
|
// void onVideoDuration(double duration) {
|
|
// print("onVideoDuration duration = $duration");
|
|
// }
|
|
|
|
// void _onYoutubeCreated(FlutterYoutubeViewController controller) {
|
|
// //this._controller = controller;
|
|
// }
|
|
|
|
// // void _loadOrCueVideo() {
|
|
// // _controller.loadOrCueVideo('gcj2RUWQZ60', _currentVideoSecond);
|
|
// // }
|
|
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return Scaffold(
|
|
// appBar: AppBar(),
|
|
// body: Stack(
|
|
// children: <Widget>[
|
|
// AspectRatio(
|
|
// aspectRatio: 16/9,
|
|
// child: FlutterYoutubeView(
|
|
// onViewCreated: _onYoutubeCreated,
|
|
// listener: this,
|
|
// params: YoutubeParam(
|
|
// videoId: widget.id,
|
|
// showUI: true,
|
|
// //startSeconds: 5 * 60.0,
|
|
// autoPlay: true,
|
|
// showYoutube: false,
|
|
// showFullScreen: true,
|
|
// ),
|
|
// )),
|
|
// // Center(
|
|
// // child: Column(
|
|
// // children: <Widget>[
|
|
// // Text(
|
|
// // 'Current state: $_playerState',
|
|
// // style: TextStyle(color: Colors.blue),
|
|
// // ),
|
|
// // RaisedButton(
|
|
// // onPressed: _loadOrCueVideo,
|
|
// // child: Text('Click reload video'),
|
|
// // ),
|
|
// // ],
|
|
// // ))
|
|
// ],
|
|
// ));
|
|
// }
|
|
// } |