New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
video play all in list #35
Comments
Videos are not visible, but are rendered just like the one that is visible. To preload the videos and play only if given page is visible you'll have to modify your video-playing widget to load the video at init and listen to commands from the parent (eg. with a controller), and in the parent widget you'll have to listen to 'onPageChanged(int index)' callback to detect which video page is currently visible and notify proper video widget. This library doesn't know (or care) about the implementation details of the widgets you put to preload thus doesn't do anything special for not visible preloaded widgets. |
I am new in this field kindly explain with little code bcz i already
declare init method and with controller.
…On Tue, Jan 25, 2022, 5:35 PM Marcin Wróblewski ***@***.***> wrote:
Videos are not visible, but are rendered just like the one that is
visible. To preload the videos and play only if given page is visible
you'll have to modify your video-playing widget to load the video at init
and listen to commands from the parent (eg. with a controller), and in the
parent widget you'll have to listen to 'onPageChanged(int index)' callback
to detect which video page is currently visible and notify proper video
widget.
This library doesn't know (or care) about the implementation details of
the widgets you put to preload thus doesn't do anything special for not
visible preloaded widgets.
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIR3KTBVMUMRQBCTEN3FRDUX2KIJANCNFSM5MXYXMLA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You didn't provide the whole code, so now I can only hint you:
final controllers = List<BetterPlayerListVideoPlayerController>.generate(data.length, (_) => BetterPlayerListVideoPlayerController());
PreloadPageView.builder(
onPageChanged: (index) {
controllers.forEach((controller) => controller.pause());
controllers[index].play();
}
... |
BetterPlayerConfiguration? betterPlayerConfiguration;
BetterPlayerListVideoPlayerController? controller;
@OverRide
void initState() {
// TODO: implement initState
super.initState();
isLoading = true;
controller = BetterPlayerListVideoPlayerController();
betterPlayerConfiguration = BetterPlayerConfiguration();
}
Here is initialization others i already shared it. I didn't create list bcz
it's docx says that it is created only one time
…On Tue, Jan 25, 2022, 6:30 PM Marcin Wróblewski ***@***.***> wrote:
You didn't provide the whole code, so now I can only hint you:
1. Disable auto play with autoPlay: false.
2. You are giving the same controller to every page. I can't see where
you do its initialisation, but every page should have it's own controller.
If I presume correctly, you can generate a
BetterPlayerListVideoPlayerController like that:
final controllers = List<BetterPlayerListVideoPlayerController>.generate(data.length, (_) => BetterPlayerListVideoPlayerController());
1. Assign each generated controller to proper
BetterPlayerListVideoPlayer, so instead betterPlayerListVideoPlayerController:
controller, do betterPlayerListVideoPlayerController:
controllers[index].
2. Play selected video and stop other ones to make sure you only play
one at time:
PreloadPageView.builder(
onPageChanged: (index) {
controllers.forEach((controller) => controller.pause());
controllers[index].play();
}
...
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHIR3KTYEUJ2XUA3W2GD2PTUX2QZHANCNFSM5MXYXMLA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@wrbl606 i tried your solution it almost works fine but i want that first index video of initialpage video also auto play bcz on page changed video played but first index video not played or first page video not played |
Hi, i am using this package with a better player which I initialize the controller then it plays all video which I set as a preload is playing even it did not visible on-screen even class close but still playing on the background before this package it did not any issue. kindly look into this matter here is my code: in which background some random music playing i even did not add or previous video audio also playing
The text was updated successfully, but these errors were encountered: