-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathCastEvent.ts
39 lines (29 loc) · 1.1 KB
/
CastEvent.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import type { CastState, ChromecastError, PlayerEventType } from 'react-native-theoplayer';
import type { Event } from './Event';
export enum CastEventType {
/**
* Dispatched when the ChromeCast state was changed.
*/
CHROMECAST_STATE_CHANGE = 'chromecaststatechange',
/**
* Dispatched when the Airplay state was changed.
*/
AIRPLAY_STATE_CHANGE = 'airplaystatechange',
/**
* Dispatched when an error occurred when using Chromecast.
*/
CHROMECAST_ERROR = 'chromecasterror',
}
export type CastEvent = ChromecastChangeEvent | AirplayStateChangeEvent | ChromecastErrorEvent;
export interface ChromecastChangeEvent extends Event<PlayerEventType.CAST_EVENT> {
readonly subType: CastEventType.CHROMECAST_STATE_CHANGE;
readonly state: CastState;
}
export interface AirplayStateChangeEvent extends Event<PlayerEventType.CAST_EVENT> {
readonly subType: CastEventType.AIRPLAY_STATE_CHANGE;
readonly state: CastState;
}
export interface ChromecastErrorEvent extends Event<PlayerEventType.CAST_EVENT> {
readonly subType: CastEventType.CHROMECAST_ERROR;
readonly error: ChromecastError;
}