Comments (3)
Same here,
let $video = $('[data-vbg]');
$video.on('video-background-play', (e) => {
alert('playing');
});
$video.youtube_background({ 'fit-box': true });
Nothing happens.
from youtube-background.
Can you add this line after YoutubeBackground.prototype.onVideoStateChange = function (event) {...
this.element.dispatchEvent(new CustomEvent('video-background-state', { bubbles: true, detail: {YoutubeBackground: this, videoState: event.data} }));
so it looks like this:
YoutubeBackground.prototype.onVideoStateChange = function (event) {
this.element.dispatchEvent(new CustomEvent('video-background-state', { bubbles: true, detail: {YoutubeBackground: this, videoState: event.data} }));
if (event.data === 0 && this.params.loop) {
this.seekTo(this.params['start-at']);
this.player.playVideo();
}
...
Then we can get any player stateChange events like this:
let $video = $('[data-vbg]');
$video.on('video-background-state', (e) => {
console.log(e.detail.videoState, 'state');
});
$video.youtube_background({ 'fit-box': true });
Look for onStateChange
event in this API doc
YouTube Player API Reference for iframe Embeds
from youtube-background.
Hey folks @avblink @4foot30, sorry for my inactivity on this project and the late replys. I've sorted out the events aligned them between the instances in the latest version v1.0.22. You can find the guide for the events as a part of the README.md.
Cheers 🥂
from youtube-background.
Related Issues (20)
- Please provide some troubleshooting tips HOT 1
- this.player.getvideodata is not a function HOT 1
- Not working on mobiles and tablets HOT 1
- Embedded YT playback quality poor on iOS Safari HOT 2
- feature: youtube-nocookie.com/embed/.... HOT 2
- Preview: file maxresdefault.jpg missing for some videos HOT 1
- Update Video URL after Initialization HOT 2
- Not able to disable on mobile HOT 1
- Issues with non-jquery working HOT 2
- Programmatically set the volume HOT 2
- youtube-background | Video stop on mobile when switching tabs/ windows HOT 5
- Bugs with starting video playback without sound and pausing the video when scrolling HOT 9
- Yarn install fail on Windows after 1.0.15 HOT 1
- The poster parameter is not working HOT 1
- Lighthouse tests complain that iframe does not have a title . HOT 2
- "explore video" pops up when the video is paused. HOT 3
- Playing private Vimeo videos HOT 4
- Pagespeed performance issues HOT 6
- Add `.mov` and `.m4v` to VideoBackground.MIME_MAP HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youtube-background.