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

Video Player Hangs at UNKNOWN State #24

Closed
ghost opened this issue Jun 6, 2019 · 5 comments
Closed

Video Player Hangs at UNKNOWN State #24

ghost opened this issue Jun 6, 2019 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Jun 6, 2019

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.

scrnshot1

When I tap on the video, it shows the controls but pressing play does nothing.

scrnshot2

Devices I've tested with:

  • Samsung Galaxy S9: occurs about 15% of the time
  • Samsung Galaxy S6: occurs about 10% of the time
  • Simulated Nexus 10: occurs about 10% of the time
@Y-ndm
Copy link

Y-ndm commented Jun 6, 2019

Same issue here.. after updating from 1.1.1+1 to 2.0.0 the player will be stuck when I change the videoId.
Let me be clearer:
_First I have a String = "videoLink".. the video works as it is intended to be, but when I change the videoLink with a click of a button the Clip's Thumbnail shows up but the clip won't and the old clip keeps playing.. this is happening in both a real device and emulator. It seems like this issue show up only on 1.2.0 and above.
Thanks.

@ghost
Copy link
Author

ghost commented Jun 7, 2019

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;
    }

sarbagyastha added a commit that referenced this issue Jun 9, 2019
* Toggles fullscreen on orientation change. [Issue #3](#3).
* Option to add own custom thumbnail.
* **FIXED** Video stuck at unknown state [Issue #24](#24).
sarbagyastha added a commit that referenced this issue Jun 9, 2019
* Toggles fullscreen on orientation change. [Issue #3](#3).
* Option to add own custom thumbnail.
* **FIXED** Video stuck at unknown state [Issue #24](#24).
@sarbagyastha
Copy link
Owner

Checkout beta v3.0.0-beta.4.

@ghost
Copy link
Author

ghost commented Jun 10, 2019

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();

@sarbagyastha
Copy link
Owner

@DakotaSamuel, will test by moving it to Ready.

sarbagyastha added a commit that referenced this issue Jun 23, 2019
* 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.
sarbagyastha added a commit that referenced this issue Jun 23, 2019
* 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.
suzukidavid added a commit to suzukidavid/flutter_youtube_player that referenced this issue Feb 24, 2023
* 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).
suzukidavid added a commit to suzukidavid/flutter_youtube_player that referenced this issue Feb 24, 2023
* 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).
suzukidavid added a commit to suzukidavid/flutter_youtube_player that referenced this issue Feb 24, 2023
* 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.
suzukidavid added a commit to suzukidavid/flutter_youtube_player that referenced this issue Feb 24, 2023
* 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.
tommy725 added a commit to tommy725/flutter_youtube_player that referenced this issue Aug 9, 2023
* 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).
tommy725 added a commit to tommy725/flutter_youtube_player that referenced this issue Aug 9, 2023
* 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).
tommy725 added a commit to tommy725/flutter_youtube_player that referenced this issue Aug 9, 2023
* 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.
tommy725 added a commit to tommy725/flutter_youtube_player that referenced this issue Aug 9, 2023
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants