Skip to content

Youtube Shorts in PageView Builder all videos are playing simultaniously #258

@Amodh2022

Description

@Amodh2022

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions