
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML 5 video or audio playlist
Use HTML with JavaScript to add playlist. The onended event fires when the audio/video has reached the end. You can add messages like “Thank you for watching”, “Stay tuned!”, etc
Example
You can try to run the following code to implement the onended attribute −
<!DOCTYPE HTML> <html> <body> <video width = "300" height = "200" controls onended = "display()"> <source src = "/html5/foo.ogg" type = "video/ogg" /> Your browser does not support the video element. </video> <script> function display() { alert ("Thank you for watching! Stay tuned!"); } </script> </body> </html>
You could load the next clip in the onended event like in the below-given code
<script > var next = "path/of/next/video.mp4"; var video = document.getElementById('video'); video.onended = function(){ video.src = next; } </script> <video id = "video" src = "path/of/current/video.mp4" autoplayautobuffer controls />
- Related Articles
- How to include the audio/video controls in HTML?
- 7 audio cassettes and 3 video cassettes cost ₹ 1110, while 5 audio cassettes and 4 video cassettes cost ₹ 1350. Find the cost of an audio cassette and a video cassette.
- How to set the audio output of the video to mute in HTML?
- HTML 5 Video Buffering a certain portion of a longer video
- Execute a script each time the volume of a video/audio is changed in HTML?
- Create a media resources for media elements, defined inside video or audio elements in HTML5.
- HTML DOM Audio Object
- How to play audio and video file in iOS?
- How to specify that the audio/video will start over again, every time it is finished in HTML?
- How do we specify that the audio/video will start playing as soon as it is ready in HTML?
- How can I add video to site background in HTML 5?
- What are free options available to generate closed captions from Audio/Video?
- What are the offline softwares to generate closed captions from audio/video?
- How to Create a Video and Audio Recorder with JavaScript MediaRecorder API?
- HTML DOM Video Object

Advertisements