cue method

void cue(
  1. String videoId, {
  2. Duration startAt = Duration.zero,
  3. Duration? endAt,
})

This function loads the specified video's thumbnail and prepares the player to play the video. The player does not request the FLV until YoutubePlayerController.play or YoutubePlayerController.seekTo is called.

videoId parameter 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 cue(String videoId,
    {Duration startAt = Duration.zero, Duration? endAt}) {
  var cueParams = 'videoId:"$videoId",startSeconds:${startAt.inSeconds}';
  if (endAt != null && endAt > startAt) {
    cueParams += ',endSeconds:${endAt.inSeconds}';
  }
  _updateId(videoId);
  if (_value.hasError) {
    pause();
  } else {
    invokeJavascript('cueById({$cueParams})');
  }
}