jquery - Cycle2: automatically pause slideshow (timeout) when YouTube-video is played -
I would like to stop my cycling slideshow when a user clicks on the YouTube play button ()
< P> Important code part: data-cycle-timeout = 5000 data-cycle-youtube = true data-cycle-youtube-autostart = false My work is now installing break-on-hover - but of course, when the user slides slideshows then the user is not working
data-f Krr-paus-on-hover = "true" Can there be any hidden work to prevent slideshow on video play?
If you are using data-cycle-youtube = true - then with this youtube api Try this simple JS / Jote code:
1) Find all players and Event Listener on them
2) Handling changes in player status And do whatever you want. Pause / Resume Slideshow here
function onYouTubePlayerReady () {var players = $ ('cycle-youtube embed'). Each (function () (if.addEventListener) {this.addEventListener ('Onset Change', 'Handle PlayerStat Change');} and (this.atat event ('Onestate Change', 'Handle PlayerState Change');} }} Function Handle PlayerState Change (State) {Switch (State) {Case 1: Case 3: // Video / Buffering $ ('Cycle-Slide Show') has started Cycle ('Pause'); Breaks; case 2: case 0: // video has been paused / ended $ ('cycle-slide show'). Cycle ('resume'); breakdown;}}
Comments
Post a Comment