-
Notifications
You must be signed in to change notification settings - Fork 822
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
Video Player Hangs at UNKNOWN State #24
Comments
Same issue here.. after updating from 1.1.1+1 to 2.0.0 the player will be stuck when I change the videoId. |
I poked around a bit, and it seems there is a problem with the WebViewController not getting set for the YoutubePlayerController and also an issue with not waiting for the player to be ready before playing/queueing the video. I moved a few lines around in youtube_player.dart and it seems to be working now. in _Player Build(): onPageFinished: (_) {
if (widget.controller.value.isFullScreen) {
widget.controller._currentWebController = _temp;
} else {
widget.controller.value.webViewController.complete(_temp);
//ADDED THIS /////////////////
widget.controller.value.webViewController.future.then( (controller) {
widget.controller._currentWebController = controller;
});
//////////////////////////////////
}
if (widget.forceHideAnnotation)
widget.controller.forceHideAnnotation();
if (widget.mute) widget.controller.mute();
}, Also in _Player Build(), move the load/cue into the 'Ready' callback: JavascriptChannel(
name: 'Ready',
onMessageReceived: (JavascriptMessage message) {
widget.controller.value = widget.controller.value.copyWith(isReady: true);
//ADDED THIS /////////////////
widget.autoPlay
? widget.controller.load()
: widget.controller.cue();
//////////////////////////////////
},
), @Y-ndm I don't think this helps much with your problem. It seems to be similar (YoutubePlayerController not getting updated). By changing the things above and adding the following at the top of _Player Build() you can get the video to play. Still looks like there are some issues though... if (_temp != null && widget.controller._currentWebController == null) {
widget.controller._currentWebController = _temp;
} |
Checkout beta v3.0.0-beta.4. |
Thanks! That fixes the webViewController problem, but there is still an issue if it gets to the loading/queueing portion of the code before the player is ready. If I move the following up into the 'Ready' JavascriptChannel it works fine. widget.autoPlay
? widget.controller.load()
: widget.controller.cue(); |
@DakotaSamuel, will test by moving it to Ready. |
* Faster fullscreen toggling. * Toggles fullscreen on orientation change. [Issue #3](#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](#24). * Added `hideThumbnail` and `disableDragSeek` flags. [#27](#27), [#29](#29). * **FIXED** Fullscreen toggle in iOS. * Minor UI improvements here and there.
* Faster fullscreen toggling. * Toggles fullscreen on orientation change. [Issue #3](#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](#24). * Added `hideThumbnail` and `disableDragSeek` flags. [#27](#27), [#29](#29). * **FIXED** Fullscreen toggle in iOS. * Minor UI improvements here and there.
* Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24).
* Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24).
* Faster fullscreen toggling. * Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24). * Added `hideThumbnail` and `disableDragSeek` flags. [#27](sarbagyastha/youtube_player_flutter#27), [#29](sarbagyastha/youtube_player_flutter#29). * **FIXED** Fullscreen toggle in iOS. * Minor UI improvements here and there.
* Faster fullscreen toggling. * Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24). * Added `hideThumbnail` and `disableDragSeek` flags. [#27](sarbagyastha/youtube_player_flutter#27), [#29](sarbagyastha/youtube_player_flutter#29). * **FIXED** Fullscreen toggle in iOS. * Minor UI improvements here and there.
* Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24).
* Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24).
* Faster fullscreen toggling. * Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24). * Added `hideThumbnail` and `disableDragSeek` flags. [#27](sarbagyastha/youtube_player_flutter#27), [#29](sarbagyastha/youtube_player_flutter#29). * **FIXED** Fullscreen toggle in iOS. * Minor UI improvements here and there.
* Faster fullscreen toggling. * Toggles fullscreen on orientation change. [Issue #3](sarbagyastha/youtube_player_flutter#3). * Option to add own custom thumbnail. * **FIXED** Video stuck at unknown state [Issue #24](sarbagyastha/youtube_player_flutter#24). * Added `hideThumbnail` and `disableDragSeek` flags. [#27](sarbagyastha/youtube_player_flutter#27), [#29](sarbagyastha/youtube_player_flutter#29). * **FIXED** Fullscreen toggle in iOS. * Minor UI improvements here and there.
originally thought this was related to issue #17, but I am using version 2.0.0 and am still having this problem.
It seems that videos will randomly fail to load. The video player will never reach the QUED state. It just stays at the UNKNOWN state.
The screenshot below from the demo app modified to display the player state shows this.
When I tap on the video, it shows the controls but pressing play does nothing.
Devices I've tested with:
The text was updated successfully, but these errors were encountered: