Search code examples
html5-videobxslider

BXSlider event when video starts playing


I am using BXSlider to display various videos. I am trying to fade out an overlay when the first video starts playing.

I have tried hooking into onSliderLoad but that trigger before the video has started playing.

Anyone know if there is a way I can detect when the video has actually started playing?


Solution

  • Listen for the playing event.

    Demo

    var vid = document.getElementById('vid');
    
    vid.addEventListener('playing', function(e) {
      console.log('Video has started');
    });
    <video id='vid' src='http://media6000.dropshots.com/photos/1381926/20170326/005611.mp4' width='320' height='180' controls autoplay></video>