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

Youtube player loop is not working #639

Closed
georgesofianosgr opened this issue May 7, 2019 · 1 comment
Closed

Youtube player loop is not working #639

georgesofianosgr opened this issue May 7, 2019 · 1 comment

Comments

@georgesofianosgr
Copy link

Youtube player loop is not working.

Console error:

YouTube.js:162 Uncaught (in promise) TypeError: _this2.player.setLoop is not a function

It was working for a while,
the issue may or may have not started when I upgraded my project packages.

My temporary fix is to remove the loop property and setLoop via internal player.

onReady={() => player.current.getInternalPlayer().setLoop(true)}

MacOS mojave
Nodejs v10.15.3
React v16.8.4 & Gatsby v2.3.25

Current code:

        <YouTubePlayer
          style={{ opacity: loaded ? 1 : 0 }}
          ref={player}
          width="100%"
          height="100%"
          url="https://www.youtube.com/watch?v=IDremoved'"
          controls={false}
          muted
          playing
          onStart={onStart}
          onReady={() => player.current.getInternalPlayer().setLoop(true)}
          config={{
            youtube: {
              playerVars: {
                wmode: 'transparent',
                modestbranding: 1,
                iv_load_policy: 3,
                start: 33,
                playlist: 'IDremoved',
              },
            },
          }}
        />
@georgesofianosgr georgesofianosgr changed the title Youtube player's loop is not working Youtube player loop is not working May 7, 2019
@matiasironyard
Copy link

@GeoCool Line 161 of the YouTube.js file in the players folder needs to be changed to be wrapped in if (isReady) {...loop code}. This fixes the issue. Also, change the onReady back to loop={true}.

albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants