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.
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.
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: