@byomakase/omakase-player 0.0.2 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,8 +17,21 @@ import { Api } from "./api";
17
17
  import { Observable } from "rxjs";
18
18
  import { AudioEvent } from "../types";
19
19
  export interface AudioApi extends Api {
20
+ /***
21
+ * Fires on audio track switched
22
+ */
20
23
  onAudioSwitched$: Observable<AudioEvent>;
24
+ /***
25
+ * Returns available audio tracks
26
+ */
21
27
  getAudioTracks(): any[];
28
+ /***
29
+ * Returns current active audio tracks
30
+ */
22
31
  getCurrentAudioTrack(): any;
32
+ /***
33
+ * Sets active audio track
34
+ * @param audioTrackId Audio track ID
35
+ */
23
36
  setAudioTrack(audioTrackId: number): any;
24
37
  }
@@ -20,14 +20,50 @@ import { PeriodMarker, PeriodMarkerConfig } from "../timeline/marker/period-mark
20
20
  import { Subject } from "rxjs";
21
21
  import { MarkerFocusEvent } from "../types";
22
22
  export interface MarkerLaneApi extends Api {
23
+ /***
24
+ * Fires on marker focus
25
+ */
23
26
  onMarkerFocus$: Subject<MarkerFocusEvent>;
27
+ /***
28
+ * Creates new MomentMarker instance and adds it to MarkerLane
29
+ * @param config MomentMarker configuration
30
+ */
24
31
  createMomentMarker(config: MomentMarkerConfig): MomentMarker;
32
+ /***
33
+ * Creates new PeriodMarker instance and adds it to MarkerLane
34
+ * @param config PeriodMarkern configuration
35
+ */
25
36
  createPeriodMarker(config: PeriodMarkerConfig): PeriodMarker;
37
+ /***
38
+ * Adds Marker to MarkerLane
39
+ * @param marker Marker instance
40
+ */
26
41
  addMarker(marker: GenericMarker): GenericMarker;
42
+ /***
43
+ * Returns Marker by ID
44
+ * @param id Marker ID
45
+ */
27
46
  getMarker(id: string): GenericMarker;
47
+ /***
48
+ * Returns all Marker's
49
+ */
28
50
  getMarkers(): GenericMarker[];
51
+ /***
52
+ * Removes Marker by ID
53
+ * @param id Marker ID
54
+ */
29
55
  removeMarker(id: string): void;
56
+ /***
57
+ * Removes all Marker's
58
+ */
30
59
  removeAllMarkers(): void;
60
+ /***
61
+ * Focuses Marker by ID
62
+ * @param id Marker ID
63
+ */
31
64
  focusMarker(id: string): void;
65
+ /***
66
+ * Returns Marker in focus
67
+ */
32
68
  getMarkerInFocus(): GenericMarker;
33
69
  }
@@ -26,13 +26,52 @@ import { TimelineApi } from "./timeline-api";
26
26
  import { OmakasePlayerStyle } from "../omakase-player";
27
27
  import { ComponentConfigStyleComposed } from "../common/component";
28
28
  export interface OmakasePlayerApi extends Api, OmakaseEventEmitter<OmakasePlayerEventMap> {
29
+ /***
30
+ * Loads new video
31
+ * @param videoSourceUrl Video manifest URL
32
+ * @param videoFrameRate Video frame rate
33
+ */
29
34
  loadVideo(videoSourceUrl: string, videoFrameRate: number): Observable<Video>;
35
+ /***
36
+ * Loads new video
37
+ *
38
+ * @param videoSourceUrl Video manifest URL
39
+ * @param videoFrameRate Video frame rate
40
+ * @param duration Video duration
41
+ */
42
+ loadVideo(videoSourceUrl: string, videoFrameRate: number, duration: number): Observable<Video>;
43
+ /***
44
+ * Creates Timeline
45
+ * @param config Timeline configuration
46
+ */
30
47
  createTimeline(config: Partial<ComponentConfigStyleComposed<TimelineConfig>>): Observable<Timeline>;
48
+ /***
49
+ * Returns OmakasePlayerStyle
50
+ */
31
51
  get style(): OmakasePlayerStyle;
52
+ /***
53
+ * Sets OmakasePlayerStyle
54
+ * @param value
55
+ */
32
56
  set style(value: Partial<OmakasePlayerStyle>);
57
+ /***
58
+ * Returns Timeline API
59
+ */
33
60
  get timeline(): TimelineApi;
61
+ /***
62
+ * Returns Video API
63
+ */
34
64
  get video(): VideoApi;
65
+ /***
66
+ * Returns Audio API
67
+ */
35
68
  get audio(): AudioApi;
69
+ /***
70
+ * Returns Subtitles API
71
+ */
36
72
  get subtitles(): SubtitlesApi;
73
+ /***
74
+ * Returns Omakase Player events enumeration
75
+ */
37
76
  get EVENTS(): OmakasePlayerEventsType;
38
77
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023 ByOmakase, LLC (https://byomaka se.org)
2
+ * Copyright 2023 ByOmakase, LLC (https://byomakase.org)
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -20,17 +20,60 @@ import { SubtitlesVttTrack } from "../track/subtitles-vtt-track";
20
20
  import { SubtitlesVttTrackConfig } from "../types/vtt";
21
21
  import { OmakaseTextTrack, OmakaseTextTrackCue } from "../types";
22
22
  export interface SubtitlesApi extends Api {
23
+ /***
24
+ * Fires on subtitles create
25
+ */
23
26
  onCreate$: Observable<SubtitlesEvent>;
27
+ /***
28
+ * Fires on subtitles remove
29
+ */
24
30
  onRemove$: Observable<SubtitlesEvent>;
31
+ /***
32
+ * Fires on subtitles show
33
+ */
25
34
  onShow$: Observable<SubtitlesEvent>;
35
+ /***
36
+ * Fires on subtitles hide
37
+ */
26
38
  onHide$: Observable<SubtitlesEvent>;
39
+ /***
40
+ * Creates new Subtitles VTT track
41
+ * @param config SubtitlesVttTrack configuration
42
+ */
27
43
  createVttTrack(config: SubtitlesVttTrackConfig): Observable<SubtitlesVttTrack>;
44
+ /***
45
+ * Returns all VTT tracks
46
+ */
28
47
  getTracks(): OmakaseTextTrack<OmakaseTextTrackCue>[];
48
+ /***
49
+ * Removes VTT track by ID
50
+ * @param id VTT track ID
51
+ */
29
52
  removeTrack(id: string): any;
53
+ /***
54
+ * Removes all VTT tracks
55
+ */
30
56
  removeAllTracks(): any;
57
+ /***
58
+ * Returns current active VTT track
59
+ */
31
60
  getCurrentTrack(): OmakaseTextTrack<OmakaseTextTrackCue> | undefined;
61
+ /***
62
+ * Shows active VTT track
63
+ */
32
64
  showTrack(): any;
65
+ /***
66
+ * Shows VTT track by ID
67
+ * @param id VTT track ID
68
+ */
33
69
  showTrack(id: string): any;
70
+ /***
71
+ * Hides active VTT track
72
+ */
34
73
  hideTrack(): any;
74
+ /***
75
+ * Hides VTT track by ID
76
+ * @param id VTT track ID
77
+ */
35
78
  hideTrack(id: string): any;
36
79
  }
@@ -25,7 +25,13 @@ import { SubtitlesLaneConfig } from "../timeline/subtitles/subtitles-lane";
25
25
  import { ScrubberLane } from "../timeline/scrubber-lane";
26
26
  import { Scrollbar } from "../timeline/scrollbar";
27
27
  export interface TimelineApi extends Api {
28
+ /***
29
+ * Fires on Timeline scroll
30
+ */
28
31
  onScroll$: Observable<TimelineScrollEvent>;
32
+ /***
33
+ * Fires on Timeline zoom
34
+ */
29
35
  onZoom$: Observable<TimelineZoomEvent>;
30
36
  get style(): TimelineStyle;
31
37
  /***
@@ -79,13 +85,48 @@ export interface TimelineApi extends Api {
79
85
  * @param id TimelineLane.id
80
86
  */
81
87
  getLane(id: string): GenericTimelaneLane;
88
+ /***
89
+ * Returns ScrubberLane instance
90
+ */
82
91
  getScrubberLane(): ScrubberLane;
92
+ /***
93
+ * Returns MarkerLane instance
94
+ * @param id MarkerLane ID
95
+ */
83
96
  getMarkerLane(id: string): MarkerLane;
97
+ /***
98
+ * Returns ThumbnailLane instance
99
+ * @param id ThumbnailLane ID
100
+ */
84
101
  getThumbnailLane(id: string): ThumbnailLane;
102
+ /***
103
+ * Returns SubtitlesLane instance
104
+ * @param id SubtitlesLane ID
105
+ */
85
106
  getSubtitlesLane(id: string): SubtitlesLane;
107
+ /***
108
+ * Returns AudioTrackLane instance
109
+ * @param id AudioTrackLane ID
110
+ */
86
111
  getAudioTrackLane(id: string): AudioTrackLane;
112
+ /***
113
+ * Creates new MarkerLane and adds it to Timeline
114
+ * @param config MarkerLane config
115
+ */
87
116
  createMarkerLane(config: MarkerLaneConfig): MarkerLane;
117
+ /***
118
+ * Creates new ThumbnailLane and adds it to Timeline
119
+ * @param config ThumbnailLane config
120
+ */
88
121
  createThumbnailLane(config: ThumbnailLaneConfig): ThumbnailLane;
122
+ /***
123
+ * Creates new SubtitlesLane and adds it to Timeline
124
+ * @param config SubtitlesLane config
125
+ */
89
126
  createSubtitlesLane(config: SubtitlesLaneConfig): SubtitlesLane;
127
+ /***
128
+ * Shows or hides Timeline left panel
129
+ * @param visible
130
+ */
90
131
  toggleLeftPanelVisible(visible: boolean): void;
91
132
  }
@@ -15,54 +15,198 @@
15
15
  */
16
16
  import { Api } from "./api";
17
17
  import { Observable } from "rxjs";
18
- import { AudioEvent, VideoEndedEvent, VideoLoadedEvent, VideoPlayEvent, VideoSeekedEvent, VideoSeekingEvent, VideoTimeChangeEvent } from "../types/events";
18
+ import { AudioEvent, HelpMenuGroup, VideoEndedEvent, VideoErrorEvent, VideoLoadedEvent, VideoPlayEvent, VideoSeekedEvent, VideoSeekingEvent, VideoTimeChangeEvent } from "../types";
19
19
  import { Video } from "../video/video";
20
20
  import Hls from "hls.js";
21
- import { HelpMenuGroup } from "../types";
22
21
  export interface VideoApi extends Api {
22
+ /***
23
+ * Fires on video load
24
+ */
23
25
  onVideoLoaded$: Observable<VideoLoadedEvent>;
26
+ /***
27
+ * Fires on video time change
28
+ */
24
29
  onVideoTimeChange$: Observable<VideoTimeChangeEvent>;
30
+ /***
31
+ * Fires on video play
32
+ */
25
33
  onPlay$: Observable<VideoPlayEvent>;
34
+ /***
35
+ * Fires on video pause
36
+ */
26
37
  onPause$: Observable<VideoPlayEvent>;
38
+ /***
39
+ * Fires on video seeking
40
+ */
27
41
  onSeeking$: Observable<VideoSeekingEvent>;
42
+ /***
43
+ * Fires on video seeked
44
+ */
28
45
  onSeeked$: Observable<VideoSeekedEvent>;
46
+ /***
47
+ * Fires on video end
48
+ */
29
49
  onEnded$: Observable<VideoEndedEvent>;
50
+ /***
51
+ * Fires on audio track switched
52
+ */
30
53
  onAudioSwitched$: Observable<AudioEvent>;
31
- loadVideo(sourceUrl: string, frameRate: number, duration?: number): Observable<Video>;
54
+ /***
55
+ * Fires on if error occurs on video load
56
+ */
57
+ onVideoError$: Observable<VideoErrorEvent>;
58
+ /***
59
+ * Indicates if video is loaded or not
60
+ */
32
61
  isVideoLoaded(): boolean;
62
+ /***
63
+ * Returns Video object that holds loaded video properties
64
+ */
33
65
  getVideo(): Video;
66
+ /***
67
+ * Returns HTML <video> element reference
68
+ */
34
69
  getHTMLVideoElement(): HTMLVideoElement;
70
+ /***
71
+ * Returns video duration. If duration is provided in omakasePlayer.loadVideo() method, method returns provided value. If duration is not provided in omakasePlayer.loadVideo() method, method returns HTML <video> element "duration" property
72
+ */
35
73
  getDuration(): number;
74
+ /***
75
+ * Returns video current time in seconds
76
+ */
36
77
  getCurrentTime(): number;
78
+ /***
79
+ * Returns video playback rate
80
+ */
37
81
  getPlaybackRate(): number;
82
+ /***
83
+ * Sets video playback rate
84
+ * @param playbackRate Decimal value between [0.1, 16]. For example, if provided value is "2", video playback rate will be 2x of normal playback rate
85
+ */
38
86
  setPlaybackRate(playbackRate: number): any;
87
+ /***
88
+ * Returns current volume level
89
+ */
39
90
  getVolume(): number;
91
+ /***
92
+ * Sets volume level
93
+ * @param volume Decimal value between [0, 1]
94
+ */
40
95
  setVolume(volume: number): any;
96
+ /***
97
+ * Returns current frame number
98
+ */
41
99
  getCurrentFrame(): number;
100
+ /***
101
+ * Returns video frame rate provided in omakasePlayer.loadVideo() method
102
+ */
42
103
  getFrameRate(): number;
104
+ /***
105
+ * Returns total number of frames in video
106
+ */
43
107
  getTotalFrames(): number;
108
+ /***
109
+ * Indicates if video is playing
110
+ */
44
111
  isPlaying(): boolean;
112
+ /***
113
+ * Indicates if video is paused
114
+ */
45
115
  isPaused(): boolean;
116
+ /***
117
+ * Indicates if video is seeking
118
+ */
46
119
  isSeeking(): boolean;
120
+ /***
121
+ * Starts video playback
122
+ */
47
123
  play(): void;
124
+ /***
125
+ * Pauses video playback
126
+ */
48
127
  pause(): void;
128
+ /***
129
+ * Toggles video play and pause
130
+ */
49
131
  togglePlayPause(): void;
132
+ /***
133
+ * Seeks to particular video frame. Video must be in non-playing mode.
134
+ * @param frame Video frame number
135
+ */
50
136
  seekToFrame(frame: number): Observable<boolean>;
137
+ /***
138
+ * Seeks to video frame offsetted by provided framesCount. Video must be in non-playing mode.
139
+ * @param framesCount Positive (seek forward) or negative (seek backward) integer
140
+ */
51
141
  seekFromCurrentFrame(framesCount: number): Observable<boolean>;
142
+ /***
143
+ * Seeks to previous video frame
144
+ */
52
145
  seekPreviousFrame(): Observable<boolean>;
146
+ /***
147
+ * Seeks to next video frame
148
+ */
53
149
  seekNextFrame(): Observable<boolean>;
54
- seekToTimestamp(currentTime: number): Observable<boolean>;
55
- formatTimestamp(currentTime: number): string;
150
+ /***
151
+ * Seeks to video timestamp
152
+ * @param time Video timestamp in seconds
153
+ */
154
+ seekToTimestamp(time: number): Observable<boolean>;
155
+ /***
156
+ * Formats video timestamp to HH:MM:SS:FF
157
+ * @param time Video timestamp in seconds
158
+ */
159
+ formatTimestamp(time: number): string;
160
+ /***
161
+ * Returns video frame number
162
+ * @param time Video timestamp in seconds
163
+ */
56
164
  calculateTimeToFrame(time: number): number;
165
+ /***
166
+ * Returns video timestamp in seconds
167
+ * @param framesCount Video frame number
168
+ */
57
169
  calculateFrameToTime(framesCount: number): number;
170
+ /***
171
+ * Video mute
172
+ */
58
173
  mute(): any;
174
+ /***
175
+ * Video unmute
176
+ */
59
177
  unmute(): any;
178
+ /***
179
+ * Indicates if video is in fullscreen mode
180
+ */
60
181
  isFullscreen(): boolean;
182
+ /***
183
+ * Toggles video fullscreen mode
184
+ */
61
185
  toggleFullscreen(): any;
186
+ /***
187
+ * Returns available audio tracks
188
+ */
62
189
  getAudioTracks(): any[];
190
+ /***
191
+ * Returns current active audio tracks
192
+ */
63
193
  getCurrentAudioTrack(): any;
194
+ /***
195
+ * Sets active audio track
196
+ * @param audioTrackId Audio track ID
197
+ */
64
198
  setAudioTrack(audioTrackId: number): any;
199
+ /***
200
+ * Returns Hls (hls.js) instance
201
+ */
65
202
  getHls(): Hls;
203
+ /***
204
+ * Adds new HelpMenuGroup to video context menu
205
+ * @param helpMenuGroup
206
+ */
66
207
  addHelpMenuGroup(helpMenuGroup: HelpMenuGroup): any;
208
+ /***
209
+ * Returns available HelpMenuGroup's
210
+ */
67
211
  getHelpMenuGroups(): HelpMenuGroup[];
68
212
  }
@@ -31,10 +31,12 @@ export declare class DomController {
31
31
  private divButtonPlay;
32
32
  private divButtonPause;
33
33
  private divButtonLoading;
34
+ private divButtonError;
34
35
  private divButtonReplay;
35
36
  private divButtonHelp;
36
37
  private divHelp;
37
38
  private divHelpMenu;
39
+ private divErrorMessage;
38
40
  private _timeline;
39
41
  constructor(playerHTMLElementId: string);
40
42
  private createDom;