as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
When implemented, handles media control callbacks.

Properties

handlePlay

handlePlay: (sessionId?: IMediaSessionId) => Promise<void>
Handles a play request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the play request is successfully handled, or rejects with an error if the request fails.

handlePause

handlePause: (sessionId?: IMediaSessionId, context?: ICommandContext) => Promise<void>
Handles a pause request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.
context?
ICommandContext Optional. Additional command context.

Returns

Promise<void> A Promise that resolves when the pause request is successfully handled, or rejects with an error if the request fails.

handleTogglePlayPause

handleTogglePlayPause: (sessionId?: IMediaSessionId) => Promise<void>
Handles a toggle play pause request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the toggle play pause request is successfully handled, or rejects with an error if the request fails.

handleStop

handleStop: (sessionId?: IMediaSessionId) => Promise<void>
Handles a stop request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the stop request is successfully handled, or rejects with an error if the request fails.

handleStartOver

handleStartOver: (sessionId?: IMediaSessionId) => Promise<void>
Handles a start over request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the start over request is successfully handled, or rejects with an error if the request fails.

handleFastForward

handleFastForward: (sessionId?: IMediaSessionId) => Promise<void>
Handles a fast forward request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the fast forward request is successfully handled, or rejects with an error if the request fails.

handleRewind

handleRewind: (sessionId?: IMediaSessionId) => Promise<void>
Handles a rewind request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the rewind request is successfully handled, or rejects with an error if the request fails.

handleSetPlaybackSpeed

handleSetPlaybackSpeed: (speed: number, sessionId?: IMediaSessionId) => Promise<void>
Handles a set playback speed request initiated through a media control.

Parameters

speed
number speed to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the set playback speed request is successfully handled, or rejects with an error if the request fails.

handleSkipForward

handleSkipForward: (delta: ITimeValue, sessionId?: IMediaSessionId) => Promise<void>
Handles a skip forward request initiated through a media control.

Parameters

delta
ITimeValue delta to skip forward.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the skip forward request is successfully handled, or rejects with an error if the request fails.

handleSkipBackward

handleSkipBackward: (delta: ITimeValue, sessionId?: IMediaSessionId) => Promise<void>
Handles a skip backward request initiated through a media control.

Parameters

delta
ITimeValue delta to skip backward.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the skip backward request is successfully handled, or rejects with an error if the request fails.

handleSeek

handleSeek: (position: ITimeValue, sessionId?: IMediaSessionId) => Promise<void>
Handles a seek request initiated through a media control.

Parameters

position
ITimeValue position to seek to.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the seek request is successfully handled, or rejects with an error if the request fails.

handleSetAudioVolume

handleSetAudioVolume: (volume: number, sessionId?: IMediaSessionId) => Promise<void>
Handles a set audio volume request initiated through a media control.

Parameters

volume
number volume to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the set audio volume request is successfully handled, or rejects with an error if the request fails.

handleSetAudioTrack

handleSetAudioTrack: (audioTrack: ITrack, sessionId?: IMediaSessionId) => Promise<void>
Handles a set audio track request initiated through a media control.

Parameters

audioTrack
ITrack track to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the set audio track request is successfully handled, or rejects with an error if the request fails.

handleEnableTextTrack

handleEnableTextTrack: (textTrack: ITrack, sessionId?: IMediaSessionId) => Promise<void>
Handles an enable text track request initiated through a media control.

Parameters

textTrack
ITrack track to enable.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the enable text track request is successfully handled, or rejects with an error if the request fails.

handleDisableTextTrack

handleDisableTextTrack: (sessionId?: IMediaSessionId) => Promise<void>
Handles a disable text track request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the disable text track request is successfully handled, or rejects with an error if the request fails.

handleNext

handleNext: (sessionId?: IMediaSessionId) => Promise<void>
Handles a next request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the next request is successfully handled, or rejects with an error if the request fails.

handlePrevious

handlePrevious: (sessionId?: IMediaSessionId) => Promise<void>
Handles a previous request initiated through a media control.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the previous request is successfully handled, or rejects with an error if the request fails.

handleEnableShuffle

handleEnableShuffle: (enable: boolean, sessionId?: IMediaSessionId) => Promise<void>
Handles an enable shuffle request initiated through a media control.

Parameters

enable
boolean enable shuffle.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the enable shuffle request is successfully handled, or rejects with an error if the request fails.

handleSetRepeatMode

handleSetRepeatMode: (mode: RepeatMode, sessionId?: IMediaSessionId) => Promise<void>
Handles a set repeat mode request initiated through a media control.

Parameters

mode
RepeatMode repeat mode.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the pause set repeat mode is successfully handled, or rejects with an error if the request fails.

handleSetRating

handleSetRating: (id: MediaId, rating: number, sessionId?: IMediaSessionId) => Promise<void>
Handles a set rating request.

Parameters

id
MediaId The ID of the media.
rating
number The value to set for the rating.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the set rating request is successfully handled, or rejects with an error if the request fails.

handleGetMetadataInfo

handleGetMetadataInfo: (id: MediaId) => Promise<IMediaMetadata>
Handles a request for the metadata of the specified media item.

Parameters

id
MediaId The ID of the media.

Returns

Promise<IMediaMetadata> A Promise that resolves when the request is successfully handled, or rejects with an error if the request fails.

handleCustomAction

handleCustomAction: (action: Action, sessionId?: IMediaSessionId) => Promise<void>
Handles a request for a custom action.

Parameters

action
Action The action to perform.
sessionId?
IMediaSessionId Optional. The session ID to target with the request.

Returns

Promise<void> A Promise that resolves when the request is successfully handled, or rejects with an error if the request fails.

handleGetSessionState

handleGetSessionState: (sessionId?: IMediaSessionId) => Promise<MediaSessionState[]>
Handles a request for the session state.

Parameters

sessionId?
IMediaSessionId Optional. The session ID of the session whose state is to be fetched. If not provided, treat as a request for data on all sessions.

Returns

Promise<MediaSessionState[]> A Promise that resolves when the request is successfully handled, or rejects with an error if the request fails.
最后修改于 2026年8月25日