You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class VideoView extends StatefulWidget {
final String url;
final bool autoPlay;
final bool looping;
final double aspectRatio;
const VideoView({super.key, required this.url, this.autoPlay=false, this.looping=false, this.aspectRatio=16/9,});
@OverRide
State createState() => _VideoViewState();
}
class _VideoViewState extends State {
late VideoPlayerController _videoPlayerController;
late ChewieController _chewieController; @OverRide
initState() {
_videoPlayerController = VideoPlayerController.asset('assets/1.mp4');
initVideo();
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
autoPlay: widget.autoPlay,
looping: widget.looping,
aspectRatio: widget.aspectRatio
);
super.initState();
}
Future initVideo() async {
await _videoPlayerController.initialize();
}
import 'package:flutter/material.dart';
import 'package:chewie/chewie.dart';
import 'package:video_player/video_player.dart';
class VideoView extends StatefulWidget {
final String url;
final bool autoPlay;
final bool looping;
final double aspectRatio;
const VideoView({super.key, required this.url, this.autoPlay=false, this.looping=false, this.aspectRatio=16/9,});
@OverRide
State createState() => _VideoViewState();
}
class _VideoViewState extends State {
late VideoPlayerController _videoPlayerController;
late ChewieController _chewieController;
@OverRide
initState() {
_videoPlayerController = VideoPlayerController.asset('assets/1.mp4');
initVideo();
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
autoPlay: widget.autoPlay,
looping: widget.looping,
aspectRatio: widget.aspectRatio
);
super.initState();
}
Future initVideo() async {
await _videoPlayerController.initialize();
}
@OverRide
void dispose() {
_videoPlayerController.dispose();
_chewieController.dispose();
super.dispose();
}
@OverRide
Widget build(BuildContext context) {
double screenW = MediaQuery.of(context).size.width;
double screenH = MediaQuery.of(context).size.height;
return Container(
width: screenW,
height: screenH/2,
color: Colors.grey,
child: Chewie(
controller: _chewieController,
),
);
}
}
Does anyone have this problem? Please help me solve it. thank you.
The text was updated successfully, but these errors were encountered: