HTML Audio/Video DOMloadstartEvents

HTML Audio/Video DOM Reference Manual

Example

Prompt indicating the video has started loading:

myVid=document.getElementById("video1");
myVid.onloadstart=alert("Starting to load video");

Try it Yourself »

Definition and Usage

When the browser begins searching for the specified audio/video, the loadstart event occurs. That is, when the loading process starts.

While the audio/video is in the loading process, the following events occur in sequence:

  1. loadstart
  2. durationchange
  3. loadedmetadata
  4. loadeddata
  5. progress
  6. canplay
  7. canplaythrough

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All mainstream browsers support the loadstart event.

Note:Internet Explorer 8 and earlier versions do not support this event.


Syntax

In HTML:

<audio|video onloadstart="SomeJavaScriptCode">

In JavaScript:

audio|video.onloadstart=SomeJavaScriptCode;

Using addEventListener():

audio|video.addEventListener("loadstart", function()
  {
  //SomeJavaScriptCode
  }
);

Technical Details

The following HTML tags are supported: <audio>, <video>
The following JavaScript objects are supported: Audio, Video


实例

More Examples

Using the onloadstart attribute on HTML elements

Using addEventListener() to listen for the loadstart event


HTML Audio/Video DOM Reference Manualother extensions