Plyr: Plyr does not initialize Vimeo videos whose IDs are fewer than 8 digits.

Created on 7 May 2018  路  2Comments  路  Source: sampotts/plyr

Expected behaviour

GIVEN a Vimeo video whose ID is fewer than 8 digits
WHEN I attempt to initialize the Plyr player on the iframe embed of that video
THEN the Plyr player should successfully initialize.

Actual behaviour

GIVEN a Vimeo video whose ID is fewer than 8 digits
WHEN I attempt to initialize the Plyr player on the iframe embed of that video
THEN the initialization fails with a Setup failed: Invalid provider error.

Environment

  • Browser: Chrome
  • Version: 66.0.3359.139
  • Operating System: macOS High Sierra
  • Version: 10.13.4

Steps to reproduce

<div class="plyr__video-embed">
    <iframe src="https://player.vimeo.com/video/8733915" allowfullscreen="" allowtransparency="true"></iframe>
</div>
  • Attempt to initialize Plyr, using a reference to the <div> containing the embed (e.g. new Plyr(document.querySelector('.plyr__video-embed'), { debug: true }))
  • You should see the error.

I'm pretty sure the issue is right here: https://github.com/sampotts/plyr/blob/master/src/js/utils.js#L726

Plyr assumes that all Vimeo video IDs are at least 8 digits, whereas I have an example where the ID is 7 digits.

Note that I was able to temporarily hack around this by left padding the ID in the URL with zeros, e.g. if I change the URL to https://player.vimeo.com/video/08733915 then Plyr initializes correctly and the video still works.

Bug

Most helpful comment

This should be resolved in v3.3.6 馃憤

All 2 comments

This is an easy fix - just need to tweak the regex. Will get it sorted today.

This should be resolved in v3.3.6 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sparkktv picture sparkktv  路  4Comments

Generalomosco picture Generalomosco  路  3Comments

Antonio-Laguna picture Antonio-Laguna  路  3Comments

ahmadshc picture ahmadshc  路  3Comments

frumbert picture frumbert  路  3Comments