stormcloud-video-player 0.1.3 → 0.1.5
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/README.md +57 -0
- package/package.json +37 -5
- package/rollup.config.js +0 -51
- package/src/index.ts +0 -20
- package/src/player/StormcloudVideoPlayer.ts +0 -1123
- package/src/sdk/ima.ts +0 -369
- package/src/types.ts +0 -124
- package/src/ui/StormcloudVideoPlayer.tsx +0 -258
- package/src/utils/tracking.ts +0 -251
- package/tsconfig.json +0 -49
package/README.md
CHANGED
|
@@ -27,6 +27,31 @@ npm install stormcloud-video-player hls.js
|
|
|
27
27
|
|
|
28
28
|
This library targets modern browsers (ES2020) and expects a DOM environment.
|
|
29
29
|
|
|
30
|
+
### CDN Usage
|
|
31
|
+
|
|
32
|
+
You can also use the library directly from CDN without npm:
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<!-- Use latest version (recommended for development) -->
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/stormcloud-video-player/dist/stormcloud-vp.min.js"></script>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
// The library is available as window.StormcloudVideoPlayer
|
|
40
|
+
const { StormcloudVideoPlayer } = window.StormcloudVideoPlayer;
|
|
41
|
+
|
|
42
|
+
const video = document.getElementById("video");
|
|
43
|
+
const player = new StormcloudVideoPlayer({
|
|
44
|
+
videoElement: video,
|
|
45
|
+
src: "https://example.com/live/playlist.m3u8",
|
|
46
|
+
autoplay: true,
|
|
47
|
+
muted: true,
|
|
48
|
+
allowNativeHls: false,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
player.load();
|
|
52
|
+
</script>
|
|
53
|
+
```
|
|
54
|
+
|
|
30
55
|
---
|
|
31
56
|
|
|
32
57
|
## Quick start
|
|
@@ -45,6 +70,7 @@ function MyApp() {
|
|
|
45
70
|
muted={true}
|
|
46
71
|
allowNativeHls={false}
|
|
47
72
|
controls={true}
|
|
73
|
+
licenseKey="your_license_key_here"
|
|
48
74
|
style={{ width: "640px", height: "360px" }}
|
|
49
75
|
adSchedule={{
|
|
50
76
|
lateJoinPolicy: "play_remaining",
|
|
@@ -87,6 +113,7 @@ function MyApp() {
|
|
|
87
113
|
autoplay: true,
|
|
88
114
|
muted: true,
|
|
89
115
|
allowNativeHls: false,
|
|
116
|
+
licenseKey: "your_license_key_here", // Optional
|
|
90
117
|
// Optional external ad schedule
|
|
91
118
|
adSchedule: {
|
|
92
119
|
lateJoinPolicy: "play_remaining",
|
|
@@ -141,11 +168,41 @@ interface StormcloudVideoPlayerConfig {
|
|
|
141
168
|
allowNativeHls?: boolean;
|
|
142
169
|
adSchedule?: AdSchedule;
|
|
143
170
|
defaultVastTagUrl?: string;
|
|
171
|
+
licenseKey?: string;
|
|
144
172
|
}
|
|
145
173
|
```
|
|
146
174
|
|
|
147
175
|
---
|
|
148
176
|
|
|
177
|
+
## License Key Authentication
|
|
178
|
+
|
|
179
|
+
The player supports license key authentication for API calls. When a `licenseKey` is provided, it will be included as a `Bearer` token in the `Authorization` header for all API requests to:
|
|
180
|
+
|
|
181
|
+
- Ad configuration endpoint: `https://adstorm.co/api-adstorm-dev/adstorm/ads/web`
|
|
182
|
+
- Initial tracking: `https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track`
|
|
183
|
+
- Heartbeat tracking: `https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat`
|
|
184
|
+
|
|
185
|
+
### Usage
|
|
186
|
+
|
|
187
|
+
```javascript
|
|
188
|
+
// Vanilla JavaScript
|
|
189
|
+
const player = new StormcloudVideoPlayer({
|
|
190
|
+
videoElement: video,
|
|
191
|
+
src: "https://example.com/stream.m3u8",
|
|
192
|
+
licenseKey: "your_license_key_here" // Optional
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// React Component
|
|
196
|
+
<StormcloudVideoPlayerComponent
|
|
197
|
+
src="https://example.com/stream.m3u8"
|
|
198
|
+
licenseKey="your_license_key_here" // Optional
|
|
199
|
+
/>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The license key is optional and the player will work without it, but some API features may be limited or unavailable.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
149
206
|
## How ad alignment works
|
|
150
207
|
|
|
151
208
|
- On `CUE-OUT`/`DATERANGE` start: request IMA ads and start playback immediately; if duration is known, a countdown is scheduled to auto-stop if `CUE-IN` is missing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stormcloud-video-player",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"main": "lib/index.cjs",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -11,10 +11,30 @@
|
|
|
11
11
|
"clean": "rm -rf lib dist",
|
|
12
12
|
"build:lib": "npm run build"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
"description": "Ad-first HLS video player with SCTE-35 support and Google IMA integration for precise ad break alignment",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"video",
|
|
17
|
+
"player",
|
|
18
|
+
"hls",
|
|
19
|
+
"streaming",
|
|
20
|
+
"ads",
|
|
21
|
+
"advertising",
|
|
22
|
+
"scte-35",
|
|
23
|
+
"ima",
|
|
24
|
+
"vast",
|
|
25
|
+
"vpaid",
|
|
26
|
+
"live-streaming",
|
|
27
|
+
"video-ads",
|
|
28
|
+
"ad-insertion",
|
|
29
|
+
"broadcast",
|
|
30
|
+
"ott",
|
|
31
|
+
"connected-tv",
|
|
32
|
+
"ctv",
|
|
33
|
+
"react",
|
|
34
|
+
"typescript"
|
|
35
|
+
],
|
|
36
|
+
"author": "Showfer Media LLC",
|
|
37
|
+
"license": "MIT",
|
|
18
38
|
"dependencies": {
|
|
19
39
|
"hls.js": "^1.6.11"
|
|
20
40
|
},
|
|
@@ -41,5 +61,17 @@
|
|
|
41
61
|
"peerDependencies": {
|
|
42
62
|
"react": ">=17",
|
|
43
63
|
"react-dom": ">=17"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=16"
|
|
67
|
+
},
|
|
68
|
+
"files": [
|
|
69
|
+
"lib/**/*",
|
|
70
|
+
"dist/**/*",
|
|
71
|
+
"README.md",
|
|
72
|
+
"LICENSE"
|
|
73
|
+
],
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
44
76
|
}
|
|
45
77
|
}
|
package/rollup.config.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
3
|
-
import terser from "@rollup/plugin-terser";
|
|
4
|
-
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
input: "src/index.ts",
|
|
8
|
-
|
|
9
|
-
output: {
|
|
10
|
-
file: "dist/stormcloud-vp.min.js",
|
|
11
|
-
format: "umd",
|
|
12
|
-
name: "StormcloudVP",
|
|
13
|
-
sourcemap: false,
|
|
14
|
-
globals: {},
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
plugins: [
|
|
18
|
-
resolve({
|
|
19
|
-
browser: true,
|
|
20
|
-
preferBuiltins: false,
|
|
21
|
-
}),
|
|
22
|
-
commonjs({
|
|
23
|
-
include: ["node_modules/**"],
|
|
24
|
-
}),
|
|
25
|
-
typescript({
|
|
26
|
-
tsconfig: "./tsconfig.json",
|
|
27
|
-
sourceMap: false,
|
|
28
|
-
inlineSources: false,
|
|
29
|
-
declaration: false,
|
|
30
|
-
declarationMap: false,
|
|
31
|
-
}),
|
|
32
|
-
terser({
|
|
33
|
-
compress: {
|
|
34
|
-
drop_console: false,
|
|
35
|
-
drop_debugger: true,
|
|
36
|
-
pure_funcs: ["console.debug"],
|
|
37
|
-
},
|
|
38
|
-
mangle: {
|
|
39
|
-
reserved: ["StormcloudVP"],
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
],
|
|
43
|
-
|
|
44
|
-
external: [],
|
|
45
|
-
|
|
46
|
-
onwarn(warning, warn) {
|
|
47
|
-
if (warning.code === "CIRCULAR_DEPENDENCY") return;
|
|
48
|
-
if (warning.code === "THIS_IS_UNDEFINED") return;
|
|
49
|
-
warn(warning);
|
|
50
|
-
},
|
|
51
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { StormcloudVideoPlayer } from "./player/StormcloudVideoPlayer";
|
|
2
|
-
export type {
|
|
3
|
-
StormcloudVideoPlayerConfig,
|
|
4
|
-
AdBreak,
|
|
5
|
-
AdSchedule,
|
|
6
|
-
LateJoinPolicy,
|
|
7
|
-
ClientInfo,
|
|
8
|
-
TrackingData,
|
|
9
|
-
HeartbeatData,
|
|
10
|
-
} from "./types";
|
|
11
|
-
|
|
12
|
-
export { StormcloudVideoPlayerComponent } from "./ui/StormcloudVideoPlayer";
|
|
13
|
-
export type { StormcloudVideoPlayerProps } from "./ui/StormcloudVideoPlayer";
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
getClientInfo,
|
|
17
|
-
getBrowserID,
|
|
18
|
-
sendInitialTracking,
|
|
19
|
-
sendHeartbeat,
|
|
20
|
-
} from "./utils/tracking";
|