Export (0) Print
Expand All

error | onerror event

Occurs when an error happens during an append operation.

Important  This event is not supported in Internet Explorer 11 on Windows 7.

HTML5 A vocabulary and associated APIs for HTML and XHTMLIE11

 

Syntax

HTML Attribute <element onerror = "handler(event)">
Event Property object.onerror = handler;
addEventListener Method object.addEventListener("error", handler, useCapture)

 

Event information

SynchronousNo
BubblesNo
CancelableNo

 

Event handler parameters

handler [in]

Type: function

Event handler object.

Standards information

Remarks

updating changes from true to false.

Examples

This example displays a number of media events, including errors.


// content has loaded, display buttons and set up events
video.addEventListener("canplay", function () {
  document.getElementById("buttonbar").style.display = "block";
}, false);

//  display video duration when available
video.addEventListener("loadedmetadata", function () {
  vLength = video.duration.toFixed(1);
  document.getElementById("vLen").textContent = vLength; // global variable
}, false);

//  display the current and remaining times
video.addEventListener("timeupdate", function () {
  //  Current time  
  var vTime = video.currentTime;
  document.getElementById("curTime").textContent = vTime.toFixed(1);
  document.getElementById("vRemaining").textContent = (vLength - vTime).toFixed(1);
}, false);
//  paused and playing events to control buttons
video.addEventListener("pause", function () {
  document.getElementById("play").textContent = ">";
}, false);

video.addEventListener("playing", function () {
  document.getElementById("play").textContent = "||";
}, false);

video.addEventListener("volumechange", function () {
  if (video.muted) {
    // if muted, show mute image
    document.getElementById("mute").innerHTML = "<img alt='volume off button' src='mute2.png' />";
  } else {
    // if not muted, show not muted image
    document.getElementById("mute").innerHTML = "<img alt='volume on button' src='vol2.png' />";
  }
}, false);
//  Download and playback status events.
video.addEventListener("loadstart", function () {
  document.getElementById("ls").textContent = "Started";
}, false);
video.addEventListener("loadeddata", function () {
  document.getElementById("ld").textContent = "Data was loaded";
}, false);

video.addEventListener("ended", function () {
  document.getElementById("ndd").textContent = "Playback ended";
}, false);

video.addEventListener("emptied", function () {
  document.getElementById("mt").textContent = "Video reset";
}, false);

video.addEventListener("stalled", function () {
  document.getElementById("stall").textContent = "Download was stalled";
}, false);
video.addEventListener("waiting", function () {
  document.getElementById("waiting").textContent = "Player waited for content";
}, false);
video.addEventListener("progress", function () {
  pgFlag += "+";
  if (pgFlag.length > 10) {
    pgFlag = "+";
  }
  document.getElementById("pg").textContent = pgFlag;

}, false);
video.addEventListener("durationchange", function () {
  document.getElementById("dc").textContent = "Duration has changed";
}, false);
video.addEventListener("canplaythrough", function () {
  document.getElementById("cpt").textContent = "Ready to play whole video";
}, false);


See also

SourceBuffer

 

 

Show:
© 2014 Microsoft