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

current showing 0:00 all the time #17

Closed
singh-saheb opened this issue May 17, 2019 · 8 comments
Closed

current showing 0:00 all the time #17

singh-saheb opened this issue May 17, 2019 · 8 comments
Labels

Comments

@singh-saheb
Copy link

the current duration does not gt update neither is the seekbar showing any update

@sarbagyastha
Copy link
Owner

which version are you on ?

@hadiisantoso
Copy link

I have this issue too,
currently I am using version : ^1.1.1+1

@ghost
Copy link

ghost commented May 24, 2019

Same here. Using 1.1.1+1. It doesn't happen on all videos. I would say ~30% of them. Video duration appears as 0:00 and pressing play does nothing.

Screenshot_20190524-142518

On Android, I was able to wait until the player was ready and then use controller.load() to get it to load. This does not work on IOS though. And the problem occurs on all videos.

I am using the player in a pop-up page that appears when the user presses a button.

Navigator.push(
      context,
      new MaterialPageRoute(builder: (context) {
        //create the page
        return new Scaffold(
          body: Container(
            color: Colors.black,
            alignment: Alignment.center,
            child: YoutubePlayer(
              context: context,
              videoId: YoutubePlayer.convertUrlToId(widget.movie.trailer),
              autoPlay: true,
              showVideoProgressIndicator: true,
              videoProgressIndicatorColor: Theme.of(context).primaryColor,
              progressColors: ProgressColors(
                playedColor: Theme.of(context).primaryColor,
                handleColor: Theme.of(context).primaryColor,
              ),
              onPlayerInitialized: (controller) async {
                //check if we need to reload video
                if(controller.value.duration.inSeconds == 0) {
                  print("Video not loaded.");
                  //wait for the video player to be ready
                  print("Waiting for ready...");
                  while (!controller.value.isReady) {
                    print("Not ready.");
                    //wait a bit before checking again
                    await Future.delayed(Duration(milliseconds: 500));
                  }
                  print("Player ready!");
                  //reload
                  print("Reloading...");
                  controller.load();
                }
              },
            ),
          ),
        );
      }),
    )

Edit:
Forgot to mention that when I try controller.load() on IOS it gives me the following exception:

Exception has occurred.
PlatformException (PlatformException(evaluateJavaScript_failed, Failed evaluating JavaScript, JavaScript string was: 'player.loadVideoById("A2FrrSyyKfA", 0)'
Error Domain=WKErrorDomain Code=2 "The Web Content process was terminated" UserInfo={NSLocalizedDescription=The Web Content process was terminated}))

@brubraz
Copy link

brubraz commented May 28, 2019

Same here

@tagerjump
Copy link

Same issue here. The process bar is not working for the same reason. The buffered part works just fine but the played part is always 0:00.

@tagerjump
Copy link

tagerjump commented Jun 1, 2019

I think I found the problem. The microseconds increase by 1000 for one second. But one second equals to 10^6 microseconds .
Screenshot_1559366470

sarbagyastha added a commit that referenced this issue Jun 3, 2019
sarbagyastha added a commit that referenced this issue Jun 3, 2019
@sarbagyastha
Copy link
Owner

The issue is fixed with Version 1.2.0.
It was a silly mistake btw. 😜

@tagerjump
Copy link

tagerjump commented Jun 4, 2019 via email

@vinodlee vinodlee mentioned this issue Aug 25, 2019
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

5 participants