YoutubePlayerController.fromVideoId constructor
YoutubePlayerController.fromVideoId({
- required String videoId,
- YoutubePlayerParams params = const YoutubePlayerParams(),
- bool autoPlay = false,
- double? startSeconds,
- double? endSeconds,
Creates a YoutubePlayerController and initializes the player with videoId
.
Implementation
factory YoutubePlayerController.fromVideoId({
required String videoId,
YoutubePlayerParams params = const YoutubePlayerParams(),
bool autoPlay = false,
double? startSeconds,
double? endSeconds,
}) {
final controller = YoutubePlayerController(params: params);
if (autoPlay) {
controller.loadVideoById(
videoId: videoId,
startSeconds: startSeconds,
endSeconds: endSeconds,
);
} else {
controller.cueVideoById(
videoId: videoId,
startSeconds: startSeconds,
endSeconds: endSeconds,
);
}
return controller;
}