@appstrata/player-lib 0.1.1 → 1.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/README.md +2 -6
- package/dist/app-host.d.ts +4 -23
- package/dist/app-host.d.ts.map +1 -1
- package/dist/app-host.js +4 -10
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -47,9 +47,7 @@ const host = createAppHost({
|
|
|
47
47
|
services: { storage, proxy },
|
|
48
48
|
target: iframe.contentWindow!,
|
|
49
49
|
targetOrigin: "*",
|
|
50
|
-
|
|
51
|
-
notifyNoContent: (options) => { /* handle no content */ },
|
|
52
|
-
notifyEstimatedEnd: (expectedFinishTime) => { /* handle estimation */ },
|
|
50
|
+
markComplete: () => { /* handle playback complete */ },
|
|
53
51
|
log: (level, msg, data) => console.log(`[${level}]`, msg, data),
|
|
54
52
|
});
|
|
55
53
|
|
|
@@ -105,9 +103,7 @@ High-level helper for hosting an AppStrata app.
|
|
|
105
103
|
- `target: Window` - Target window (typically `iframe.contentWindow`)
|
|
106
104
|
- `transport?: Transport` - Optional transport (auto-created from target/targetOrigin if not provided)
|
|
107
105
|
- `targetOrigin?: string` - Target origin for the default transport (default: `"*"`)
|
|
108
|
-
- `
|
|
109
|
-
- `notifyEstimatedEnd: (expectedFinishTime: number) => void` - Callback when app provides estimated finish time (Unix ms)
|
|
110
|
-
- `notifyNoContent: (options?) => void` - Callback when app signals no content (`{ retryNotBefore?: number; reason?: string }`)
|
|
106
|
+
- `markComplete: () => void` - Callback when app signals playback complete
|
|
111
107
|
- `log: (level, message, data?) => void` - Logging callback
|
|
112
108
|
- `debug?: boolean` - Enable debug logging (default: `false`)
|
|
113
109
|
- `retryInterval?: number` - READY retry interval in ms (default: `1000`)
|
package/dist/app-host.d.ts
CHANGED
|
@@ -104,30 +104,11 @@ export interface CreateAppHostOptions {
|
|
|
104
104
|
*/
|
|
105
105
|
maxRetries?: number;
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* Implementation for markComplete.
|
|
108
108
|
* Vendors MUST provide their own implementation.
|
|
109
|
+
* This method is called when an app signals it has finished playback.
|
|
109
110
|
*/
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Called when the app provides an estimated finish time.
|
|
113
|
-
* Vendors MUST provide their own implementation.
|
|
114
|
-
*
|
|
115
|
-
* @param expectedFinishTime - Absolute epoch timestamp in ms (already
|
|
116
|
-
* converted from the app-facing totalDuration/finishTime by the SDK)
|
|
117
|
-
*/
|
|
118
|
-
notifyEstimatedEnd: (expectedFinishTime: number) => void;
|
|
119
|
-
/**
|
|
120
|
-
* Called when the app signals it has no content to display.
|
|
121
|
-
* Vendors MUST provide their own implementation.
|
|
122
|
-
*
|
|
123
|
-
* @param options - Optional retry and reason info
|
|
124
|
-
* @param options.retryNotBefore - Earliest time to retry (epoch timestamp in ms)
|
|
125
|
-
* @param options.reason - Human-readable reason
|
|
126
|
-
*/
|
|
127
|
-
notifyNoContent: (options?: {
|
|
128
|
-
retryNotBefore?: number;
|
|
129
|
-
reason?: string;
|
|
130
|
-
}) => void;
|
|
111
|
+
markComplete: () => void;
|
|
131
112
|
/**
|
|
132
113
|
* Implementation for logging.
|
|
133
114
|
* Vendors MUST provide their own implementation.
|
|
@@ -146,7 +127,7 @@ export interface CreateAppHostOptions {
|
|
|
146
127
|
* const host = createAppHost({
|
|
147
128
|
* services: { storage, proxy },
|
|
148
129
|
* target: iframe.contentWindow!,
|
|
149
|
-
*
|
|
130
|
+
* markComplete: () => { ... },
|
|
150
131
|
* log: (level, msg) => console.log(msg),
|
|
151
132
|
* });
|
|
152
133
|
*
|
package/dist/app-host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-host.d.ts","sourceRoot":"","sources":["../src/app-host.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,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AAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,YAAY,EAAE,MAAM,IAAI,CAAC;IAEzB;;;;;;;OAOG;IACH,GAAG,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAmNT"}
|
package/dist/app-host.js
CHANGED
|
@@ -19,7 +19,7 @@ import { MessageBridge, createPostMessageTransport, } from "@appstrata/protocol"
|
|
|
19
19
|
* const host = createAppHost({
|
|
20
20
|
* services: { storage, proxy },
|
|
21
21
|
* target: iframe.contentWindow!,
|
|
22
|
-
*
|
|
22
|
+
* markComplete: () => { ... },
|
|
23
23
|
* log: (level, msg) => console.log(msg),
|
|
24
24
|
* });
|
|
25
25
|
*
|
|
@@ -31,7 +31,7 @@ import { MessageBridge, createPostMessageTransport, } from "@appstrata/protocol"
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
export function createAppHost(options) {
|
|
34
|
-
const { services, transport, target, targetOrigin = "*", retryInterval, maxRetries,
|
|
34
|
+
const { services, transport, target, targetOrigin = "*", retryInterval, maxRetries, markComplete, log, } = options;
|
|
35
35
|
// ═══════════════════════════════════════════════════════════════════════
|
|
36
36
|
// Internal state
|
|
37
37
|
// ═══════════════════════════════════════════════════════════════════════
|
|
@@ -80,14 +80,8 @@ export function createAppHost(options) {
|
|
|
80
80
|
onHide(handler) { handlers.onHide.push(handler); },
|
|
81
81
|
onStop(handler) { handlers.onStop.push(handler); },
|
|
82
82
|
onContextChange(handler) { handlers.onContextChange.push(handler); },
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
notifyEstimatedEnd(options) {
|
|
87
|
-
notifyEstimatedEnd(options?.expectedFinishTime ?? options);
|
|
88
|
-
},
|
|
89
|
-
notifyNoContent(options) {
|
|
90
|
-
notifyNoContent(options);
|
|
83
|
+
markComplete() {
|
|
84
|
+
markComplete();
|
|
91
85
|
},
|
|
92
86
|
storage: services.storage,
|
|
93
87
|
proxy: services.proxy,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appstrata/player-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "AppStrata Player Library - Helpers for platform vendors implementing compliant players",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"access": "restricted"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@appstrata/
|
|
30
|
-
"@appstrata/
|
|
29
|
+
"@appstrata/protocol": "1.0.0",
|
|
30
|
+
"@appstrata/core": "1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@jest/globals": "^29.7.0",
|