@viostream/viostream-player-angular 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.
@@ -0,0 +1,360 @@
1
+ import * as i0 from '@angular/core';
2
+ import { output, signal, viewChild, inject, NgZone, Input, Component } from '@angular/core';
3
+ import { loadViostream, wrapRawPlayer } from '@viostream/viostream-player-core';
4
+ export { createViostreamPlayer, loadViostream } from '@viostream/viostream-player-core';
5
+
6
+ /**
7
+ * ViostreamPlayerComponent — Angular standalone component that embeds a Viostream video player.
8
+ *
9
+ * @example
10
+ * ```html
11
+ * <viostream-player
12
+ * [accountKey]="'vc-100100100'"
13
+ * [publicKey]="'nhedxonrxsyfee'"
14
+ * [displayTitle]="true"
15
+ * [sharing]="true"
16
+ * (play)="onPlay()"
17
+ * (timeUpdate)="onTimeUpdate($event)"
18
+ * (playerReady)="onPlayerReady($event)"
19
+ * />
20
+ * ```
21
+ */
22
+ class ViostreamPlayerComponent {
23
+ // ---------------------------------------------------------------------------
24
+ // Inputs (required)
25
+ // ---------------------------------------------------------------------------
26
+ /** Your Viostream account key (e.g. `'vc-100100100'`). */
27
+ accountKey;
28
+ /** The public key of the media asset to embed. */
29
+ publicKey;
30
+ // ---------------------------------------------------------------------------
31
+ // Inputs (embed options)
32
+ // ---------------------------------------------------------------------------
33
+ /** Display chapter markers. */
34
+ chapters;
35
+ /** Seek to a named chapter before playback begins. */
36
+ chapterSlug;
37
+ /** Show the video title overlay. */
38
+ displayTitle;
39
+ /** Show the HLS quality selector control. */
40
+ hlsQualitySelector;
41
+ /** Override the player theme/key to use. */
42
+ playerKey;
43
+ /** The player rendering style. */
44
+ playerStyle;
45
+ /** Show the sharing control. */
46
+ sharing;
47
+ /** Custom skin active colour (e.g. `'#000'`). Requires `skinCustom: true`. */
48
+ skinActive;
49
+ /** Custom skin background colour (e.g. `'#000'`). Requires `skinCustom: true`. */
50
+ skinBackground;
51
+ /** Enable a custom skin via the API. */
52
+ skinCustom;
53
+ /** Custom skin inactive colour (e.g. `'#000'`). Requires `skinCustom: true`. */
54
+ skinInactive;
55
+ /** Show the playback speed selector. */
56
+ speedSelector;
57
+ /** Play only a specific section of the video (e.g. `'10,30'`). */
58
+ startEndTimespan;
59
+ /** Seek to a specific time (in seconds) before playback begins. */
60
+ startTime;
61
+ /** Allow transcript download. */
62
+ transcriptDownload;
63
+ /** Enable the settings menu on the control bar. */
64
+ useSettingsMenu;
65
+ // ---------------------------------------------------------------------------
66
+ // Inputs (styling)
67
+ // ---------------------------------------------------------------------------
68
+ /** Optional CSS class applied to the outer wrapper `<div>`. */
69
+ cssClass;
70
+ // ---------------------------------------------------------------------------
71
+ // Outputs (player events)
72
+ // ---------------------------------------------------------------------------
73
+ /** Emitted when playback starts or resumes. */
74
+ play = output();
75
+ /** Emitted when playback is paused. */
76
+ pause = output();
77
+ /** Emitted when the media finishes playing. */
78
+ ended = output();
79
+ /** Emitted when the current playback time changes. */
80
+ timeUpdate = output();
81
+ /** Emitted when the volume changes. */
82
+ volumeChange = output();
83
+ /** Emitted when a player error occurs. Named `playerError` to avoid conflict with the native DOM `error` event. */
84
+ playerError = output();
85
+ /** Emitted on buffering progress. */
86
+ progress = output();
87
+ /** Emitted when the player is ready. */
88
+ ready = output();
89
+ /** Emitted when a seek operation completes. */
90
+ seeked = output();
91
+ /** Emitted when metadata has loaded. */
92
+ loaded = output();
93
+ /** Emitted once the player is ready, providing the `ViostreamPlayer` instance for programmatic control. */
94
+ playerReady = output();
95
+ // ---------------------------------------------------------------------------
96
+ // Internal state
97
+ // ---------------------------------------------------------------------------
98
+ /** Unique ID for the player container element. */
99
+ containerId = `viostream-player-${Math.random().toString(36).slice(2, 10)}`;
100
+ /** Whether the player is still loading. */
101
+ isLoading = signal(true);
102
+ /** Error message if loading failed. */
103
+ errorMsg = signal(undefined);
104
+ /** Reference to the container div. */
105
+ containerRef = viewChild('container');
106
+ /** The wrapped player instance. */
107
+ player;
108
+ /** Whether the component has been destroyed. */
109
+ destroyed = false;
110
+ /** Unsubscribe functions for event listeners. */
111
+ unsubscribers = [];
112
+ /** Angular zone for triggering change detection. */
113
+ ngZone = inject(NgZone);
114
+ // ---------------------------------------------------------------------------
115
+ // Lifecycle
116
+ // ---------------------------------------------------------------------------
117
+ ngOnInit() {
118
+ this.init();
119
+ }
120
+ ngOnDestroy() {
121
+ this.destroyed = true;
122
+ this.unwireEvents();
123
+ this.player?.destroy();
124
+ this.player = undefined;
125
+ }
126
+ // ---------------------------------------------------------------------------
127
+ // Private methods
128
+ // ---------------------------------------------------------------------------
129
+ async init() {
130
+ try {
131
+ const api = await loadViostream(this.accountKey);
132
+ if (this.destroyed)
133
+ return;
134
+ const embedOpts = this.buildEmbedOptions();
135
+ const raw = api.embed(this.publicKey, this.containerId, embedOpts);
136
+ const wrappedPlayer = wrapRawPlayer(raw, this.containerId);
137
+ if (this.destroyed) {
138
+ wrappedPlayer.destroy();
139
+ return;
140
+ }
141
+ this.player = wrappedPlayer;
142
+ // Run state updates inside NgZone to trigger change detection
143
+ this.ngZone.run(() => {
144
+ this.isLoading.set(false);
145
+ });
146
+ // Wire up event callbacks
147
+ this.wireEvents(wrappedPlayer);
148
+ // Notify consumer that the player is ready
149
+ this.playerReady.emit(wrappedPlayer);
150
+ }
151
+ catch (err) {
152
+ if (!this.destroyed) {
153
+ this.ngZone.run(() => {
154
+ this.errorMsg.set(err instanceof Error ? err.message : String(err));
155
+ this.isLoading.set(false);
156
+ });
157
+ }
158
+ }
159
+ }
160
+ buildEmbedOptions() {
161
+ const opts = {};
162
+ if (this.chapters !== undefined)
163
+ opts.chapters = this.chapters;
164
+ if (this.chapterSlug !== undefined)
165
+ opts.chapterSlug = this.chapterSlug;
166
+ if (this.displayTitle !== undefined)
167
+ opts.displayTitle = this.displayTitle;
168
+ if (this.hlsQualitySelector !== undefined)
169
+ opts.hlsQualitySelector = this.hlsQualitySelector;
170
+ if (this.playerKey !== undefined)
171
+ opts.playerKey = this.playerKey;
172
+ if (this.playerStyle !== undefined)
173
+ opts.playerStyle = this.playerStyle;
174
+ if (this.sharing !== undefined)
175
+ opts.sharing = this.sharing;
176
+ if (this.skinActive !== undefined)
177
+ opts.skinActive = this.skinActive;
178
+ if (this.skinBackground !== undefined)
179
+ opts.skinBackground = this.skinBackground;
180
+ if (this.skinCustom !== undefined)
181
+ opts.skinCustom = this.skinCustom;
182
+ if (this.skinInactive !== undefined)
183
+ opts.skinInactive = this.skinInactive;
184
+ if (this.speedSelector !== undefined)
185
+ opts.speedSelector = this.speedSelector;
186
+ if (this.startEndTimespan !== undefined)
187
+ opts.startEndTimespan = this.startEndTimespan;
188
+ if (this.startTime !== undefined)
189
+ opts.startTime = this.startTime;
190
+ if (this.transcriptDownload !== undefined)
191
+ opts.transcriptDownload = this.transcriptDownload;
192
+ if (this.useSettingsMenu !== undefined)
193
+ opts.useSettingsMenu = this.useSettingsMenu;
194
+ return opts;
195
+ }
196
+ /** Maps raw player event names to component output emitters. */
197
+ EVENT_MAP = [
198
+ ['play', () => this.ngZone.run(() => this.play.emit())],
199
+ ['pause', () => this.ngZone.run(() => this.pause.emit())],
200
+ ['ended', () => this.ngZone.run(() => this.ended.emit())],
201
+ ['timeupdate', (data) => this.ngZone.run(() => this.timeUpdate.emit(data))],
202
+ ['volumechange', (data) => this.ngZone.run(() => this.volumeChange.emit(data))],
203
+ ['error', (data) => this.ngZone.run(() => this.playerError.emit(data))],
204
+ ['progress', (data) => this.ngZone.run(() => this.progress.emit(data))],
205
+ ['ready', () => this.ngZone.run(() => this.ready.emit())],
206
+ ['seeked', () => this.ngZone.run(() => this.seeked.emit())],
207
+ ['loaded', () => this.ngZone.run(() => this.loaded.emit())],
208
+ ];
209
+ wireEvents(wrappedPlayer) {
210
+ for (const [eventName, handler] of this.EVENT_MAP) {
211
+ const unsub = wrappedPlayer.on(eventName, handler);
212
+ this.unsubscribers.push(unsub);
213
+ }
214
+ }
215
+ unwireEvents() {
216
+ for (const unsub of this.unsubscribers) {
217
+ unsub();
218
+ }
219
+ this.unsubscribers.length = 0;
220
+ }
221
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ViostreamPlayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
222
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ViostreamPlayerComponent, isStandalone: true, selector: "viostream-player", inputs: { accountKey: "accountKey", publicKey: "publicKey", chapters: "chapters", chapterSlug: "chapterSlug", displayTitle: "displayTitle", hlsQualitySelector: "hlsQualitySelector", playerKey: "playerKey", playerStyle: "playerStyle", sharing: "sharing", skinActive: "skinActive", skinBackground: "skinBackground", skinCustom: "skinCustom", skinInactive: "skinInactive", speedSelector: "speedSelector", startEndTimespan: "startEndTimespan", startTime: "startTime", transcriptDownload: "transcriptDownload", useSettingsMenu: "useSettingsMenu", cssClass: "cssClass" }, outputs: { play: "play", pause: "pause", ended: "ended", timeUpdate: "timeUpdate", volumeChange: "volumeChange", playerError: "playerError", progress: "progress", ready: "ready", seeked: "seeked", loaded: "loaded", playerReady: "playerReady" }, viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
223
+ <div
224
+ #container
225
+ [id]="containerId"
226
+ [class]="cssClass"
227
+ data-viostream-player
228
+ [attr.data-viostream-public-key]="publicKey"
229
+ >
230
+ @if (isLoading()) {
231
+ <ng-content select="[loading]" />
232
+ }
233
+
234
+ @if (errorMsg(); as msg) {
235
+ <div data-viostream-error style="color: red; padding: 1em;">
236
+ Failed to load Viostream player: {{ msg }}
237
+ </div>
238
+ }
239
+ </div>
240
+ `, isInline: true });
241
+ }
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ViostreamPlayerComponent, decorators: [{
243
+ type: Component,
244
+ args: [{
245
+ selector: 'viostream-player',
246
+ standalone: true,
247
+ template: `
248
+ <div
249
+ #container
250
+ [id]="containerId"
251
+ [class]="cssClass"
252
+ data-viostream-player
253
+ [attr.data-viostream-public-key]="publicKey"
254
+ >
255
+ @if (isLoading()) {
256
+ <ng-content select="[loading]" />
257
+ }
258
+
259
+ @if (errorMsg(); as msg) {
260
+ <div data-viostream-error style="color: red; padding: 1em;">
261
+ Failed to load Viostream player: {{ msg }}
262
+ </div>
263
+ }
264
+ </div>
265
+ `,
266
+ }]
267
+ }], propDecorators: { accountKey: [{
268
+ type: Input,
269
+ args: [{ required: true }]
270
+ }], publicKey: [{
271
+ type: Input,
272
+ args: [{ required: true }]
273
+ }], chapters: [{
274
+ type: Input
275
+ }], chapterSlug: [{
276
+ type: Input
277
+ }], displayTitle: [{
278
+ type: Input
279
+ }], hlsQualitySelector: [{
280
+ type: Input
281
+ }], playerKey: [{
282
+ type: Input
283
+ }], playerStyle: [{
284
+ type: Input
285
+ }], sharing: [{
286
+ type: Input
287
+ }], skinActive: [{
288
+ type: Input
289
+ }], skinBackground: [{
290
+ type: Input
291
+ }], skinCustom: [{
292
+ type: Input
293
+ }], skinInactive: [{
294
+ type: Input
295
+ }], speedSelector: [{
296
+ type: Input
297
+ }], startEndTimespan: [{
298
+ type: Input
299
+ }], startTime: [{
300
+ type: Input
301
+ }], transcriptDownload: [{
302
+ type: Input
303
+ }], useSettingsMenu: [{
304
+ type: Input
305
+ }], cssClass: [{
306
+ type: Input
307
+ }] } });
308
+
309
+ /**
310
+ * @viostream/viostream-player-angular
311
+ *
312
+ * Angular 17+ SDK for the Viostream video player.
313
+ *
314
+ * @example Component usage
315
+ * ```ts
316
+ * import { ViostreamPlayerComponent } from '@viostream/viostream-player-angular';
317
+ *
318
+ * @Component({
319
+ * selector: 'app-root',
320
+ * standalone: true,
321
+ * imports: [ViostreamPlayerComponent],
322
+ * template: `
323
+ * <viostream-player
324
+ * [accountKey]="'vc-100100100'"
325
+ * [publicKey]="'nhedxonrxsyfee'"
326
+ * [displayTitle]="true"
327
+ * (play)="onPlay()"
328
+ * />
329
+ * `,
330
+ * })
331
+ * export class AppComponent {
332
+ * onPlay() {
333
+ * console.log('playing');
334
+ * }
335
+ * }
336
+ * ```
337
+ *
338
+ * @example Headless / programmatic usage
339
+ * ```ts
340
+ * import { createViostreamPlayer } from '@viostream/viostream-player-angular';
341
+ *
342
+ * const player = await createViostreamPlayer({
343
+ * accountKey: 'vc-100100100',
344
+ * publicKey: 'nhedxonrxsyfee',
345
+ * target: 'my-video-div'
346
+ * });
347
+ *
348
+ * player.play();
349
+ * const time = await player.getCurrentTime();
350
+ * player.on('ended', () => console.log('done'));
351
+ * ```
352
+ */
353
+ // Component
354
+
355
+ /**
356
+ * Generated bundle index. Do not edit.
357
+ */
358
+
359
+ export { ViostreamPlayerComponent };
360
+ //# sourceMappingURL=viostream-viostream-player-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viostream-viostream-player-angular.mjs","sources":["../../src/viostream-player.component.ts","../../src/index.ts","../../src/viostream-viostream-player-angular.ts"],"sourcesContent":["/**\n * ViostreamPlayerComponent — Angular standalone component that embeds a Viostream video player.\n *\n * @example\n * ```html\n * <viostream-player\n * [accountKey]=\"'vc-100100100'\"\n * [publicKey]=\"'nhedxonrxsyfee'\"\n * [displayTitle]=\"true\"\n * [sharing]=\"true\"\n * (play)=\"onPlay()\"\n * (timeUpdate)=\"onTimeUpdate($event)\"\n * (playerReady)=\"onPlayerReady($event)\"\n * />\n * ```\n */\n\nimport {\n Component,\n Input,\n OnInit,\n OnDestroy,\n ElementRef,\n NgZone,\n inject,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { loadViostream, wrapRawPlayer } from '@viostream/viostream-player-core';\nimport type {\n ViostreamEmbedOptions,\n ViostreamPlayer,\n RawViostreamPlayerInstance,\n ViostreamEventHandler,\n ViostreamTimeUpdateData,\n ViostreamVolumeChangeData,\n ViostreamErrorData,\n ViostreamProgressData,\n} from '@viostream/viostream-player-core';\n\n@Component({\n selector: 'viostream-player',\n standalone: true,\n template: `\n <div\n #container\n [id]=\"containerId\"\n [class]=\"cssClass\"\n data-viostream-player\n [attr.data-viostream-public-key]=\"publicKey\"\n >\n @if (isLoading()) {\n <ng-content select=\"[loading]\" />\n }\n\n @if (errorMsg(); as msg) {\n <div data-viostream-error style=\"color: red; padding: 1em;\">\n Failed to load Viostream player: {{ msg }}\n </div>\n }\n </div>\n `,\n})\nexport class ViostreamPlayerComponent implements OnInit, OnDestroy {\n // ---------------------------------------------------------------------------\n // Inputs (required)\n // ---------------------------------------------------------------------------\n\n /** Your Viostream account key (e.g. `'vc-100100100'`). */\n @Input({ required: true }) accountKey!: string;\n /** The public key of the media asset to embed. */\n @Input({ required: true }) publicKey!: string;\n\n // ---------------------------------------------------------------------------\n // Inputs (embed options)\n // ---------------------------------------------------------------------------\n\n /** Display chapter markers. */\n @Input() chapters?: boolean;\n /** Seek to a named chapter before playback begins. */\n @Input() chapterSlug?: string;\n /** Show the video title overlay. */\n @Input() displayTitle?: boolean;\n /** Show the HLS quality selector control. */\n @Input() hlsQualitySelector?: boolean;\n /** Override the player theme/key to use. */\n @Input() playerKey?: string;\n /** The player rendering style. */\n @Input() playerStyle?: 'video' | 'audio' | 'audio-poster';\n /** Show the sharing control. */\n @Input() sharing?: boolean;\n /** Custom skin active colour (e.g. `'#000'`). Requires `skinCustom: true`. */\n @Input() skinActive?: string;\n /** Custom skin background colour (e.g. `'#000'`). Requires `skinCustom: true`. */\n @Input() skinBackground?: string;\n /** Enable a custom skin via the API. */\n @Input() skinCustom?: boolean;\n /** Custom skin inactive colour (e.g. `'#000'`). Requires `skinCustom: true`. */\n @Input() skinInactive?: string;\n /** Show the playback speed selector. */\n @Input() speedSelector?: boolean;\n /** Play only a specific section of the video (e.g. `'10,30'`). */\n @Input() startEndTimespan?: string;\n /** Seek to a specific time (in seconds) before playback begins. */\n @Input() startTime?: string;\n /** Allow transcript download. */\n @Input() transcriptDownload?: boolean;\n /** Enable the settings menu on the control bar. */\n @Input() useSettingsMenu?: boolean;\n\n // ---------------------------------------------------------------------------\n // Inputs (styling)\n // ---------------------------------------------------------------------------\n\n /** Optional CSS class applied to the outer wrapper `<div>`. */\n @Input() cssClass?: string;\n\n // ---------------------------------------------------------------------------\n // Outputs (player events)\n // ---------------------------------------------------------------------------\n\n /** Emitted when playback starts or resumes. */\n readonly play = output<void>();\n /** Emitted when playback is paused. */\n readonly pause = output<void>();\n /** Emitted when the media finishes playing. */\n readonly ended = output<void>();\n /** Emitted when the current playback time changes. */\n readonly timeUpdate = output<ViostreamTimeUpdateData>();\n /** Emitted when the volume changes. */\n readonly volumeChange = output<ViostreamVolumeChangeData>();\n /** Emitted when a player error occurs. Named `playerError` to avoid conflict with the native DOM `error` event. */\n readonly playerError = output<ViostreamErrorData>();\n /** Emitted on buffering progress. */\n readonly progress = output<ViostreamProgressData>();\n /** Emitted when the player is ready. */\n readonly ready = output<void>();\n /** Emitted when a seek operation completes. */\n readonly seeked = output<void>();\n /** Emitted when metadata has loaded. */\n readonly loaded = output<void>();\n /** Emitted once the player is ready, providing the `ViostreamPlayer` instance for programmatic control. */\n readonly playerReady = output<ViostreamPlayer>();\n\n // ---------------------------------------------------------------------------\n // Internal state\n // ---------------------------------------------------------------------------\n\n /** Unique ID for the player container element. */\n readonly containerId = `viostream-player-${Math.random().toString(36).slice(2, 10)}`;\n\n /** Whether the player is still loading. */\n readonly isLoading = signal(true);\n\n /** Error message if loading failed. */\n readonly errorMsg = signal<string | undefined>(undefined);\n\n /** Reference to the container div. */\n private readonly containerRef = viewChild<ElementRef<HTMLDivElement>>('container');\n\n /** The wrapped player instance. */\n private player: ViostreamPlayer | undefined;\n\n /** Whether the component has been destroyed. */\n private destroyed = false;\n\n /** Unsubscribe functions for event listeners. */\n private readonly unsubscribers: Array<() => void> = [];\n\n /** Angular zone for triggering change detection. */\n private readonly ngZone = inject(NgZone);\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n ngOnInit(): void {\n this.init();\n }\n\n ngOnDestroy(): void {\n this.destroyed = true;\n this.unwireEvents();\n this.player?.destroy();\n this.player = undefined;\n }\n\n // ---------------------------------------------------------------------------\n // Private methods\n // ---------------------------------------------------------------------------\n\n private async init(): Promise<void> {\n try {\n const api = await loadViostream(this.accountKey);\n\n if (this.destroyed) return;\n\n const embedOpts = this.buildEmbedOptions();\n const raw: RawViostreamPlayerInstance = api.embed(\n this.publicKey,\n this.containerId,\n embedOpts,\n );\n const wrappedPlayer = wrapRawPlayer(raw, this.containerId);\n\n if (this.destroyed) {\n wrappedPlayer.destroy();\n return;\n }\n\n this.player = wrappedPlayer;\n\n // Run state updates inside NgZone to trigger change detection\n this.ngZone.run(() => {\n this.isLoading.set(false);\n });\n\n // Wire up event callbacks\n this.wireEvents(wrappedPlayer);\n\n // Notify consumer that the player is ready\n this.playerReady.emit(wrappedPlayer);\n } catch (err) {\n if (!this.destroyed) {\n this.ngZone.run(() => {\n this.errorMsg.set(err instanceof Error ? err.message : String(err));\n this.isLoading.set(false);\n });\n }\n }\n }\n\n private buildEmbedOptions(): ViostreamEmbedOptions {\n const opts: ViostreamEmbedOptions = {};\n if (this.chapters !== undefined) opts.chapters = this.chapters;\n if (this.chapterSlug !== undefined) opts.chapterSlug = this.chapterSlug;\n if (this.displayTitle !== undefined) opts.displayTitle = this.displayTitle;\n if (this.hlsQualitySelector !== undefined) opts.hlsQualitySelector = this.hlsQualitySelector;\n if (this.playerKey !== undefined) opts.playerKey = this.playerKey;\n if (this.playerStyle !== undefined) opts.playerStyle = this.playerStyle;\n if (this.sharing !== undefined) opts.sharing = this.sharing;\n if (this.skinActive !== undefined) opts.skinActive = this.skinActive;\n if (this.skinBackground !== undefined) opts.skinBackground = this.skinBackground;\n if (this.skinCustom !== undefined) opts.skinCustom = this.skinCustom;\n if (this.skinInactive !== undefined) opts.skinInactive = this.skinInactive;\n if (this.speedSelector !== undefined) opts.speedSelector = this.speedSelector;\n if (this.startEndTimespan !== undefined) opts.startEndTimespan = this.startEndTimespan;\n if (this.startTime !== undefined) opts.startTime = this.startTime;\n if (this.transcriptDownload !== undefined) opts.transcriptDownload = this.transcriptDownload;\n if (this.useSettingsMenu !== undefined) opts.useSettingsMenu = this.useSettingsMenu;\n return opts;\n }\n\n /** Maps raw player event names to component output emitters. */\n private readonly EVENT_MAP: Array<[string, ViostreamEventHandler]> = [\n ['play', () => this.ngZone.run(() => this.play.emit())],\n ['pause', () => this.ngZone.run(() => this.pause.emit())],\n ['ended', () => this.ngZone.run(() => this.ended.emit())],\n ['timeupdate', (data: unknown) => this.ngZone.run(() => this.timeUpdate.emit(data as ViostreamTimeUpdateData))],\n ['volumechange', (data: unknown) => this.ngZone.run(() => this.volumeChange.emit(data as ViostreamVolumeChangeData))],\n ['error', (data: unknown) => this.ngZone.run(() => this.playerError.emit(data as ViostreamErrorData))],\n ['progress', (data: unknown) => this.ngZone.run(() => this.progress.emit(data as ViostreamProgressData))],\n ['ready', () => this.ngZone.run(() => this.ready.emit())],\n ['seeked', () => this.ngZone.run(() => this.seeked.emit())],\n ['loaded', () => this.ngZone.run(() => this.loaded.emit())],\n ];\n\n private wireEvents(wrappedPlayer: ViostreamPlayer): void {\n for (const [eventName, handler] of this.EVENT_MAP) {\n const unsub = wrappedPlayer.on(eventName, handler);\n this.unsubscribers.push(unsub);\n }\n }\n\n private unwireEvents(): void {\n for (const unsub of this.unsubscribers) {\n unsub();\n }\n this.unsubscribers.length = 0;\n }\n}\n","/**\n * @viostream/viostream-player-angular\n *\n * Angular 17+ SDK for the Viostream video player.\n *\n * @example Component usage\n * ```ts\n * import { ViostreamPlayerComponent } from '@viostream/viostream-player-angular';\n *\n * @Component({\n * selector: 'app-root',\n * standalone: true,\n * imports: [ViostreamPlayerComponent],\n * template: `\n * <viostream-player\n * [accountKey]=\"'vc-100100100'\"\n * [publicKey]=\"'nhedxonrxsyfee'\"\n * [displayTitle]=\"true\"\n * (play)=\"onPlay()\"\n * />\n * `,\n * })\n * export class AppComponent {\n * onPlay() {\n * console.log('playing');\n * }\n * }\n * ```\n *\n * @example Headless / programmatic usage\n * ```ts\n * import { createViostreamPlayer } from '@viostream/viostream-player-angular';\n *\n * const player = await createViostreamPlayer({\n * accountKey: 'vc-100100100',\n * publicKey: 'nhedxonrxsyfee',\n * target: 'my-video-div'\n * });\n *\n * player.play();\n * const time = await player.getCurrentTime();\n * player.on('ended', () => console.log('done'));\n * ```\n */\n\n// Component\nexport { ViostreamPlayerComponent } from './viostream-player.component';\n\n// Re-export everything from core so consumers can import from this package\nexport {\n createViostreamPlayer,\n loadViostream,\n} from '@viostream/viostream-player-core';\n\nexport type {\n CreateViostreamPlayerOptions,\n ViostreamEmbedOptions,\n ViostreamTimeUpdateData,\n ViostreamVolumeChangeData,\n ViostreamErrorData,\n ViostreamProgressData,\n ViostreamPlayerEventMap,\n ViostreamEventHandler,\n ViostreamPlayer as ViostreamPlayerInstance,\n} from '@viostream/viostream-player-core';\n\n// Angular-specific types\nexport type {\n ViostreamPlayerInputs,\n ViostreamPlayerEventProps,\n} from './types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;AAeG;MAiDU,wBAAwB,CAAA;;;;;AAMR,IAAA,UAAU;;AAEV,IAAA,SAAS;;;;;AAO3B,IAAA,QAAQ;;AAER,IAAA,WAAW;;AAEX,IAAA,YAAY;;AAEZ,IAAA,kBAAkB;;AAElB,IAAA,SAAS;;AAET,IAAA,WAAW;;AAEX,IAAA,OAAO;;AAEP,IAAA,UAAU;;AAEV,IAAA,cAAc;;AAEd,IAAA,UAAU;;AAEV,IAAA,YAAY;;AAEZ,IAAA,aAAa;;AAEb,IAAA,gBAAgB;;AAEhB,IAAA,SAAS;;AAET,IAAA,kBAAkB;;AAElB,IAAA,eAAe;;;;;AAOf,IAAA,QAAQ;;;;;IAOR,IAAI,GAAG,MAAM,EAAQ;;IAErB,KAAK,GAAG,MAAM,EAAQ;;IAEtB,KAAK,GAAG,MAAM,EAAQ;;IAEtB,UAAU,GA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AA;sBAAnB;gBAEQ,YAAY,EAAA,CAAA;sBAApB;gBAEQ,kBAAkB,EAAA,CAAA;sBAA1B;gBAEQ,SAAS,EAAA,CAAA;sBAAjB;gBAEQ,WAAW,EAAA,CAAA;sBAAnB;gBAEQ,OAAO,EAAA,CAAA;sBAAf;gBAEQ,UAAU,EAAA,CAAA;sBAAlB;gBAEQ,cAAc,EAAA,CAAA;sBAAtB;gBAEQ,UAAU,EAAA,CAAA;sBAAlB;gBAEQ,YAAY,EAAA,CAAA;sBAApB;gBAEQ,aAAa,EAAA,CAAA;sBAArB;gBAEQ,gBAAgB,EAAA,CAAA;sBAAxB;gBAEQ,SAAS,EAAA,CAAA;sBAAjB;gBAEQ,kBAAkB,EAAA,CAAA;sBAA1B;gBAEQ,eAAe,EAAA,CAAA;sBAAvB;gBAOQ,QAAQ,EAAA,CAAA;sBAAhB;;;ACpHH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CG;AAEH;;AC7CA;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @viostream/viostream-player-angular
3
+ *
4
+ * Angular 17+ SDK for the Viostream video player.
5
+ *
6
+ * @example Component usage
7
+ * ```ts
8
+ * import { ViostreamPlayerComponent } from '@viostream/viostream-player-angular';
9
+ *
10
+ * @Component({
11
+ * selector: 'app-root',
12
+ * standalone: true,
13
+ * imports: [ViostreamPlayerComponent],
14
+ * template: `
15
+ * <viostream-player
16
+ * [accountKey]="'vc-100100100'"
17
+ * [publicKey]="'nhedxonrxsyfee'"
18
+ * [displayTitle]="true"
19
+ * (play)="onPlay()"
20
+ * />
21
+ * `,
22
+ * })
23
+ * export class AppComponent {
24
+ * onPlay() {
25
+ * console.log('playing');
26
+ * }
27
+ * }
28
+ * ```
29
+ *
30
+ * @example Headless / programmatic usage
31
+ * ```ts
32
+ * import { createViostreamPlayer } from '@viostream/viostream-player-angular';
33
+ *
34
+ * const player = await createViostreamPlayer({
35
+ * accountKey: 'vc-100100100',
36
+ * publicKey: 'nhedxonrxsyfee',
37
+ * target: 'my-video-div'
38
+ * });
39
+ *
40
+ * player.play();
41
+ * const time = await player.getCurrentTime();
42
+ * player.on('ended', () => console.log('done'));
43
+ * ```
44
+ */
45
+ export { ViostreamPlayerComponent } from './viostream-player.component';
46
+ export { createViostreamPlayer, loadViostream, } from '@viostream/viostream-player-core';
47
+ export type { CreateViostreamPlayerOptions, ViostreamEmbedOptions, ViostreamTimeUpdateData, ViostreamVolumeChangeData, ViostreamErrorData, ViostreamProgressData, ViostreamPlayerEventMap, ViostreamEventHandler, ViostreamPlayer as ViostreamPlayerInstance, } from '@viostream/viostream-player-core';
48
+ export type { ViostreamPlayerInputs, ViostreamPlayerEventProps, } from './types';
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@viostream/viostream-player-angular",
3
+ "version": "0.1.2",
4
+ "description": "Angular 17+ SDK for the Viostream video player — embed, control, and listen to player events",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "type": "module",
10
+ "dependencies": {
11
+ "@viostream/viostream-player-core": "^0.2.1",
12
+ "tslib": "^2.8.0"
13
+ },
14
+ "peerDependencies": {
15
+ "@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0",
16
+ "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0"
17
+ },
18
+ "keywords": [
19
+ "angular",
20
+ "viostream",
21
+ "video",
22
+ "player",
23
+ "embed",
24
+ "sdk"
25
+ ],
26
+ "module": "fesm2022/viostream-viostream-player-angular.mjs",
27
+ "typings": "index.d.ts",
28
+ "exports": {
29
+ "./package.json": {
30
+ "default": "./package.json"
31
+ },
32
+ ".": {
33
+ "types": "./index.d.ts",
34
+ "default": "./fesm2022/viostream-viostream-player-angular.mjs"
35
+ }
36
+ },
37
+ "sideEffects": false
38
+ }
package/types.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Viostream Player SDK — Angular-specific type definitions
3
+ *
4
+ * Core types (ViostreamPlayer, ViostreamEmbedOptions, etc.) are re-exported from
5
+ * `@viostream/viostream-player-core`. This file defines only the Angular component types.
6
+ */
7
+ import type { ViostreamEmbedOptions, ViostreamTimeUpdateData, ViostreamVolumeChangeData, ViostreamErrorData, ViostreamProgressData } from '@viostream/viostream-player-core';
8
+ /** Event signatures emitted by the `<viostream-player>` component. */
9
+ export interface ViostreamPlayerEventProps {
10
+ play: void;
11
+ pause: void;
12
+ ended: void;
13
+ timeUpdate: ViostreamTimeUpdateData;
14
+ volumeChange: ViostreamVolumeChangeData;
15
+ playerError: ViostreamErrorData;
16
+ progress: ViostreamProgressData;
17
+ ready: void;
18
+ seeked: void;
19
+ loaded: void;
20
+ }
21
+ /** Input props accepted by the `<viostream-player>` component. */
22
+ export interface ViostreamPlayerInputs extends ViostreamEmbedOptions {
23
+ /** Your Viostream account key (e.g. `'vc-100100100'`). */
24
+ accountKey: string;
25
+ /** The public key of the media asset to embed. */
26
+ publicKey: string;
27
+ /**
28
+ * Optional CSS class applied to the outer wrapper `<div>`.
29
+ * Use `cssClass` instead of `class` to avoid Angular template conflicts.
30
+ */
31
+ cssClass?: string;
32
+ }
@@ -0,0 +1,107 @@
1
+ /**
2
+ * ViostreamPlayerComponent — Angular standalone component that embeds a Viostream video player.
3
+ *
4
+ * @example
5
+ * ```html
6
+ * <viostream-player
7
+ * [accountKey]="'vc-100100100'"
8
+ * [publicKey]="'nhedxonrxsyfee'"
9
+ * [displayTitle]="true"
10
+ * [sharing]="true"
11
+ * (play)="onPlay()"
12
+ * (timeUpdate)="onTimeUpdate($event)"
13
+ * (playerReady)="onPlayerReady($event)"
14
+ * />
15
+ * ```
16
+ */
17
+ import { OnInit, OnDestroy } from '@angular/core';
18
+ import type { ViostreamPlayer, ViostreamTimeUpdateData, ViostreamVolumeChangeData, ViostreamErrorData, ViostreamProgressData } from '@viostream/viostream-player-core';
19
+ import * as i0 from "@angular/core";
20
+ export declare class ViostreamPlayerComponent implements OnInit, OnDestroy {
21
+ /** Your Viostream account key (e.g. `'vc-100100100'`). */
22
+ accountKey: string;
23
+ /** The public key of the media asset to embed. */
24
+ publicKey: string;
25
+ /** Display chapter markers. */
26
+ chapters?: boolean;
27
+ /** Seek to a named chapter before playback begins. */
28
+ chapterSlug?: string;
29
+ /** Show the video title overlay. */
30
+ displayTitle?: boolean;
31
+ /** Show the HLS quality selector control. */
32
+ hlsQualitySelector?: boolean;
33
+ /** Override the player theme/key to use. */
34
+ playerKey?: string;
35
+ /** The player rendering style. */
36
+ playerStyle?: 'video' | 'audio' | 'audio-poster';
37
+ /** Show the sharing control. */
38
+ sharing?: boolean;
39
+ /** Custom skin active colour (e.g. `'#000'`). Requires `skinCustom: true`. */
40
+ skinActive?: string;
41
+ /** Custom skin background colour (e.g. `'#000'`). Requires `skinCustom: true`. */
42
+ skinBackground?: string;
43
+ /** Enable a custom skin via the API. */
44
+ skinCustom?: boolean;
45
+ /** Custom skin inactive colour (e.g. `'#000'`). Requires `skinCustom: true`. */
46
+ skinInactive?: string;
47
+ /** Show the playback speed selector. */
48
+ speedSelector?: boolean;
49
+ /** Play only a specific section of the video (e.g. `'10,30'`). */
50
+ startEndTimespan?: string;
51
+ /** Seek to a specific time (in seconds) before playback begins. */
52
+ startTime?: string;
53
+ /** Allow transcript download. */
54
+ transcriptDownload?: boolean;
55
+ /** Enable the settings menu on the control bar. */
56
+ useSettingsMenu?: boolean;
57
+ /** Optional CSS class applied to the outer wrapper `<div>`. */
58
+ cssClass?: string;
59
+ /** Emitted when playback starts or resumes. */
60
+ readonly play: import("@angular/core").OutputEmitterRef<void>;
61
+ /** Emitted when playback is paused. */
62
+ readonly pause: import("@angular/core").OutputEmitterRef<void>;
63
+ /** Emitted when the media finishes playing. */
64
+ readonly ended: import("@angular/core").OutputEmitterRef<void>;
65
+ /** Emitted when the current playback time changes. */
66
+ readonly timeUpdate: import("@angular/core").OutputEmitterRef<ViostreamTimeUpdateData>;
67
+ /** Emitted when the volume changes. */
68
+ readonly volumeChange: import("@angular/core").OutputEmitterRef<ViostreamVolumeChangeData>;
69
+ /** Emitted when a player error occurs. Named `playerError` to avoid conflict with the native DOM `error` event. */
70
+ readonly playerError: import("@angular/core").OutputEmitterRef<ViostreamErrorData>;
71
+ /** Emitted on buffering progress. */
72
+ readonly progress: import("@angular/core").OutputEmitterRef<ViostreamProgressData>;
73
+ /** Emitted when the player is ready. */
74
+ readonly ready: import("@angular/core").OutputEmitterRef<void>;
75
+ /** Emitted when a seek operation completes. */
76
+ readonly seeked: import("@angular/core").OutputEmitterRef<void>;
77
+ /** Emitted when metadata has loaded. */
78
+ readonly loaded: import("@angular/core").OutputEmitterRef<void>;
79
+ /** Emitted once the player is ready, providing the `ViostreamPlayer` instance for programmatic control. */
80
+ readonly playerReady: import("@angular/core").OutputEmitterRef<ViostreamPlayer>;
81
+ /** Unique ID for the player container element. */
82
+ readonly containerId: string;
83
+ /** Whether the player is still loading. */
84
+ readonly isLoading: import("@angular/core").WritableSignal<boolean>;
85
+ /** Error message if loading failed. */
86
+ readonly errorMsg: import("@angular/core").WritableSignal<string>;
87
+ /** Reference to the container div. */
88
+ private readonly containerRef;
89
+ /** The wrapped player instance. */
90
+ private player;
91
+ /** Whether the component has been destroyed. */
92
+ private destroyed;
93
+ /** Unsubscribe functions for event listeners. */
94
+ private readonly unsubscribers;
95
+ /** Angular zone for triggering change detection. */
96
+ private readonly ngZone;
97
+ ngOnInit(): void;
98
+ ngOnDestroy(): void;
99
+ private init;
100
+ private buildEmbedOptions;
101
+ /** Maps raw player event names to component output emitters. */
102
+ private readonly EVENT_MAP;
103
+ private wireEvents;
104
+ private unwireEvents;
105
+ static ɵfac: i0.ɵɵFactoryDeclaration<ViostreamPlayerComponent, never>;
106
+ static ɵcmp: i0.ɵɵComponentDeclaration<ViostreamPlayerComponent, "viostream-player", never, { "accountKey": { "alias": "accountKey"; "required": true; }; "publicKey": { "alias": "publicKey"; "required": true; }; "chapters": { "alias": "chapters"; "required": false; }; "chapterSlug": { "alias": "chapterSlug"; "required": false; }; "displayTitle": { "alias": "displayTitle"; "required": false; }; "hlsQualitySelector": { "alias": "hlsQualitySelector"; "required": false; }; "playerKey": { "alias": "playerKey"; "required": false; }; "playerStyle": { "alias": "playerStyle"; "required": false; }; "sharing": { "alias": "sharing"; "required": false; }; "skinActive": { "alias": "skinActive"; "required": false; }; "skinBackground": { "alias": "skinBackground"; "required": false; }; "skinCustom": { "alias": "skinCustom"; "required": false; }; "skinInactive": { "alias": "skinInactive"; "required": false; }; "speedSelector": { "alias": "speedSelector"; "required": false; }; "startEndTimespan": { "alias": "startEndTimespan"; "required": false; }; "startTime": { "alias": "startTime"; "required": false; }; "transcriptDownload": { "alias": "transcriptDownload"; "required": false; }; "useSettingsMenu": { "alias": "useSettingsMenu"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; }, { "play": "play"; "pause": "pause"; "ended": "ended"; "timeUpdate": "timeUpdate"; "volumeChange": "volumeChange"; "playerError": "playerError"; "progress": "progress"; "ready": "ready"; "seeked": "seeked"; "loaded": "loaded"; "playerReady": "playerReady"; }, never, ["[loading]"], true, never>;
107
+ }