Frequently Asked Questions

[General] I've added an event handler for video element but looks like it doesn't work. What is the problem?

Category: Technical FAQ

When the event occurs, only the event handler using the addEventListener() function can be called. If you have added an event handler as a property type, it will not work correctly. For the compatible code, you MUST use addEventListener() to add an event handler, as below:

Do not:

vid.onloadeddata = function (event) {
    log(JSON.stringify(event));
});

Do

vid.addEventListener("loadeddata", function (event) {
    log(JSON.stringify(event));
});