as

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

Properties

play

play: (sessionId?: IMediaSessionId) => Promise<void>
Sends a play request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

pause

pause: (sessionId?: IMediaSessionId) => Promise<void>
Sends a pause requst on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

togglePlayPause

togglePlayPause: (sessionId?: IMediaSessionId) => Promise<void>
Sends a togglePlayPause request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

stop

stop: (sessionId?: IMediaSessionId) => Promise<void>
Sends a stop request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

startOver

startOver: (sessionId?: IMediaSessionId) => Promise<void>
Sends a startOver request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

fastForward

fastForward: (sessionId?: IMediaSessionId) => Promise<void>
Sends a fastForward request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

rewind

rewind: (sessionId?: IMediaSessionId) => Promise<void>
Sends a rewind request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

setPlaybackSpeed

setPlaybackSpeed: (speed: number, sessionId?: IMediaSessionId) => Promise<void>
Sends a setPlaybackSpeed request on the media control endpoint.

Parameters

speed
number speed to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

skipForward

skipForward: (delta: ITimeValue, sessionId?: IMediaSessionId) => Promise<void>
Sends a skipForward request on the media control endpoint.

Parameters

delta
ITimeValue The time delta to skip forward.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

skipBackward

skipBackward: (delta: ITimeValue, sessionId?: IMediaSessionId) => Promise<void>
Sends a skipBackward request on the media control endpoint.

Parameters

delta
ITimeValue The time delta to skip backward.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

seek

seek: (position: ITimeValue, sessionId?: IMediaSessionId) => Promise<void>
Sends a seek request on the media control endpoint.

Parameters

position
ITimeValue The time position to seek to.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

setAudioVolume

setAudioVolume: (volume: number, sessionId?: IMediaSessionId) => Promise<void>
Sends a set audio volume request on the media control endpoint.

Parameters

volume
number The volume level to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

setAudioTrack

setAudioTrack: (track: ITrack, sessionId?: IMediaSessionId) => Promise<void>
Sends a setAudioTrack requst on the media control endpoint.

Parameters

track
ITrack The track to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

enableTextTrack

enableTextTrack: (track: ITrack, sessionId?: IMediaSessionId) => Promise<void>
Sends a enableTextTrack request on the media control endpoint.

Parameters

track
ITrack The track to enable.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

disableTextTrack

disableTextTrack: (sessionId?: IMediaSessionId) => Promise<void>
Sends a disableTextTrack request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

next

next: (sessionId?: IMediaSessionId) => Promise<void>
Sends a next request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

previous

previous: (sessionId?: IMediaSessionId) => Promise<void>
Sends a previous request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

enableShuffle

enableShuffle: (enable: boolean, sessionId?: IMediaSessionId) => Promise<void>
Sends a enableShuffle request on the media control endpoint.

Parameters

enable
boolean When set to true shuffle is enabled; otherwise false.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

setRepeatMode

setRepeatMode: (mode: RepeatMode, sessionId?: IMediaSessionId) => Promise<void>
Sends a setRepeatMode request on the media control endpoint.

Parameters

mode
RepeatMode The mode to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

setRating

setRating: (id: MediaId, rating: number, sessionId?: IMediaSessionId) => Promise<void>
Sends a setRating request on the media control endpoint.

Parameters

id
MediaId The ID of the media.
rating
number The rating to set.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

getMetadata

getMetadata: (id: MediaId) => Promise<IMediaMetadata>
Sends a getMetadata request on the media control endpoint.

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.

sendCustomAction

sendCustomAction: (action: Action, sessionId?: IMediaSessionId) => Promise<void>
Sends a sendCustomAction request on the media control endpoint.

Parameters

action
Action The action to send.
sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the session to target is decided by the endpoint.

Returns

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

getSessionState

getSessionState: (sessionId?: IMediaSessionId) => Promise<MediaSessionState[]>
Sends a getSessionState request on the media control endpoint.

Parameters

sessionId?
IMediaSessionId Optional. The session ID to target with the request. If not provided, the request is interpretted to be for all available sessions.

Returns

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

getEndpointPackageId

getEndpointPackageId: () => IPackageId
Gets the package ID of this endpoint.

Returns

IPackageId The package ID.

addListener

addListener: (listener: IMediaControlListener) => Promise<ISubscription>
Subscribes a listener to monitor changes in the media session state.

Parameters

listener
IMediaControlListener The listener to add.

Returns

Promise<ISubscription> A Promise that resolves with an ISubscription object. This object can be used to unsubscribe the listener when it’s no longer needed.

destroy

destroy: () => void
Destroys the media control client asynchronously.
最后修改于 2026年8月25日