fuchsia.media.sessions

PROTOCOLS

Publisher

Defined in fuchsia.media.sessions/service.fidl

Publisher publishes media sessions. This allows priviledged processes to send media controls to the media session and observe changes in its playback state.

Publish

Publishes a session. Returns session_id which can be used to to identify the session.

Request

NameType
session Session

Response

NameType
session_id handle<event>

PublishRemote

Publishes a remote session, whose playback does not originate on this device. Returns a session_id which can be used to identify the session.

Request

NameType
session Session

Response

NameType
session_id handle<event>

Registry

Defined in fuchsia.media.sessions/service.fidl

Registry observes the collection of published media sessions and vends control handles to them.

OnActiveSessionChanged

OnActiveSessionChanged is sent on connection and when the underlying active session is changed.

Response

NameType
active_session ActiveSession

NotifyActiveSessionChangeHandled

Notifies the Registry that the active session change events was handled and that the client is ready for more. If you want these events, send this message on receipt of them. After some amount of events are sent without receipts, the client will stop receiving events from the Registry.

Never sending this message has no effect other than unsubscribing from these events.

Request

NameType

OnSessionsChanged

When the set of registered sessions changes, this event is sent. On connection the client is caught up to the state of the collection with "ADD" events for each existing session.

Response

NameType
sessions_change SessionsChange

NotifySessionsChangeHandled

Notifies the Registry that the sessions change event was handled and that the client is ready for more. If you want these events, send this message on receipt of them. After some amount of events are sent without receipts, the client will stop receiving events from the Registry.

Never sending this message has no effect other than unsubscribing from these events.

Request

NameType

ConnectToSessionById

Connects to a Session for session_id if present.

Request

NameType
session_id handle<event>
session_request request<Session>

ReadOnlySession

Defined in fuchsia.media.sessions/session.fidl

ReadOnlySession is a handle for media playback, allowing clients to observe a playback session.

OnPlaybackStatusChanged

Sent on first connection and when playback status changes.

Response

NameType
playback_status PlaybackStatus

OnMetadataChanged

Sent on first connection and when metadata changes.

Response

NameType
media_metadata fuchsia.media/Metadata

OnMediaImagesChanged

Sent on first connection if there are images, and when media images change. Sends only the image type that has changed: if album art changes but not source icon, the source icon is not re-sent.

Response

NameType
media_images vector<MediaImage>

GetMediaImageBitmap

Returns the bitmap for a given image url. This url is expected to be a url the session gave the client in an OnMediaImagesChanged event. If the minimum size is not available or the url is not recognized, the session may return a null image.

Request

NameType
url string
minimum_size fuchsia.math/Size
desired_size fuchsia.math/Size

Response

NameType
media_image_bitmap MediaImageBitmap?

Session

Defined in fuchsia.media.sessions/session.fidl

Session is a handle for media playback, allowing clients to observe and control a media playback session. Unsupported commands are no-ops. Consult PlaybackCapabilities, sent by OnPlaybackCapabilities, to learn which commands are supported.

OnPlaybackStatusChanged

Sent on first connection and when playback status changes.

Response

NameType
playback_status PlaybackStatus

OnMetadataChanged

Sent on first connection and when metadata changes.

Response

NameType
media_metadata fuchsia.media/Metadata

OnMediaImagesChanged

Sent on first connection if there are images, and when media images change. Sends only the image type that has changed: if album art changes but not source icon, the source icon is not re-sent.

Response

NameType
media_images vector<MediaImage>

GetMediaImageBitmap

Returns the bitmap for a given image url. This url is expected to be a url the session gave the client in an OnMediaImagesChanged event. If the minimum size is not available or the url is not recognized, the session may return a null image.

Request

NameType
url string
minimum_size fuchsia.math/Size
desired_size fuchsia.math/Size

Response

NameType
media_image_bitmap MediaImageBitmap?

OnPlaybackCapabilitiesChanged

Sent on first connection and when supported playback capabilities change.

Response

NameType
playback_capabilities PlaybackCapabilities

Play

Plays media.

Request

NameType

Pause

Pauses playback and retains position in media

Request

NameType

Stop

Stops playback. There is no position or associated media in the stopped state.

Request

NameType

SeekToPosition

Seeks to a specific position in media. Implementations are free to to treat this as a no-op or enter an error state if the position is out of bounds. position is an offset from the beginning of the media.

Request

NameType
position int64

SkipForward

Skips forward in media. Uses the default skip interval if skip_amount is 0.

Request

NameType
skip_amount int64

SkipReverse

Skips in reverse in media. Uses the default skip interval if skip_amount is 0.

Request

NameType
skip_amount int64

NextItem

Changes media to the next item (e.g. next song in playlist).

Request

NameType

PrevItem

Changes media to the previous item.

Request

NameType

SetPlaybackRate

Sets the playback rate of the media. This may imply a change of playback mode.

Request

NameType
playback_rate float32

SetRepeatMode

Sets repeat mode to any of the supported repeat modes.

Request

NameType
repeat_mode RepeatMode

SetShuffleMode

Sets shuffle mode.

Request

NameType
shuffle_on bool

BindGainControl

Binds to the session's gain control for control and notifications.

Request

NameType
gain_control_request request<fuchsia.media.audio/GainControl>

ConnectToExtension

Request

NameType
extension string
channel handle<channel>

STRUCTS

MediaImage

Defined in fuchsia.media.sessions/image.fidl

An image for playing media.

NameTypeDescriptionDefault
image_type MediaImageType No default
url string A url the client can use to load the image or request a bitmap from the player. No default
mime_type string The mime type of the image if loaded through the given url by the client. No default
sizes vector<fuchsia.math/Size> Dimensions in which the image is available. No default

MediaImageBitmap

Defined in fuchsia.media.sessions/image.fidl

An ARGB8888 bitmap image.

NameTypeDescriptionDefault
size fuchsia.math/Size No default
argb8888_pixel_data fuchsia.mem/Buffer No default

SessionsChange

Defined in fuchsia.media.sessions/service.fidl

A change to the set of registered sessions.

NameTypeDescriptionDefault
session SessionEntry No default
delta SessionDelta No default

ENUMS

MediaImageType

Type: uint32

Defined in fuchsia.media.sessions/image.fidl

NameValueDescription
ARTWORK 0
SOURCE_ICON 1

PlaybackState

Type: uint32

Defined in fuchsia.media.sessions/playback_status.fidl

NameValueDescription
STOPPED 0
PLAYING 1
PAUSED 2
ERROR 3

RepeatMode

Type: uint32

Defined in fuchsia.media.sessions/playback_status.fidl

NameValueDescription
OFF 0
GROUP 1
SINGLE 2

SessionDelta

Type: uint32

Defined in fuchsia.media.sessions/service.fidl

NameValueDescription
ADDED 0
REMOVED 1

TABLES

PlaybackCapabilities

Defined in fuchsia.media.sessions/playback_capabilities.fidl

PlaybackCapabilities enumerates the capabilities of the player backing the media session, and correspond to the control commands they can execute.

OrdinalNameTypeDescription
1 flags PlaybackCapabilityFlags
2 supported_skip_intervals vector<int64> The intervals on which skipping can be performed in the media.
3 supported_playback_rates vector<float32> The playback rates supported by the media.
4 supported_repeat_modes vector<RepeatMode> Supported repeat modes that can be set with `SetRepeatMode()`.
5 custom_extensions vector<string> A set of names of custom extensions the player advertises.

PlaybackStatus

Defined in fuchsia.media.sessions/playback_status.fidl

OrdinalNameTypeDescription
1 duration int64 Total duration of playing media. 0 if not known or not applicable.
2 playback_state PlaybackState
3 playback_function fuchsia.media/TimelineFunction A playback function that describes the position and rate of play through the media.
4 repeat_mode RepeatMode
5 shuffle_on bool
6 has_next_item bool Whether a media item exists after the playing one in queue (e.g. a next song in an album or next video in a playlist.)
7 has_prev_item bool Whether a media item preceded the playing one in queue.
8 error Error

Error

Defined in fuchsia.media.sessions/playback_status.fidl

OrdinalNameTypeDescription
1 code uint32
2 description string

ActiveSession

Defined in fuchsia.media.sessions/service.fidl

Describes the session which is currently implementing the active session interface.

OrdinalNameTypeDescription
1 session_id handle<event>

SessionEntry

Defined in fuchsia.media.sessions/service.fidl

A registered session in the Media Session registry.

OrdinalNameTypeDescription
1 session_id handle<event> The id of the registered session.
2 local bool Whether the session takes place locally on this device.

BITS

PlaybackCapabilityFlags

Type: uint32

NameValueDescription
PLAY 1 If set, the player can `Play()`.
STOP 2 If set, the player can `Stop()`.
PAUSE 4 If set, the player can `Pause()`.
SEEK_TO_POSITION 8 If set, the player can `SeekToPosition()`.
SKIP_FORWARD 16 If set, the player can `SkipForward()` on `supported_skip_intervals`.
SKIP_REVERSE 32 If set, the player can `SkipReverse()` on `supported_skip_intervals`.
SHUFFLE 64 The intervals on which skipping can be performed in the media.
CHANGE_TO_NEXT_ITEM 128
CHANGE_TO_PREV_ITEM 256
HAS_GAIN_CONTROL 512 If set, the player can `BindGainControl()`.
PROVIDE_BITMAPS 1024 If set, the player can provide bitmaps of its artwork.