-
Notifications
You must be signed in to change notification settings - Fork 232
Description
class ShortsPlayer extends StatefulWidget {
final int index;
final String videoId;
const ShortsPlayer({super.key, required this.index, required this.videoId});
@OverRide
State createState() => _ShortsPlayerState();
}
class _ShortsPlayerState extends State {
late final PodPlayerController controller;
@OverRide
void initState() {
_loadVideo();
super.initState();
}
@OverRide
void dispose() {
super.dispose();
controller.dispose();
}
void _loadVideo() async {
controller = PodPlayerController(
playVideoFrom: PlayVideoFrom.youtube(widget.videoId),
podPlayerConfig: const PodPlayerConfig(
videoQualityPriority: [360],
),
)..initialise();
}
@OverRide
Widget build(BuildContext context) {
final ytController = Get.find();
return PodVideoPlayer(
overlayBuilder: (options) {
return SizedBox();
},
matchFrameAspectRatioToVideo: true,
matchVideoAspectRatioToFrame: true,
podProgressBarConfig: PodProgressBarConfig(
bufferedBarColor: Colors.transparent,
playingBarColor: Colors.transparent,
backgroundColor: Colors.transparent,
circleHandlerColor: Colors.transparent,
),
controller: controller);
}
}
Here im loading this inside a pageview builder but all videos are playing simultanously