English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The load() method resets the media to its initial state, selects a playback source, and prepares to play the media again. The information about the media pre-play is determined by the preload parameter. This method is only effective when making dynamic changes to media, either by changing the src attribute or by adding or deleting a source. The load() method will reset the element to scan available sources again, making the changes take effect.
HTML Audio/Video DOM Reference Manual
Change video source and reload the video:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML Audio/video load() method usage-Basic Tutorial(oldtoolbag.com)</title> </head> <body> <button onclick="changeSource()" type="button">Change video source</button> <br> <video id="video1" controls="controls" autoplay="autoplay"> <source id="mp4_src" src="movie.mp4" type="video/mp4"> <source id="ogg_src" src="movie.ogg" type="video/ogg"> Your browser does not support HTML5 video tag. </video> <script> function changeSource() { document.getElementById("mp4_src").src="mov_bbb.mp4"; document.getElementById("ogg_src").src="mov_bbb.ogg"; document.getElementById("video1").load(); } </script> </body> </html>Test to see ‹/›
load() method reloads the audio/video element.
The load() method is used to update the audio/Video (audio/to update the video (audio) element.
IEFirefoxOperaChromeSafari
Internet Explorer 9+Firefox, Opera, Chrome, and Safari 6 Supports the load() method.
Note:Internet Explorer 8 and earlier versions do not support the load() method.
audio|video.load()