load method
This function loads and plays the specified video.
videoId
specifies the YouTube Video ID of the video to be played.
In the YouTube Data API, a video resource's id property specifies the ID.
startAt
& endAt
parameter accepts a Duration.
If specified, then the video will (start from the closest keyframe to the specified time / end at the specified time).
Implementation
void load(String videoId,
{Duration startAt = Duration.zero, Duration? endAt}) {
var loadParams = 'videoId:"$videoId",startSeconds:${startAt.inSeconds}';
if (endAt != null && endAt > startAt) {
loadParams += ',endSeconds:${endAt.inSeconds}';
}
_updateId(videoId);
if (_value.hasError) {
pause();
} else {
invokeJavascript('loadById({$loadParams})');
}
}