vimeo / player.js

Interact with and control an embedded Vimeo Player.
https://player.vimeo.com/api/demo
MIT License
1.44k stars 262 forks source link

Our pages are suffering from low Lighthouse scores because the Vimeo player uses WebXR #954

Open statico opened 1 year ago

statico commented 1 year ago

Expected Behavior

Lighthouse scores should not penalize us for embedding the Vimeo player using the @vimeo/player library:

        player = new Player(`video-container-${videoId}`, {
          id: videoId,
          width: playerDimensions?.contentBox.width,
          height: playerDimensions?.contentBox.height,
        })

Actual Behavior

Running a Lighthouse performance test in Chrome complains about the Vimeo player:

Page prevented back/forward cache restoration Pages that use WebXR are not currently eligible for back/forward cache. The page has an unload handler in a sub frame.

CleanShot 2023-10-19 at 13 05 34

Steps to Reproduce

  1. Visit https://vvqmnx.csb.app/ (Source: https://codesandbox.io/s/vimeo-player-lighthouse-test-vvqmnx?file=/src/index.html)
  2. Open Chrome dev tools -> Lighthouse -> "Analyze page load"
  3. See error
rkrishnan8594 commented 1 year ago

Hi @statico - I'm not able to run Lighthouse on the page provided (it's reporting an error), and when I run it on a raw player embed URL, I'm not seeing that specific issue. Is there anything different I need to do to reproduce?

statico commented 1 year ago

@rkrishnan8594 Oops, here's an updated URL: https://statico-misc.s3.amazonaws.com/repro/vimeo-player.html

CleanShot 2023-10-20 at 09 57 03

rkrishnan8594 commented 1 year ago

Interesting. I'm now seeing that result when running Lighthouse in Chrome's developer tools:

Screenshot 2023-10-23 at 11 54 54 AM

But I'm seeing different results when running Lighthouse via Chrome extension (top) and PageSpeed Insights (bottom):

Screenshot 2023-10-23 at 11 53 22 AM Screenshot 2023-10-23 at 11 59 59 AM

Not sure why there are those discrepancies, and I'm not sure what specifically is causing that diagnostic for one of the reports. We include WebVR support in the player, so perhaps something in that code is triggering this. I'll file an internal ticket for us to explore dynamically loading said code when needed, but for now, this will be a low priority because of the lack of clarity surrounding the issue and the still good performance scores (99-100 despite this issue).