pause event is sent when a request to pause an activity is handled and the activity has entered its paused state, most commonly after the media has been paused through a call to the element's pause() 方法。 The event is sent once the pause() method returns and after the media element's paused property has been changed to true .

General info

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

范例

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

使用 addEventListener() :

const video = document.querySelector('video');
video.addEventListener('pause', (event) => {
  console.log('The Boolean paused property is now true. Either the ' +
  'pause() method was called or the autoplay attribute was toggled.');
});
					

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

const video = document.querySelector('video');
video.onpause = (event) => {
  console.log('The Boolean paused property is now true. Either the ' +
  'pause() method was called or the autoplay attribute was toggled.');
};
					

规范

规范 状态
HTML 实时标准
The definition of 'pause media event' in that specification.
实时标准
HTML5
The definition of 'pause 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
pause 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

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: