2

I have tried like this

document.getElementById('myVID').onplaying = alert("Playback started");

But, the alert is not coming. I have tested it in chrome. Is there any issue in this code?. Otherwise this event is not supported.

Pavlo
  • 43,301
  • 14
  • 77
  • 113
Kannan
  • 21
  • 1
  • 2

1 Answers1

2

Working JSFiddle: http://jsfiddle.net/E7FhU/

I would say change your code to be like this because as @Passerby said, alert returns undefined and you need to assign a function. Additionally, this can be accomplished with simple javascript.

    <script>
        var video = document.getElementById('myVID');

        video.onplaying = function(e) {
          /*Do things here!*/
          alert("hello video");
        }
    </script>

When you click play the alert is displayed.

References:

Community
  • 1
  • 1
Menelaos
  • 23,508
  • 18
  • 90
  • 155
  • I have written the code as below, I am getting the alert "Load Start" but not getting the alert "hello video" – Kannan Sep 24 '13 at 11:01
  • @Kannan This is from an error caused by trying to assign `undefined` to onloadstart. When you assign a function to both, the onplaying event work. See: http://jsfiddle.net/menelaosbgr/GsbhY/ – Menelaos Sep 24 '13 at 11:07