question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

loadVideo providing vimeo url in options object doesn't work

See original GitHub issue

Expected Behavior

I should be able to load a video on a player’s instance by calling loadVideo passing in an options object with the vimeo url.

Actual Behavior

Player’s loadVideo doesn’t work if you provide an options object with the url property as parameter, it only works with the vimeo id.

Steps to Reproduce

Here’s a code example: https://jsbin.com/sumajacefo/edit?html,console,output

When loading the page I instantiate the player using an options object with the url. If I then try to load a different video using loadVideo with an options object as well, it doesn’t work. According to the repo’s README loadVideo should accept both an options object or a number, but I can only get it to work with the vimeo id.

Parsing the vimeo url in order to obtain the id is not an option for me, because I need to load unlisted and/or private vimeos.

Any workarounds? Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakubkrolikowskicommented, Sep 30, 2021

I think the bug is back or similar. My video is private, this is the link:

https://vimeo.com/616885681/79bcd7654f

Can be embedded “anywhere”.

This:

player.loadVideo('https://player.vimeo.com/video/616885681?autoplay=1')

or:

loadVideo('https://vimeo.com/616885681/79bcd7654f?autoplay=1')

or

loadVideo('https://vimeo.com/616885681?autoplay=1')

creates request:

https://player.vimeo.com/video/616885681/config?h=1b82718d37&title=0&byline=0&portrait=0&autoplay=1&app_id=122963&referrer=https%3A%2F%2Fwww.piecsmakow.pl%2F

with the response 404 and body:

{"message": "This video does not exist.", "title": "Sorry", "view": 7}

1reaction
luwescommented, Feb 20, 2019

sorry about that @davekiss, I didn’t add the domain player.vimeo.com to the whitelist of that video yet. not it works again.

I’m closing this issue as it’s resolved. It’s possible now to load the next video with

player.loadVideo('https://player.vimeo.com/video/293438045?autoplay=1')

or

player.loadVideo({
	url: 'https://player.vimeo.com/video/293438045',
	autoplay: 1
});

The unlisted hash is indeed not required for the loadVideo call.

At the moment it is required in the Vimeo.Player constructor because we retrieve the embed code via our oEmbed api. If you prefer not to publish your private link with the unlisted hash in your source code, it’s recommended to embed the Vimeo player directly with an iframe instead. This will just work granted the referrer matches the whitelisted domain.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Vimeo's JS API: player.loadVideo() method resets ...
This might work! I hope this method doesn't instantiate a whole bunch of new JS objects and make bulky network calls each time....
Read more >
Player SDK: Reference - Vimeo Developer
This reference guide provides comprehensive details about the methods and events for controlling an embedded Vimeo player through the player SDK.
Read more >
vimeo/player/README.md - UNPKG
`data-vimeo-url` attribute in order for the embed to be created automatically. 83, You can also add attributes for any of the [embed options](#embed-options) ......
Read more >
@vimeo/player - npm
The options object should consist of either an id or url and any other embed options for the ... Note that this won't...
Read more >
End of Video Events with Vimeo - Adobe eLearning Community
loadVideo (THE ID NUMBER OF YOUR VIDEO HERE);. You can find the video ID number will be somewhere on the Vimeo website or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found