forked from JeremyHeleine/Photo-Sphere-Viewer
-
-
Notifications
You must be signed in to change notification settings - Fork 634
/
events.ts
64 lines (55 loc) · 1.58 KB
/
events.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { TypedEvent } from '@photo-sphere-viewer/core';
import type { VideoPlugin } from './VideoPlugin';
/**
* @event Triggered when the video starts playing or is paused
*/
export class PlayPauseEvent extends TypedEvent<VideoPlugin> {
static override readonly type = 'play-pause';
override type: 'play-pause';
/** @internal */
constructor(public readonly playing: boolean) {
super(PlayPauseEvent.type);
}
}
/**
* @event Triggered when the video volume changes
*/
export class VolumeChangeEvent extends TypedEvent<VideoPlugin> {
static override readonly type = 'volume-change';
override type: 'volume-change';
/** @internal */
constructor(public readonly volume: number) {
super(VolumeChangeEvent.type);
}
}
/**
* @event Triggered when the video play progression changes
*/
export class ProgressEvent extends TypedEvent<VideoPlugin> {
static override readonly type = 'progress';
override type: 'progress';
/** @internal */
constructor(
public readonly time: number,
public readonly duration: number,
public readonly progress: number
) {
super(ProgressEvent.type);
}
}
/**
* @event Triggered when the video buffer changes
*/
export class BufferEvent extends TypedEvent<VideoPlugin> {
static override readonly type = 'buffer';
override type: 'buffer';
/** @internal */
constructor(public readonly maxBuffer: number) {
super(BufferEvent.type);
}
}
export type VideoPluginEvents =
| PlayPauseEvent
| VolumeChangeEvent
| ProgressEvent
| BufferEvent;