@viostream/viostream-player-angular 0.1.7 → 0.1.8
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.
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { output, signal, viewChild, inject, NgZone, Input, Component } from '@angular/core';
|
|
3
|
+
import Debug from 'debug';
|
|
3
4
|
import { getViostreamApi, wrapRawPlayer } from '@viostream/viostream-player-core';
|
|
4
5
|
export { createViostreamPlayer, loadViostream } from '@viostream/viostream-player-core';
|
|
5
6
|
|
|
6
7
|
// Auto-generated by scripts/sync-version.mjs — do not edit
|
|
7
8
|
const SDK_NAME = 'viostream-player-angular';
|
|
8
|
-
const SDK_VERSION = '0.1.
|
|
9
|
+
const SDK_VERSION = '0.1.8';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* ViostreamPlayerComponent — Angular standalone component that embeds a Viostream video player.
|
|
@@ -23,6 +24,7 @@ const SDK_VERSION = '0.1.7';
|
|
|
23
24
|
* />
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
27
|
+
const debug = Debug('viostream:angular');
|
|
26
28
|
class ViostreamPlayerComponent {
|
|
27
29
|
// ---------------------------------------------------------------------------
|
|
28
30
|
// Inputs (required)
|
|
@@ -121,9 +123,11 @@ class ViostreamPlayerComponent {
|
|
|
121
123
|
// Lifecycle
|
|
122
124
|
// ---------------------------------------------------------------------------
|
|
123
125
|
ngOnInit() {
|
|
126
|
+
debug('ngOnInit publicKey=%s accountKey=%s containerId=%s', this.publicKey, this.accountKey, this.containerId);
|
|
124
127
|
this.init();
|
|
125
128
|
}
|
|
126
129
|
ngOnDestroy() {
|
|
130
|
+
debug('ngOnDestroy publicKey=%s hasPlayer=%s', this.publicKey, !!this.player);
|
|
127
131
|
this.destroyed = true;
|
|
128
132
|
this.unwireEvents();
|
|
129
133
|
this.player?.destroy();
|
|
@@ -134,13 +138,20 @@ class ViostreamPlayerComponent {
|
|
|
134
138
|
// ---------------------------------------------------------------------------
|
|
135
139
|
async init() {
|
|
136
140
|
try {
|
|
141
|
+
debug('init: getting embed API');
|
|
137
142
|
const api = getViostreamApi();
|
|
138
|
-
if (this.destroyed)
|
|
143
|
+
if (this.destroyed) {
|
|
144
|
+
debug('init: destroyed detected after getViostreamApi — aborting publicKey=%s', this.publicKey);
|
|
139
145
|
return;
|
|
146
|
+
}
|
|
140
147
|
const embedOpts = this.buildEmbedOptions();
|
|
148
|
+
debug('init: calling api.embed publicKey=%s containerId=%s options=%o', this.publicKey, this.containerId, embedOpts);
|
|
141
149
|
const raw = api.embed(this.publicKey, this.containerId, embedOpts);
|
|
150
|
+
debug('init: api.embed returned raw player');
|
|
142
151
|
const wrappedPlayer = wrapRawPlayer(raw, this.containerId);
|
|
152
|
+
debug('init: wrapRawPlayer completed containerId=%s', this.containerId);
|
|
143
153
|
if (this.destroyed) {
|
|
154
|
+
debug('init: destroyed detected after wrapRawPlayer — destroying and aborting publicKey=%s', this.publicKey);
|
|
144
155
|
wrappedPlayer.destroy();
|
|
145
156
|
return;
|
|
146
157
|
}
|
|
@@ -149,18 +160,25 @@ class ViostreamPlayerComponent {
|
|
|
149
160
|
this.ngZone.run(() => {
|
|
150
161
|
this.isLoading.set(false);
|
|
151
162
|
});
|
|
163
|
+
debug('init: player set, isLoading -> false publicKey=%s', this.publicKey);
|
|
152
164
|
// Wire up event callbacks
|
|
153
165
|
this.wireEvents(wrappedPlayer);
|
|
154
166
|
// Notify consumer that the player is ready
|
|
167
|
+
debug('init: emitting playerReady publicKey=%s', this.publicKey);
|
|
155
168
|
this.playerReady.emit(wrappedPlayer);
|
|
156
169
|
}
|
|
157
170
|
catch (err) {
|
|
158
171
|
if (!this.destroyed) {
|
|
172
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
173
|
+
debug('init: error caught publicKey=%s error=%s', this.publicKey, msg);
|
|
159
174
|
this.ngZone.run(() => {
|
|
160
|
-
this.errorMsg.set(
|
|
175
|
+
this.errorMsg.set(msg);
|
|
161
176
|
this.isLoading.set(false);
|
|
162
177
|
});
|
|
163
178
|
}
|
|
179
|
+
else {
|
|
180
|
+
debug('init: error caught but destroyed — ignoring publicKey=%s', this.publicKey);
|
|
181
|
+
}
|
|
164
182
|
}
|
|
165
183
|
}
|
|
166
184
|
buildEmbedOptions() {
|
|
@@ -213,12 +231,16 @@ class ViostreamPlayerComponent {
|
|
|
213
231
|
['loaded', () => this.ngZone.run(() => this.loaded.emit())],
|
|
214
232
|
];
|
|
215
233
|
wireEvents(wrappedPlayer) {
|
|
234
|
+
const wiredEvents = [];
|
|
216
235
|
for (const [eventName, handler] of this.EVENT_MAP) {
|
|
217
236
|
const unsub = wrappedPlayer.on(eventName, handler);
|
|
218
237
|
this.unsubscribers.push(unsub);
|
|
238
|
+
wiredEvents.push(eventName);
|
|
219
239
|
}
|
|
240
|
+
debug('wireEvents: subscribed to [%s]', wiredEvents.join(', '));
|
|
220
241
|
}
|
|
221
242
|
unwireEvents() {
|
|
243
|
+
debug('unwireEvents: unsubscribing %d events', this.unsubscribers.length);
|
|
222
244
|
for (const unsub of this.unsubscribers) {
|
|
223
245
|
unsub();
|
|
224
246
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viostream-viostream-player-angular.mjs","sources":["../../src/version.ts","../../src/viostream-player.component.ts","../../src/index.ts","../../src/viostream-viostream-player-angular.ts"],"sourcesContent":["// Auto-generated by scripts/sync-version.mjs — do not edit\nexport const SDK_NAME = 'viostream-player-angular';\nexport const SDK_VERSION = '0.1.7';\n","/**\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 { getViostreamApi, 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';\nimport { SDK_NAME, SDK_VERSION } from './version';\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 [attr.data-viostream-sdk]=\"sdkTag\"\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 /** SDK identifier stamped as a data attribute on the container. */\n readonly sdkTag = `${SDK_NAME}@${SDK_VERSION}`;\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 = getViostreamApi();\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;AACO,MAAM,QAAQ,GAAG,0BAA0B;AAC3C,MAAM,WAAW,GA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EH;;AC7CA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"viostream-viostream-player-angular.mjs","sources":["../../src/version.ts","../../src/viostream-player.component.ts","../../src/index.ts","../../src/viostream-viostream-player-angular.ts"],"sourcesContent":["// Auto-generated by scripts/sync-version.mjs — do not edit\nexport const SDK_NAME = 'viostream-player-angular';\nexport const SDK_VERSION = '0.1.8';\n","/**\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 Debug from 'debug';\nimport { getViostreamApi, 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';\nimport { SDK_NAME, SDK_VERSION } from './version';\n\nconst debug = Debug('viostream:angular');\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 [attr.data-viostream-sdk]=\"sdkTag\"\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 /** SDK identifier stamped as a data attribute on the container. */\n readonly sdkTag = `${SDK_NAME}@${SDK_VERSION}`;\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 debug('ngOnInit publicKey=%s accountKey=%s containerId=%s', this.publicKey, this.accountKey, this.containerId);\n this.init();\n }\n\n ngOnDestroy(): void {\n debug('ngOnDestroy publicKey=%s hasPlayer=%s', this.publicKey, !!this.player);\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 debug('init: getting embed API');\n const api = getViostreamApi();\n\n if (this.destroyed) {\n debug('init: destroyed detected after getViostreamApi — aborting publicKey=%s', this.publicKey);\n return;\n }\n\n const embedOpts = this.buildEmbedOptions();\n debug('init: calling api.embed publicKey=%s containerId=%s options=%o', this.publicKey, this.containerId, embedOpts);\n const raw: RawViostreamPlayerInstance = api.embed(\n this.publicKey,\n this.containerId,\n embedOpts,\n );\n debug('init: api.embed returned raw player');\n\n const wrappedPlayer = wrapRawPlayer(raw, this.containerId);\n debug('init: wrapRawPlayer completed containerId=%s', this.containerId);\n\n if (this.destroyed) {\n debug('init: destroyed detected after wrapRawPlayer — destroying and aborting publicKey=%s', this.publicKey);\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 debug('init: player set, isLoading -> false publicKey=%s', this.publicKey);\n\n // Wire up event callbacks\n this.wireEvents(wrappedPlayer);\n\n // Notify consumer that the player is ready\n debug('init: emitting playerReady publicKey=%s', this.publicKey);\n this.playerReady.emit(wrappedPlayer);\n } catch (err) {\n if (!this.destroyed) {\n const msg = err instanceof Error ? err.message : String(err);\n debug('init: error caught publicKey=%s error=%s', this.publicKey, msg);\n this.ngZone.run(() => {\n this.errorMsg.set(msg);\n this.isLoading.set(false);\n });\n } else {\n debug('init: error caught but destroyed — ignoring publicKey=%s', this.publicKey);\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 const wiredEvents: string[] = [];\n for (const [eventName, handler] of this.EVENT_MAP) {\n const unsub = wrappedPlayer.on(eventName, handler);\n this.unsubscribers.push(unsub);\n wiredEvents.push(eventName);\n }\n debug('wireEvents: subscribed to [%s]', wiredEvents.join(', '));\n }\n\n private unwireEvents(): void {\n debug('unwireEvents: unsubscribing %d events', this.unsubscribers.length);\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;AACO,MAAM,QAAQ,GAAG,0BAA0B;AAC3C,MAAM,WAAW,GAAG,OAAO;;ACFlC;;;;;;;;;;;;;;;AAeG;AA4BH,MAA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ostream-player-angular",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Angular 17+ SDK for the Viostream video player — embed, control, and listen to player events",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@viostream/viostream-player-core": "^0.2.
|
|
11
|
+
"@viostream/viostream-player-core": "^0.2.7",
|
|
12
|
+
"debug": "^4.4.3",
|
|
12
13
|
"tslib": "^2.8.0"
|
|
13
14
|
},
|
|
14
15
|
"peerDependencies": {
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const SDK_NAME = "viostream-player-angular";
|
|
2
|
-
export declare const SDK_VERSION = "0.1.
|
|
2
|
+
export declare const SDK_VERSION = "0.1.8";
|
|
@@ -81,7 +81,7 @@ export declare class ViostreamPlayerComponent implements OnInit, OnDestroy {
|
|
|
81
81
|
/** Unique ID for the player container element. */
|
|
82
82
|
readonly containerId: string;
|
|
83
83
|
/** SDK identifier stamped as a data attribute on the container. */
|
|
84
|
-
readonly sdkTag = "viostream-player-angular@0.1.
|
|
84
|
+
readonly sdkTag = "viostream-player-angular@0.1.8";
|
|
85
85
|
/** Whether the player is still loading. */
|
|
86
86
|
readonly isLoading: import("@angular/core").WritableSignal<boolean>;
|
|
87
87
|
/** Error message if loading failed. */
|