The action
property is the only required property MediaSessionActionDetails
dictionary, specifying the type of media session action which the action handler callback is being executed for.
Syntax
let mediaSessionActionDetails = { action: actionType }; let actionType = mediaSessionActionDetails.action;
Value
A DOMString
specifying which of the action types the callback is being invoked for:
nexttrack
Advances playback to the next track.
pause
Pauses playback of the media.
play
Begins (or resumes) playback of the media.
previoustrack
Moves back to the previous track.
seekbackward
Seeks backward through the media from the current position. The MediaSessionActionDetails
property seekOffset
specifies the amount of time to seek backward.
seekforward
Seeks forward from the current position through the media. The MediaSessionActionDetails
property seekOffset
specifies the amount of time to seek forward.
seekto
Moves the playback position to the specified time within the media. The time to which to seek is specified in the MediaSessionActionDetails
property seekTime
. If you intend to perform multiple seekto
operations in rapid succession, you can also specify the MediaSessionActionDetails
property fastSeek
property with a value of true
. This lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance.
skipad
Skips past the currently playing advertisement or commercial. This action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances.
stop
Halts playback entirely.
Specifications
Specification | Status | Comment |
Media Session StandardThe definition of 'MediaSessionActionDetails.action' in that specification. | Draft | Initial definition. |
Browser compatibility
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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
Full support 73 |
Edge
Full support ≤79 |
Firefox Full support 71 Full support 71 Disabled' From version 71: this feature is behind the |
IE
? |
Opera
No support No |
Safari
? |
WebView Android
No support No |
Chrome Android
Full support 57 |
Firefox Android
No support No |
Opera Android
No support No |
Safari iOS
? |
Samsung Internet Android
Full support 7.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
See also
- Media Session API
- Refer to the
MediaSession
methodsetActionHandler()
MediaSessionActionDetails.action by Mozilla Contributors is licensed under CC-BY-SA 2.5.