Add playlists using HTML and JavaScript. When the audio/video ends, the onending event is triggered. You can add messages such as "Thank you for watching", "Stay tuned!"
You can try running the following code to achieveonend Properties-
<!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 can load the next clip in the onending event as shown in the code given below
<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 />
The above is the detailed content of HTML 5 video or audio playlist. For more information, please follow other related articles on the PHP Chinese website!