Skip to content
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

[BUG] First time calling play() from controller doesn't work and must be invoked twice. #940

Open
sidetraxaudio opened this issue Apr 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@sidetraxaudio
Copy link

Describe the bug
When using external controls, calling play() to the controller does not start the video. The first call results in the thumbnail screen being displayed with the large red play button. It needs to be invoked again to start playing. This is a bug.

To Reproduce

  • CREATE A CONTROLLER:
static const videoId = 'YvKOvyiAdAI';

final YoutubePlayerController ytController = YoutubePlayerController(
   initialVideoId: videoId,
   flags: const YoutubePlayerFlags(
     autoPlay: false,
     mute: false,
     showLiveFullscreenButton: false,
     useHybridComposition: false,
     hideControls: true,
     controlsVisibleAtStart: false,
     forceHD: false,
     enableCaption: false,
     disableDragSeek: true,
     hideThumbnail: true,
   ),
 );
  • INVOKE PLAY() METHOD ON CONTROLLER:
    ytController.play()

  • NOTES:
    Setting autoplay to true works as expected. Problem is evident when autoplay is set to false;

  • This does NOT work:

ytController.play();
ytController.play();
  • This DOES work but still results in thumbnail display before playing (bug)
ytController.play();
Future.delayed(const Duration(seconds: 2)).then((_) => ytController.play());
};

Expected behavior
Expect to set autoplay to false and when .play() invoked on controller the video will start immediately, not cue thumbnail and then requiring pressing play again.

Technical Details:

  • Android 11 dev phone, but happens in emulator also.
@sidetraxaudio sidetraxaudio added the bug Something isn't working label Apr 24, 2024
@sidetraxaudio sidetraxaudio changed the title [BUG] First time calling play() with doesn't work and must be invoked twice. [BUG] First time calling play() from controller doesn't work and must be invoked twice. Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants