Skip to content

MediaSessionAPI

Types

mediaImage

type mediaImage = {
mutable src: string,
mutable sizes?: string,
mutable type_?: string,
}

Record fields

src
string
sizes
option< string >
type_
option< string >

mediaMetadata

type mediaMetadata = {
mutable title: string,
mutable artist: string,
mutable album: string,
mutable artwork: array<mediaImage>,
}

Record fields

title
string
artist
string
album
string
artwork
array< mediaImage >

Module

There are methods and helpers defined in MediaMetadata .

mediaMetadataInit

type mediaMetadataInit = {
mutable title?: string,
mutable artist?: string,
mutable album?: string,
mutable artwork?: array<mediaImage>,
}

Record fields

title
option< string >
artist
option< string >
album
option< string >
artwork
option< array< mediaImage > >

mediaPositionState

type mediaPositionState = {
mutable duration?: float,
mutable playbackRate?: float,
mutable position?: float,
}

Record fields

duration
option< float >
playbackRate
option< float >
position
option< float >

mediaSession

type mediaSession = {
mutable metadata: Null.t<mediaMetadata>,
mutable playbackState: mediaSessionPlaybackState,
}

Record fields

metadata
Null.t< mediaMetadata >

Module

There are methods and helpers defined in MediaSession .

mediaSessionAction

type mediaSessionAction =
| @as("nexttrack") Nexttrack
| @as("pause") Pause
| @as("play") Play
| @as("previoustrack") Previoustrack
| @as("seekbackward") Seekbackward
| @as("seekforward") Seekforward
| @as("seekto") Seekto
| @as("skipad") Skipad
| @as("stop") Stop

mediaSessionActionDetails

type mediaSessionActionDetails = {
mutable action: mediaSessionAction,
mutable seekOffset?: float,
mutable seekTime?: float,
mutable fastSeek?: bool,
}

Record fields

seekOffset
option< float >
seekTime
option< float >
fastSeek
option< bool >

mediaSessionActionHandler

type mediaSessionActionHandler = mediaSessionActionDetails => unit

mediaSessionPlaybackState

type mediaSessionPlaybackState =
| @as("none") None
| @as("paused") Paused
| @as("playing") Playing