Skip to main content

Diva Player Command

API exposed by DIVA to interact directly with the player.

divaApi.sendPlayerCommand: (command: DivaCommand) => void: send player command;

export type DivaCommandName = 'mute' | 'pause' | 'play' | 'playback-rate' | 'seek' | 'seek-absolute';

export const DivaCommandName = {
MUTE: 'mute',
PAUSE: 'pause',
PLAY: 'play',
PLAYBACK_RATE: 'playback-rate',
SEEK: 'seek',
SEEK_ABSOLUTE: 'seek-absolute',
};

export interface DivaCommandMute {
command: 'mute';
value: boolean;
}

export interface DivaCommandPause {
command: 'pause';
}

export interface DivaCommandPlay {
command: 'play';
}

export interface DivaCommandPlaybackRate {
command: 'playback-rate';
value: number;
}

export interface DivaCommandSeek {
command: 'seek';
value: number; // Milliseconds relative to trim in
}

export interface DivaCommandSeekAbsolute {
command: 'seek-absolute';
value: Date;
}

export type DivaCommand =
| DivaCommandMute
| DivaCommandPause
| DivaCommandPlay
| DivaCommandPlaybackRate
| DivaCommandSeek
| DivaCommandSeekAbsolute;