- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Execute a script when a file is ready to start playing in HTML?
You can use the oncanplay attribute for the following attributes − <audio> , <embed>, <object> and <video>.
Example
<!DOCTYPE HTML> <html> <body> <video width = "300" height = "200" controls oncanplay = "display()"> <source src = "/html5/foo.ogg" type = "video/ogg" /> <source src = "/html5/foo.mp4" type = "video/mp4" /> Your browser does not support the video element. </video> <script> alert("I am ready to begin."); </script> </body> </html>
- Related Articles
- Execute a script when the media is ready to start playing in HTML?
- Execute a script when the media has started playing in HTML?
- Execute a script when the file is unavailable in HTML?
- Execute a script when media data is loaded in HTML?
- Execute a script when the element is invalid in HTML?
- Execute a script at the start of a drag operation in HTML?
- Execute a script when a user is pressing a key in HTML?
- Execute a script when an error occurs in HTML?
- Execute a script when a page has unloaded in HTML?
- Execute a script when the element is finished loading in HTML?
- Execute a script when the browser window is closed in HTML?
- Execute a script when the element is being dragged in HTML?
- Execute a script when the element is being clicked in HTML?
- Execute a script when a Web Storage area is updated in HTML?
- Execute a script when a user navigates to a page in HTML?

Advertisements