vimeo/player.js

`player.loadVideo()` sometimes freezes the video playback

obber opened this issue · 8 comments

Expected Behavior

I expect player.loadVideo(ID) to play ID without issue once it's loaded.

Actual Behavior

Video ID will begin playing but freeze in the middle of playback.

Steps to Reproduce

I've recorded a loom of me reproducing this with a bit more context here: https://www.loom.com/share/e13b15c651d549e884d7c41db83c305f

  1. Clone this minimal reproduction repository: https://github.com/obber/vimeo-playback-issue-sandbox
  2. CD to the root directory of the repo.
  3. Run npm i
  4. Run npm start
  5. Navigate videos using the forwards / back button (in no particular pattern, at least that I've observed)
  6. Observe that the video will freeze sometimes for some videos.

Thanks for investigating! Any direction or guidance would be really appreciated :)

I am experiencing the same issue.

We have a set of 5 videos. Intermittently, one of the videos will load and not start streaming any data.

Edit:

The issue with .loadVideo() seems to be related to the background & autoplay options. If you leave the controls visible, you will see the video loads ahead but does not play.

A crude fix to this for the time being:

player
    .loadVideo({video_options})
    .then(
        setTimeout(() => {
            player.play();
        }, 1000)
    )
    .catch((error) => {
        console.error(error);
    });

I have a similar issue that might be related to loadVideo function.
I also have a set of videos.

The problem on my website is as follows: after switching between videos and clicking the back button in the browser, I always get:

  • Hey There! To play your video here, change its privacy settings so it can be embedded on: player.vimeo.com
    or
  • Sorry Because of its privacy settings, this video cannot be played here.

image
image

You can also see that type of error on the video that is provided in the issue description as well.
If you try to replicate it with the code provided in the issue, you can see that after the error appears, the player also doesn't load any other video by clicking next or previous buttons.
cannot play gif

Also, I see this library error in the console (I haven't seen this error last week, seems to be new one):

image

image

I tried to add "player.vimeo.com" to allowed domains and the privacy errors disappears, but hitting the browser's back button still blocks loading any different video on the website.
The behavior is as follows:

  1. click the back button
  2. click any other video from a list of videos
  3. the player doesn't load a different video, plays the same one

Some of my thoughts:

  • adding the "player.vimeo.com" domain to allowed domains is not necessary since it worked fine before without adding it (and we do not want to set it globally)
  • the suspect is loadVideo function

Our project uses the latest version of the library @vimeo/player": "2.23.0".

One more comment that might be useful in the investigation - here is a healthy request example when there is no problem with loading a video:

image

and here is a request when the privacy error happens:

image

You can see that Content-Security-Policy part is different.

Hey all - thanks for reporting these issues and your patience in awaiting a response.

@obber @KevinWilson-Linney - Thanks for providing a screen recording and a demo environment. Unfortunately, though, I'm not able to reproduce the issue in which playback freezes partway through the video. Is this issue still occurring for you? If it is, can you contact support on vimeo.com? This would be an issue with the underlying player, not the Player.js library.

@kaeruB - I think the issue you're encountering, in which you see a privacy error upon hitting the back button, is different than the OP's. The reason why you encounter a privacy error in his example is because one of his videos has a domain restriction, so it's being correctly blocked. That being said, I believe your issue matches an existing issue that has been reported, so I'm going to leave this thread open for further discussion. Can you share an example page where your issue can be reproduced?

@rkrishnan8594 I believe this is still happening and I could replicate it with 2 of my colleagues at the time. What seems to happen is player.loadVideo() will load the video but sometimes it just does not auto-play. This issue only exists with auto-play as if you present the controls the user will manually be pressing play.

I see. This sometimes occurs when the browser auto-pauses playback if the player is not muted. Can you please share a link where this issue can be reproduced?