player.js icon indicating copy to clipboard operation
player.js copied to clipboard

neither loadVideo() nor unload() resolving promises when player is created from existing iframe

Open BernsteinA opened this issue 10 years ago • 5 comments

Expected Behavior

.then() should fire, or .catch() if there's an error

Actual Behavior

video loads, but promise never resolves.

Steps to Reproduce

codepen link: http://codepen.io/anon/pen/jrabwY

<iframe id='player1' src="https://player.vimeo.com/video/76979871?api=1&player_id=player1"></iframe>

var player1 = new Vimeo.Player('player1'); // or $('iframe')[0]

player1.loadVideo(12345).then(function(id){
  // this never fires
  console.log('iframe player loaded: ', id);
}).catch(function(error){
  // and neither does this
  console.error(error);
});

BernsteinA avatar Oct 03 '16 16:10 BernsteinA

+1

gitdistill avatar Oct 07 '16 21:10 gitdistill

Is this the same issue or a different issue?

If I load a video from an existing IFRAME, which I attach to a Player and bind the loaded event, it successfully loads and fires the loaded event.

If I then call Player.loadVideo to load subsequent video's into the IFRAME even though they successfully load there is no loaded event being fired.

blackmambahk avatar Oct 14 '16 10:10 blackmambahk

Sounds like the same issue to me

On 14 Oct 2016 06:42, "robert.edgar" [email protected] wrote:

Is this the same issue or a different issue?

If I load a video from an existing IFRAME, which I attach to a Player and bind the loaded event, it successfully loads and fires the loaded event.

If I then call Player.loadVideo to load subsequent video's into the IFRAME even though they successfully load there is no loaded event being fired.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vimeo/player.js/issues/58#issuecomment-253767673, or mute the thread https://github.com/notifications/unsubscribe-auth/AEd-Tr6PzYhe2LLwWE7yG3y7yf5prdSxks5qz1ypgaJpZM4KMxUE .

BernsteinA avatar Oct 14 '16 14:10 BernsteinA

This is happening because you have ?api=1 on the <iframe>. That will keep it in what we call api 2 mode, which does not fire confirmation messages back to trigger the resolution of the promise. If you remove it, everything will work properly.

bdougherty avatar Jan 25 '17 19:01 bdougherty

@bdougherty thanks. turns out that was indeed in the documentation, just a bit buried.

BernsteinA avatar Jan 25 '17 19:01 BernsteinA