@codenkay/video-nsgplayer-angular 3.0.0 → 4.0.0
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.
- package/CHANGELOG.md +19 -0
- package/README.md +14 -2
- package/dist/LICENSE +21 -0
- package/dist/README.md +39 -0
- package/dist/fesm2022/codenkay-video-nsgplayer-angular.mjs +141 -0
- package/dist/fesm2022/codenkay-video-nsgplayer-angular.mjs.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/lib/nsg-video-player.component.d.ts +5 -2
- package/package.json +26 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1
- package/dist/lib/nsg-video-player.component.d.ts.map +0 -1
- package/dist/lib/nsg-video-player.component.js +0 -121
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Fix minor issues
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @codenkay/video-nsgplayer-core@4.0.0
|
|
13
|
+
|
|
14
|
+
## 3.0.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Preserve "use client" in React/UI builds, forward analytics, intermittent watermark, Angular Ivy packaging, and packaging metadata.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @codenkay/video-nsgplayer-core@3.0.4
|
|
21
|
+
|
|
3
22
|
## 3.0.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @codenkay/video-nsgplayer-angular
|
|
2
2
|
|
|
3
|
-
Angular standalone component for `@codenkay/video-nsgplayer-core`.
|
|
3
|
+
Angular **headless** standalone component for `@codenkay/video-nsgplayer-core`.
|
|
4
|
+
|
|
5
|
+
This package mounts a `<video>` element and applies theme CSS variables. It does **not** ship control chrome (seek bar, quality menu, live badge, etc.). Use `getPlayer()` and the core runtime API to build your own Angular UI, or use `@codenkay/video-nsgplayer-ui` in React apps.
|
|
4
6
|
|
|
5
7
|
```html
|
|
6
8
|
<nsg-video-player
|
|
@@ -8,6 +10,7 @@ Angular standalone component for `@codenkay/video-nsgplayer-core`.
|
|
|
8
10
|
[auth]="authConfig"
|
|
9
11
|
[playback]="playbackConfig"
|
|
10
12
|
[config]="playerConfig"
|
|
13
|
+
[analytics]="analyticsConfig"
|
|
11
14
|
(ready)="onReady()"
|
|
12
15
|
(error)="onError($event)"
|
|
13
16
|
(autherror)="onAuthError($event)">
|
|
@@ -24,4 +27,13 @@ import { NsgVideoPlayerComponent } from "@codenkay/video-nsgplayer-angular";
|
|
|
24
27
|
export class MyPage {}
|
|
25
28
|
```
|
|
26
29
|
|
|
27
|
-
Requires Angular 17
|
|
30
|
+
Requires Angular 17+, `rxjs` ^7, and `hls.js`. Same `PlayerConfig` shape as the React package.
|
|
31
|
+
|
|
32
|
+
## Samples
|
|
33
|
+
|
|
34
|
+
| Lab | Repo | Port |
|
|
35
|
+
|-----|------|------|
|
|
36
|
+
| Angular headless playground | [nsgplayer-sample-angular](https://github.com/codenannu/nsgplayer-sample-angular) | 4200 |
|
|
37
|
+
| Optional BFF (auth / signed URL) | [nsgplayer-sample-nextjs](https://github.com/codenannu/nsgplayer-sample-nextjs) | 3001 |
|
|
38
|
+
|
|
39
|
+
Index and clone commands: [docs/samples.md](../../docs/samples.md).
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) NSG Player
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @codenkay/video-nsgplayer-angular
|
|
2
|
+
|
|
3
|
+
Angular **headless** standalone component for `@codenkay/video-nsgplayer-core`.
|
|
4
|
+
|
|
5
|
+
This package mounts a `<video>` element and applies theme CSS variables. It does **not** ship control chrome (seek bar, quality menu, live badge, etc.). Use `getPlayer()` and the core runtime API to build your own Angular UI, or use `@codenkay/video-nsgplayer-ui` in React apps.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<nsg-video-player
|
|
9
|
+
[videoId]="videoId"
|
|
10
|
+
[auth]="authConfig"
|
|
11
|
+
[playback]="playbackConfig"
|
|
12
|
+
[config]="playerConfig"
|
|
13
|
+
[analytics]="analyticsConfig"
|
|
14
|
+
(ready)="onReady()"
|
|
15
|
+
(error)="onError($event)"
|
|
16
|
+
(autherror)="onAuthError($event)">
|
|
17
|
+
</nsg-video-player>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { NsgVideoPlayerComponent } from "@codenkay/video-nsgplayer-angular";
|
|
22
|
+
|
|
23
|
+
@Component({
|
|
24
|
+
imports: [NsgVideoPlayerComponent],
|
|
25
|
+
// ...
|
|
26
|
+
})
|
|
27
|
+
export class MyPage {}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Requires Angular 17+, `rxjs` ^7, and `hls.js`. Same `PlayerConfig` shape as the React package.
|
|
31
|
+
|
|
32
|
+
## Samples
|
|
33
|
+
|
|
34
|
+
| Lab | Repo | Port |
|
|
35
|
+
|-----|------|------|
|
|
36
|
+
| Angular headless playground | [nsgplayer-sample-angular](https://github.com/codenannu/nsgplayer-sample-angular) | 4200 |
|
|
37
|
+
| Optional BFF (auth / signed URL) | [nsgplayer-sample-nextjs](https://github.com/codenannu/nsgplayer-sample-nextjs) | 3001 |
|
|
38
|
+
|
|
39
|
+
Index and clone commands: [docs/samples.md](../../docs/samples.md).
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { output, Input, ViewChild, Component } from '@angular/core';
|
|
3
|
+
import { mergePlayerConfig, createVideoPlayer, themeToCssVars } from '@codenkay/video-nsgplayer-core';
|
|
4
|
+
|
|
5
|
+
class NsgVideoPlayerComponent {
|
|
6
|
+
videoRef;
|
|
7
|
+
containerRef;
|
|
8
|
+
videoId;
|
|
9
|
+
auth;
|
|
10
|
+
playback;
|
|
11
|
+
sourceUrl;
|
|
12
|
+
config;
|
|
13
|
+
analytics;
|
|
14
|
+
ready = output();
|
|
15
|
+
error = output();
|
|
16
|
+
play = output();
|
|
17
|
+
pause = output();
|
|
18
|
+
autherror = output();
|
|
19
|
+
player = null;
|
|
20
|
+
viewReady = false;
|
|
21
|
+
ngAfterViewInit() {
|
|
22
|
+
this.viewReady = true;
|
|
23
|
+
this.recreate();
|
|
24
|
+
}
|
|
25
|
+
ngOnChanges(changes) {
|
|
26
|
+
if (!this.viewReady)
|
|
27
|
+
return;
|
|
28
|
+
if (changes["videoId"] ||
|
|
29
|
+
changes["sourceUrl"] ||
|
|
30
|
+
changes["auth"] ||
|
|
31
|
+
changes["playback"] ||
|
|
32
|
+
changes["analytics"]) {
|
|
33
|
+
this.recreate();
|
|
34
|
+
}
|
|
35
|
+
else if (changes["config"] && this.player) {
|
|
36
|
+
this.player.updateConfig(this.config);
|
|
37
|
+
this.applyTheme();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
ngOnDestroy() {
|
|
41
|
+
this.player?.destroy();
|
|
42
|
+
this.player = null;
|
|
43
|
+
}
|
|
44
|
+
getPlayer() {
|
|
45
|
+
return this.player;
|
|
46
|
+
}
|
|
47
|
+
recreate() {
|
|
48
|
+
this.player?.destroy();
|
|
49
|
+
const video = this.videoRef?.nativeElement;
|
|
50
|
+
if (!video)
|
|
51
|
+
return;
|
|
52
|
+
const resolved = mergePlayerConfig(this.config);
|
|
53
|
+
this.player = createVideoPlayer({
|
|
54
|
+
videoId: this.videoId,
|
|
55
|
+
mount: video,
|
|
56
|
+
auth: this.auth,
|
|
57
|
+
playback: this.playback,
|
|
58
|
+
sourceUrl: this.sourceUrl,
|
|
59
|
+
player: resolved.player,
|
|
60
|
+
controls: resolved.controls,
|
|
61
|
+
theme: resolved.theme,
|
|
62
|
+
watermark: resolved.watermark,
|
|
63
|
+
streaming: resolved.streaming,
|
|
64
|
+
logging: resolved.logging,
|
|
65
|
+
debug: resolved.debug,
|
|
66
|
+
analytics: this.analytics,
|
|
67
|
+
accessibility: resolved.accessibility,
|
|
68
|
+
});
|
|
69
|
+
this.player.on("ready", () => this.ready.emit());
|
|
70
|
+
this.player.on("error", (e) => this.error.emit(e));
|
|
71
|
+
this.player.on("play", () => this.play.emit());
|
|
72
|
+
this.player.on("pause", () => this.pause.emit());
|
|
73
|
+
this.player.on("autherror", (e) => this.autherror.emit(e));
|
|
74
|
+
this.applyTheme();
|
|
75
|
+
}
|
|
76
|
+
applyTheme() {
|
|
77
|
+
const resolved = mergePlayerConfig(this.config);
|
|
78
|
+
const vars = themeToCssVars(resolved.theme);
|
|
79
|
+
const el = this.containerRef?.nativeElement;
|
|
80
|
+
if (!el)
|
|
81
|
+
return;
|
|
82
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
83
|
+
el.style.setProperty(key, value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: NsgVideoPlayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
87
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: NsgVideoPlayerComponent, isStandalone: true, selector: "nsg-video-player", inputs: { videoId: "videoId", auth: "auth", playback: "playback", sourceUrl: "sourceUrl", config: "config", analytics: "analytics" }, outputs: { ready: "ready", error: "error", play: "play", pause: "pause", autherror: "autherror" }, viewQueries: [{ propertyName: "videoRef", first: true, predicate: ["video"], descendants: true, static: true }, { propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
|
|
88
|
+
<div
|
|
89
|
+
#container
|
|
90
|
+
data-player-theme
|
|
91
|
+
[style.width]="'100%'"
|
|
92
|
+
[style.position]="'relative'"
|
|
93
|
+
[style.background]="'#000'"
|
|
94
|
+
>
|
|
95
|
+
<video #video playsinline style="width:100%;display:block"></video>
|
|
96
|
+
</div>
|
|
97
|
+
`, isInline: true });
|
|
98
|
+
}
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: NsgVideoPlayerComponent, decorators: [{
|
|
100
|
+
type: Component,
|
|
101
|
+
args: [{
|
|
102
|
+
selector: "nsg-video-player",
|
|
103
|
+
standalone: true,
|
|
104
|
+
template: `
|
|
105
|
+
<div
|
|
106
|
+
#container
|
|
107
|
+
data-player-theme
|
|
108
|
+
[style.width]="'100%'"
|
|
109
|
+
[style.position]="'relative'"
|
|
110
|
+
[style.background]="'#000'"
|
|
111
|
+
>
|
|
112
|
+
<video #video playsinline style="width:100%;display:block"></video>
|
|
113
|
+
</div>
|
|
114
|
+
`,
|
|
115
|
+
}]
|
|
116
|
+
}], propDecorators: { videoRef: [{
|
|
117
|
+
type: ViewChild,
|
|
118
|
+
args: ["video", { static: true }]
|
|
119
|
+
}], containerRef: [{
|
|
120
|
+
type: ViewChild,
|
|
121
|
+
args: ["container", { static: true }]
|
|
122
|
+
}], videoId: [{
|
|
123
|
+
type: Input
|
|
124
|
+
}], auth: [{
|
|
125
|
+
type: Input
|
|
126
|
+
}], playback: [{
|
|
127
|
+
type: Input
|
|
128
|
+
}], sourceUrl: [{
|
|
129
|
+
type: Input
|
|
130
|
+
}], config: [{
|
|
131
|
+
type: Input
|
|
132
|
+
}], analytics: [{
|
|
133
|
+
type: Input
|
|
134
|
+
}] } });
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Generated bundle index. Do not edit.
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
export { NsgVideoPlayerComponent };
|
|
141
|
+
//# sourceMappingURL=codenkay-video-nsgplayer-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codenkay-video-nsgplayer-angular.mjs","sources":["../../src/lib/nsg-video-player.component.ts","../../src/codenkay-video-nsgplayer-angular.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n SimpleChanges,\n ViewChild,\n output,\n} from \"@angular/core\";\nimport {\n createVideoPlayer,\n mergePlayerConfig,\n themeToCssVars,\n type AnalyticsConfig,\n type AuthConfig,\n type PlaybackCredentialConfig,\n type VideoPlayer,\n} from \"@codenkay/video-nsgplayer-core\";\n\n@Component({\n selector: \"nsg-video-player\",\n standalone: true,\n template: `\n <div\n #container\n data-player-theme\n [style.width]=\"'100%'\"\n [style.position]=\"'relative'\"\n [style.background]=\"'#000'\"\n >\n <video #video playsinline style=\"width:100%;display:block\"></video>\n </div>\n `,\n})\nexport class NsgVideoPlayerComponent\n implements AfterViewInit, OnChanges, OnDestroy\n{\n @ViewChild(\"video\", { static: true })\n videoRef!: ElementRef<HTMLVideoElement>;\n\n @ViewChild(\"container\", { static: true })\n containerRef!: ElementRef<HTMLDivElement>;\n\n @Input() videoId?: string;\n @Input() auth?: AuthConfig;\n @Input() playback?: PlaybackCredentialConfig;\n @Input() sourceUrl?: string;\n @Input() config?: Parameters<typeof mergePlayerConfig>[0];\n @Input() analytics?: AnalyticsConfig;\n\n readonly ready = output<void>();\n readonly error = output<{ code: string; message: string; fatal: boolean }>();\n readonly play = output<void>();\n readonly pause = output<void>();\n readonly autherror = output<{ message: string; retryable: boolean }>();\n\n private player: VideoPlayer | null = null;\n private viewReady = false;\n\n ngAfterViewInit(): void {\n this.viewReady = true;\n this.recreate();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.viewReady) return;\n if (\n changes[\"videoId\"] ||\n changes[\"sourceUrl\"] ||\n changes[\"auth\"] ||\n changes[\"playback\"] ||\n changes[\"analytics\"]\n ) {\n this.recreate();\n } else if (changes[\"config\"] && this.player) {\n this.player.updateConfig(this.config);\n this.applyTheme();\n }\n }\n\n ngOnDestroy(): void {\n this.player?.destroy();\n this.player = null;\n }\n\n getPlayer(): VideoPlayer | null {\n return this.player;\n }\n\n private recreate(): void {\n this.player?.destroy();\n const video = this.videoRef?.nativeElement;\n if (!video) return;\n\n const resolved = mergePlayerConfig(this.config);\n this.player = createVideoPlayer({\n videoId: this.videoId,\n mount: video,\n auth: this.auth,\n playback: this.playback,\n sourceUrl: this.sourceUrl,\n player: resolved.player,\n controls: resolved.controls,\n theme: resolved.theme,\n watermark: resolved.watermark,\n streaming: resolved.streaming,\n logging: resolved.logging,\n debug: resolved.debug,\n analytics: this.analytics,\n accessibility: resolved.accessibility,\n });\n\n this.player.on(\"ready\", () => this.ready.emit());\n this.player.on(\"error\", (e) => this.error.emit(e));\n this.player.on(\"play\", () => this.play.emit());\n this.player.on(\"pause\", () => this.pause.emit());\n this.player.on(\"autherror\", (e) => this.autherror.emit(e));\n this.applyTheme();\n }\n\n private applyTheme(): void {\n const resolved = mergePlayerConfig(this.config);\n const vars = themeToCssVars(resolved.theme);\n const el = this.containerRef?.nativeElement;\n if (!el) return;\n for (const [key, value] of Object.entries(vars)) {\n el.style.setProperty(key, value);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAoCa,uBAAuB,CAAA;AAIlC,IAAA,QAAQ;AAGR,IAAA,YAAY;AAEH,IAAA,OAAO;AACP,IAAA,IAAI;AACJ,IAAA,QAAQ;AACR,IAAA,SAAS;AACT,IAAA,MAAM;AACN,IAAA,SAAS;IAET,KAAK,GAAG,MAAM,EAAQ;IACtB,KAAK,GAAG,MAAM,EAAqD;IACnE,IAAI,GAAG,MAAM,EAAQ;IACrB,KAAK,GAAG,MAAM,EAAQ;IACtB,SAAS,GAAG,MAAM,EAA2C;IAE9D,MAAM,GAAuB,IAAI;IACjC,SAAS,GAAG,KAAK;IAEzB,eAAe,GAAA;AACb,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI;QACrB,IAAI,CAAC,QAAQ,EAAE;IACjB;AAEA,IAAA,WAAW,CAAC,OAAsB,EAAA;QAChC,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE;QACrB,IACE,OAAO,CAAC,SAAS,CAAC;YAClB,OAAO,CAAC,WAAW,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC;YACf,OAAO,CAAC,UAAU,CAAC;AACnB,YAAA,OAAO,CAAC,WAAW,CAAC,EACpB;YACA,IAAI,CAAC,QAAQ,EAAE;QACjB;aAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;YAC3C,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,I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;sBAAjB;gBACQ,MAAM,EAAA,CAAA;sBAAd;gBACQ,SAAS,EAAA,CAAA;sBAAjB;;;AClDH;;AAEG;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, OnChanges, OnDestroy, SimpleChanges } from "@angular/core";
|
|
2
|
-
import { mergePlayerConfig, type AuthConfig, type PlaybackCredentialConfig, type VideoPlayer } from "@codenkay/video-nsgplayer-core";
|
|
2
|
+
import { mergePlayerConfig, type AnalyticsConfig, type AuthConfig, type PlaybackCredentialConfig, type VideoPlayer } from "@codenkay/video-nsgplayer-core";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class NsgVideoPlayerComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|
4
5
|
videoRef: ElementRef<HTMLVideoElement>;
|
|
5
6
|
containerRef: ElementRef<HTMLDivElement>;
|
|
@@ -8,6 +9,7 @@ export declare class NsgVideoPlayerComponent implements AfterViewInit, OnChanges
|
|
|
8
9
|
playback?: PlaybackCredentialConfig;
|
|
9
10
|
sourceUrl?: string;
|
|
10
11
|
config?: Parameters<typeof mergePlayerConfig>[0];
|
|
12
|
+
analytics?: AnalyticsConfig;
|
|
11
13
|
readonly ready: import("@angular/core").OutputEmitterRef<void>;
|
|
12
14
|
readonly error: import("@angular/core").OutputEmitterRef<{
|
|
13
15
|
code: string;
|
|
@@ -28,5 +30,6 @@ export declare class NsgVideoPlayerComponent implements AfterViewInit, OnChanges
|
|
|
28
30
|
getPlayer(): VideoPlayer | null;
|
|
29
31
|
private recreate;
|
|
30
32
|
private applyTheme;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NsgVideoPlayerComponent, never>;
|
|
34
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NsgVideoPlayerComponent, "nsg-video-player", never, { "videoId": { "alias": "videoId"; "required": false; }; "auth": { "alias": "auth"; "required": false; }; "playback": { "alias": "playback"; "required": false; }; "sourceUrl": { "alias": "sourceUrl"; "required": false; }; "config": { "alias": "config"; "required": false; }; "analytics": { "alias": "analytics"; "required": false; }; }, { "ready": "ready"; "error": "error"; "play": "play"; "pause": "pause"; "autherror": "autherror"; }, never, never, true, never>;
|
|
31
35
|
}
|
|
32
|
-
//# sourceMappingURL=nsg-video-player.component.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codenkay/video-nsgplayer-angular",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Angular bindings for NSG video player",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Angular bindings for NSG video player (headless). Sample: https://github.com/codenannu/nsgplayer-sample-angular",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "NSG Player",
|
|
7
|
+
"homepage": "https://github.com/codenannu/nsgplayer-video#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/codenannu/nsgplayer-video.git",
|
|
11
|
+
"directory": "packages/angular"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/codenannu/nsgplayer-video/issues"
|
|
15
|
+
},
|
|
7
16
|
"type": "module",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"main": "./dist/fesm2022/codenkay-video-nsgplayer-angular.mjs",
|
|
19
|
+
"module": "./dist/fesm2022/codenkay-video-nsgplayer-angular.mjs",
|
|
10
20
|
"types": "./dist/index.d.ts",
|
|
11
21
|
"exports": {
|
|
12
22
|
".": {
|
|
13
23
|
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/
|
|
15
|
-
"default": "./dist/
|
|
24
|
+
"import": "./dist/fesm2022/codenkay-video-nsgplayer-angular.mjs",
|
|
25
|
+
"default": "./dist/fesm2022/codenkay-video-nsgplayer-angular.mjs"
|
|
16
26
|
}
|
|
17
27
|
},
|
|
18
28
|
"files": [
|
|
@@ -22,19 +32,24 @@
|
|
|
22
32
|
"CHANGELOG.md"
|
|
23
33
|
],
|
|
24
34
|
"peerDependencies": {
|
|
25
|
-
"@codenkay/video-nsgplayer-core": "^
|
|
35
|
+
"@codenkay/video-nsgplayer-core": "^4.0.0",
|
|
26
36
|
"@angular/core": ">=17",
|
|
27
|
-
"@angular/common": ">=17"
|
|
37
|
+
"@angular/common": ">=17",
|
|
38
|
+
"rxjs": "^7.8.0"
|
|
28
39
|
},
|
|
29
40
|
"scripts": {
|
|
30
|
-
"build": "
|
|
31
|
-
"typecheck": "tsc -p tsconfig.
|
|
41
|
+
"build": "ng-packagr -p ng-package.json",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
32
43
|
},
|
|
33
44
|
"devDependencies": {
|
|
34
45
|
"@codenkay/video-nsgplayer-core": "*",
|
|
35
46
|
"@angular/common": "^19.2.0",
|
|
47
|
+
"@angular/compiler": "^19.2.0",
|
|
48
|
+
"@angular/compiler-cli": "^19.2.0",
|
|
36
49
|
"@angular/core": "^19.2.0",
|
|
50
|
+
"ng-packagr": "^19.2.0",
|
|
37
51
|
"rxjs": "^7.8.0",
|
|
38
|
-
"
|
|
52
|
+
"tslib": "^2.8.0",
|
|
53
|
+
"typescript": "~5.7.0"
|
|
39
54
|
}
|
|
40
55
|
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NsgVideoPlayerComponent } from "./lib/nsg-video-player.component";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nsg-video-player.component.d.ts","sourceRoot":"","sources":["../../src/lib/nsg-video-player.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,UAAU,EAEV,SAAS,EACT,SAAS,EACT,aAAa,EAGd,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,iBAAiB,EAEjB,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EACjB,MAAM,gCAAgC,CAAC;AAExC,qBAea,uBACX,YAAW,aAAa,EAAE,SAAS,EAAE,SAAS;IAG9C,QAAQ,EAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAGxC,YAAY,EAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAEjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1D,QAAQ,CAAC,KAAK,iDAAkB;IAChC,QAAQ,CAAC,KAAK;cAAkB,MAAM;iBAAW,MAAM;eAAS,OAAO;OAAM;IAC7E,QAAQ,CAAC,IAAI,iDAAkB;IAC/B,QAAQ,CAAC,KAAK,iDAAkB;IAChC,QAAQ,CAAC,SAAS;iBAAqB,MAAM;mBAAa,OAAO;OAAM;IAEvE,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,SAAS,CAAS;IAE1B,eAAe,IAAI,IAAI;IAKvB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAezC,WAAW,IAAI,IAAI;IAKnB,SAAS,IAAI,WAAW,GAAG,IAAI;IAI/B,OAAO,CAAC,QAAQ;IA8BhB,OAAO,CAAC,UAAU;CASnB"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Component, Input, ViewChild, output, } from "@angular/core";
|
|
8
|
-
import { createVideoPlayer, mergePlayerConfig, themeToCssVars, } from "@codenkay/video-nsgplayer-core";
|
|
9
|
-
let NsgVideoPlayerComponent = class NsgVideoPlayerComponent {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.ready = output();
|
|
12
|
-
this.error = output();
|
|
13
|
-
this.play = output();
|
|
14
|
-
this.pause = output();
|
|
15
|
-
this.autherror = output();
|
|
16
|
-
this.player = null;
|
|
17
|
-
this.viewReady = false;
|
|
18
|
-
}
|
|
19
|
-
ngAfterViewInit() {
|
|
20
|
-
this.viewReady = true;
|
|
21
|
-
this.recreate();
|
|
22
|
-
}
|
|
23
|
-
ngOnChanges(changes) {
|
|
24
|
-
if (!this.viewReady)
|
|
25
|
-
return;
|
|
26
|
-
if (changes["videoId"] ||
|
|
27
|
-
changes["sourceUrl"] ||
|
|
28
|
-
changes["auth"] ||
|
|
29
|
-
changes["playback"]) {
|
|
30
|
-
this.recreate();
|
|
31
|
-
}
|
|
32
|
-
else if (changes["config"] && this.player) {
|
|
33
|
-
this.player.updateConfig(this.config);
|
|
34
|
-
this.applyTheme();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
ngOnDestroy() {
|
|
38
|
-
this.player?.destroy();
|
|
39
|
-
this.player = null;
|
|
40
|
-
}
|
|
41
|
-
getPlayer() {
|
|
42
|
-
return this.player;
|
|
43
|
-
}
|
|
44
|
-
recreate() {
|
|
45
|
-
this.player?.destroy();
|
|
46
|
-
const video = this.videoRef?.nativeElement;
|
|
47
|
-
if (!video)
|
|
48
|
-
return;
|
|
49
|
-
const resolved = mergePlayerConfig(this.config);
|
|
50
|
-
this.player = createVideoPlayer({
|
|
51
|
-
videoId: this.videoId,
|
|
52
|
-
mount: video,
|
|
53
|
-
auth: this.auth,
|
|
54
|
-
playback: this.playback,
|
|
55
|
-
sourceUrl: this.sourceUrl,
|
|
56
|
-
player: resolved.player,
|
|
57
|
-
controls: resolved.controls,
|
|
58
|
-
theme: resolved.theme,
|
|
59
|
-
watermark: resolved.watermark,
|
|
60
|
-
streaming: resolved.streaming,
|
|
61
|
-
logging: resolved.logging,
|
|
62
|
-
debug: resolved.debug,
|
|
63
|
-
accessibility: resolved.accessibility,
|
|
64
|
-
});
|
|
65
|
-
this.player.on("ready", () => this.ready.emit());
|
|
66
|
-
this.player.on("error", (e) => this.error.emit(e));
|
|
67
|
-
this.player.on("play", () => this.play.emit());
|
|
68
|
-
this.player.on("pause", () => this.pause.emit());
|
|
69
|
-
this.player.on("autherror", (e) => this.autherror.emit(e));
|
|
70
|
-
this.applyTheme();
|
|
71
|
-
}
|
|
72
|
-
applyTheme() {
|
|
73
|
-
const resolved = mergePlayerConfig(this.config);
|
|
74
|
-
const vars = themeToCssVars(resolved.theme);
|
|
75
|
-
const el = this.containerRef?.nativeElement;
|
|
76
|
-
if (!el)
|
|
77
|
-
return;
|
|
78
|
-
for (const [key, value] of Object.entries(vars)) {
|
|
79
|
-
el.style.setProperty(key, value);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
__decorate([
|
|
84
|
-
ViewChild("video", { static: true })
|
|
85
|
-
], NsgVideoPlayerComponent.prototype, "videoRef", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
ViewChild("container", { static: true })
|
|
88
|
-
], NsgVideoPlayerComponent.prototype, "containerRef", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
Input()
|
|
91
|
-
], NsgVideoPlayerComponent.prototype, "videoId", void 0);
|
|
92
|
-
__decorate([
|
|
93
|
-
Input()
|
|
94
|
-
], NsgVideoPlayerComponent.prototype, "auth", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
Input()
|
|
97
|
-
], NsgVideoPlayerComponent.prototype, "playback", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
Input()
|
|
100
|
-
], NsgVideoPlayerComponent.prototype, "sourceUrl", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
Input()
|
|
103
|
-
], NsgVideoPlayerComponent.prototype, "config", void 0);
|
|
104
|
-
NsgVideoPlayerComponent = __decorate([
|
|
105
|
-
Component({
|
|
106
|
-
selector: "nsg-video-player",
|
|
107
|
-
standalone: true,
|
|
108
|
-
template: `
|
|
109
|
-
<div
|
|
110
|
-
#container
|
|
111
|
-
data-player-theme
|
|
112
|
-
[style.width]="'100%'"
|
|
113
|
-
[style.position]="'relative'"
|
|
114
|
-
[style.background]="'#000'"
|
|
115
|
-
>
|
|
116
|
-
<video #video playsinline style="width:100%;display:block"></video>
|
|
117
|
-
</div>
|
|
118
|
-
`,
|
|
119
|
-
})
|
|
120
|
-
], NsgVideoPlayerComponent);
|
|
121
|
-
export { NsgVideoPlayerComponent };
|