'Embedded Vimeo (iframe) fullscreen not working in chrome

I'm trying to embed vimeo videos as iframes. I'm using the following code:

<iframe width="1140" height="570" src="https://player.vimeo.com/video/553469759?autoplay=1&dnt=1" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>

It works fine when I paste it in a codepen or try it in firefox. It doesn't work in chrome for me though. When I inspect the iframe's HTML, I can see that vimeo adds a class no-fullscreen-support, it also added these classes though:

  • js-player-fullscreen
  • with-fullscreen


Solution 1:[1]

Figured it out on my end. It was due to the Permissions-Policy being set by Nginx in the header. In my instance of Nginx, it was originally set to this:

add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()";

The culprit in this case was fullscreen=(self) -- it was telling Chrome that unless the code originated from the site, it shouldn't allow full screen. As Vimeo's iframe is being loaded from player.vimeo.com, Chrome saw that as a third party and wouldn't allow it. Removing that from the Permissions-Policy so it looked like this:

add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),payment=()";

Resolved the problem. The button is showing fine now.

For those using Apache, it'd probably look like this:

Header always set Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()"

The same principle applies, just remove fullscreen=(self).

You might also see it mentioned as Feature Policy, same thing, it's just called Permissions Policy now.

You can learn more about Permissions Policy here: https://github.com/w3c/webappsec-permissions-policy/blob/main/permissions-policy-explainer.md

Solution 2:[2]

From Vimeo Help Center:

The fullscreen button will be hidden from the player in scenarios where fullscreen mode cannot be activated. Here are some common causes:

  • First and foremost, check the Embed tab. Make sure the fullscreen button is toggled on under the Controls section
  • The iframe embed code is missing the fullscreen attributes: "mozallowfullscreen,""webkitallowfullscreen," and "allowfullscreen." If you’re pasting your embed code into another application, make sure these values are being retained.
  • The player iframe is contained within another iframe that is missing the fullscreen attributes. Browsers do not allow iframes to enter fullscreen if they are contained within other iframes without these fullscreen attributes. - Try inserting the player outside of the container iframe or adding "mozallowfullscreen," "webkitallowfullscreen," and "allowfullscreen" to the container iframe.
  • The iframe is contained within a frame. Frame elements cannot enter fullscreen, and neither can any iframes inside of them. We recommend removing all frame tags from your page’s source code.

If you're not sure if the above cases apply, please contact us, and we’ll investigate further. Be sure to include a link to the page where the video is embedded, so we can take a closer look at your page's source code.

Solution 3:[3]

You should add these tags to the element:

webkitallowfullscreen mozallowfullscreen allowfullscreen

Solution 4:[4]

what if you just download the video and upload it somewhere like github? And then use the tag to embed the video?

<video src="protocol://someurl.domain/path" muted autoplay width="1140" height="570"></video>

If vimeo doesn't allow downloading you can always use third-party tools like savethevideo.com

Solution 5:[5]

Managed to find an answer myself, you can add the error code in the EnableRetryOnFailure

services.AddDbContext<DatabaseContext>(
    opt => opt.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"),
        (options) =>
        {
            options.EnableRetryOnFailure(10, TimeSpan.FromSeconds(30), new string[] { "57P01" });
        })
);

Now the only question that remains is if that is a good idea or not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Fiodorov Andrei
Solution 3 Galaksi
Solution 4 Shiven Dhir
Solution 5 Lau