Nested promises do not seem to fire
See original GitHub issueSteps to Reproduce
The code below is called via an event handler on the player, then tries to do something, perhaps simply writing to the console, once it is sure that the player has been paused. However, in the case where it is trying to pause the player and then run a callback, the code in the nested promise is never run.
player
.getPaused()
.then(function (paused) {
console.info("Was player paused?: " + paused);
if (paused) {
// Do something...
console.info("Doing something interesting.");
} else {
// If the player is not paused, pause it first, then do something...
console.info("Pausing player");
player
.pause()
.then(function () {
console.info("Doing something interesting post-pause - this never runs");
});
}
});
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Please don't nest promises - DEV Community
The issues with promises only begin to appear when multiple asynchronous operations need to be executed one after the other in a specific...
Read more >Nested promises with for loop doesn't work - Stack Overflow
The calls are made correctly, because if I use Promise.all([promises here]) , then it works. But I'm trying to learn to chain promises...
Read more >Using promises - JavaScript - MDN Web Docs
A Promise is an object representing the eventual completion or failure of an ... The first mistake is to not chain things together...
Read more >A Guide to Nested Promises, Anti-Pattern, and Alternatives
Promise in JavaScript is a popular design pattern used to handle asynchronous tasks in Node.js. It can take care of parallel/serial ...
Read more >Error handling with promises - The Modern JavaScript Tutorial
Normally, such .catch doesn't trigger at all. But if any of the promises above rejects (a network problem or invalid json or whatever),...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@paulmolluzzo does the element you’re passing in have a
data-vimeo-idattribute? If not, that’s the reason (the null load is definitely something that should be fixed in the library though).When you first create the player object, either add the
data-vimeo-idattribute to the element first or pass the id in as the second param:Follow up: (please let me know if this is off-topic and I can start a new thread)
I hadn’t noticed this before, but on the videos that don’t load/autoplay, will flash an error briefly in the player. “Unhandled video privacy”.
And in the console it says:
player.js:7 Refused to load the image 'https://player.vimeo.com/video/152464736' because it violates the following Content Security Policy directive: "img-src https://i.vimeocdn.com https://secure-b.vimeocdn.com https://f.vimeocdn.com https://vimeo.com https://sb.scorecardresearch.com https://ssl.google-analytics.com https://secure.gravatar.com https://i0.wp.com https://i1.wp.com https://i2.wp.com https://f.vimeocdn.com".If the error handler fired, I could at least skip this particular video, but it seems to not notify me. Any idea why this would be happening? Thanks for your help.