openplayerjs: Not able to preload ads and start video via API
This is not a bug per-se, but just an issue that I’m currently having.
What I would like to achieve is to “preload” the ads and when this is done, starting the video player via player.play() to start playing.
For some reason I can’t get this to work in any combination using player API calls.
@rafa8626 do you have any suggestions of how I could achieve something like that?
The flow in the shortest way possible would look something like this:
player.loadAds().then(() => player.play());
Is something like this achievable? I wasn’t able to get this working with current implementation.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Added missing documentation for #191 — committed to openplayerjs/openplayerjs by rafa8626 4 years ago
- fix(ads): Added new conditional to start or resume ad depending on that status of them; added conditional to just init the ads manager if preload is enabled for #191 — committed to openplayerjs/openplayerjs by rafa8626 4 years ago
Checked again and everything works as expected.
@nejcsever thanks for confirming this; I’ll set the release tonight with this change
Works like a charm, perfect! Thank you very much! 🙏
@nejcsever I figured it out; please download the master branch one more and test the snippet I sent you. I forgot to add a couple of conditionals to ensure the loading of ads happen initially but until you dispatch a Play event everything will run. Let me know if it works for you now
@nejcsever thanks for the thorough explanation; let me see what I can do to help you with this, but it may take some time. So as soon as I’m not as busy as I am right now I’ll get to this