loadeddata event is fired when the frame at the current playback position of the media has finished loading; often the first frame.

冒泡 No
可取消 No
接口 事件
目标 元素
默认动作 None
事件处理程序特性 GlobalEventHandlers.onloadeddata
规范 HTML5 媒体

Note that this event will not fire in mobile/tablet devices if data-saver is on in browser settings.

范例

These examples add an event listener for the HTMLMediaElement's loadeddata event, then post a message when that event handler has reacted to the event firing.

使用 addEventListener() :

const video = document.querySelector('video');
video.addEventListener('loadeddata', (event) => {
  console.log('Yay! The readyState just increased to  ' +
      'HAVE_CURRENT_DATA or greater for the first time.');
});
					

使用 onloadeddata 事件处理程序特性:

const video = document.querySelector('video');
video.onloadeddata = (event) => {
  console.log('Yay! The readyState just increased to  ' +
      'HAVE_CURRENT_DATA or greater for the first time.');
};
					

规范

规范 状态
HTML 实时标准
The definition of 'loadeddata media event' in that specification.
实时标准
HTML5
The definition of 'loadeddata media event' in that specification.
推荐

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
loadeddata event Chrome 3 Edge 12 Firefox 3.5 IE 9 Opera 10.5 Safari 3.1 WebView Android Yes Chrome Android 18 Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android 1.0

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: