Replies: 1 comment 1 reply
-
final controller = YoutubePlayerController();
YoutubePlayerScaffold(
controller: controller,
builder: (context, player) {
return NestedWidget();
}
),
NestedWidget{
initState() {
fetchIdFromRest.then((id) {
context.ytController.loadVideoById(videoId: id);
});
}
build(context) {
return Scaffold(
body: YoutubePlayer.of(context), // I'll add this in the next update.
);
}
}
@mark8044 Can you not do something like this ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Right now I have an outer
Scaffoldwith multiple levels of deeply nested widgets. Inside one of those deeply nested widgets (about 5-6 levels deep) is where myYoutubePlayerwidget sits. MyYoutubePlayerwidget is a stateful widget which dynamically gets itsvideoIdbased on RESTful data pulled from a remote source.With this new
YoutTubePlayerScaffoldmethod, I have to place it above the mainScaffoldand define the controller very early on. Then I have to usebuilderto pass aplayerparam down 5-6 levels of nesting. Then within the nested level I have to pass a Youtube video ID back up to the root, probably via some kind of state management system.This seems very very tedious. Is it possible to have the YoutubePlayerScaffold exist without the controller which can at least be controlled at the
YoutubePlayerwidget level?This part seemed to be working much better pre 3.x
Beta Was this translation helpful? Give feedback.
All reactions