I am able to load the YouTube video but when I was trying to seek video from the progress bar like in progress bar, tap anywhere to seek the video then it will get stuck, and audio will be distorted.
@override
void initState() {
super.initState();
controller = PodPlayerController(
playVideoFrom: PlayVideoFrom.youtube('https://youtu.be/TBTgQbjRsqg'),
)..initialise().then((value) {
setState(() {
isVideoPlaying = controller.isVideoPlaying;
});
});
controller.addListener(_listner);
}
void _listner() {
if (controller.isVideoPlaying != isVideoPlaying) {
isVideoPlaying = controller.isVideoPlaying;
}
if (mounted) setState(() {});
}
@override
void dispose() {
controller.removeListener(_listner);
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Custom Player')),
body: PodVideoPlayer(
alwaysShowProgressBar: alwaysShowProgressBar,
controller: controller,
matchFrameAspectRatioToVideo: true,
matchVideoAspectRatioToFrame: true,
videoTitle: videoTitle,
),
)
);
}