@thestatic-tv/dcl-sdk 2.11.0 → 2.11.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.
- package/README.md +11 -5
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +47 -4
- package/dist/index.mjs +47 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,10 +79,14 @@ The SDK includes pre-built UI for channel browsing and chat:
|
|
|
79
79
|
```typescript
|
|
80
80
|
staticTV = new StaticTVClient({
|
|
81
81
|
apiKey: 'your_api_key',
|
|
82
|
+
// The screen a pick plays on (or videoScreen): without one a Standard scene plays nowhere,
|
|
83
|
+
// and a Pro scene gets no Admin Panel
|
|
84
|
+
onVideoPlay: (url) => playOnYourScreen(url),
|
|
82
85
|
guideUI: {
|
|
83
86
|
onVideoSelect: (video) => {
|
|
84
|
-
//
|
|
85
|
-
|
|
87
|
+
// The SDK plays the pick through onVideoPlay; the scene starts its watch time, and
|
|
88
|
+
// staticTV.stopVideo() (every stop, an admin's included) ends it
|
|
89
|
+
if (video.channelId) staticTV.heartbeat?.startWatching(video.channelId)
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
chatUI: {
|
|
@@ -90,9 +94,11 @@ staticTV = new StaticTVClient({
|
|
|
90
94
|
}
|
|
91
95
|
})
|
|
92
96
|
|
|
93
|
-
//
|
|
94
|
-
staticTV.
|
|
95
|
-
staticTV.
|
|
97
|
+
// The guide and chat exist once the session's answer names the tier
|
|
98
|
+
staticTV.onFeaturesReady().then(() => {
|
|
99
|
+
staticTV.guideUI?.init()
|
|
100
|
+
staticTV.chatUI?.init()
|
|
101
|
+
})
|
|
96
102
|
|
|
97
103
|
// Show/hide
|
|
98
104
|
staticTV.guideUI.toggle()
|
package/dist/index.d.mts
CHANGED
|
@@ -1374,6 +1374,14 @@ declare class AdminPanelUIModule {
|
|
|
1374
1374
|
* Play a video slot by ID - looks up URL and calls onVideoPlay
|
|
1375
1375
|
*/
|
|
1376
1376
|
playSlot(slotId: string): void;
|
|
1377
|
+
/**
|
|
1378
|
+
* A late arrival's first play (2026-11-30, his find): the scene's kept current video when thestatic.tv keeps one - an
|
|
1379
|
+
* admin's PLAY NOW or Play on Screen (videoSetUrl), kept until Reset Default - a url played as the queue plays one,
|
|
1380
|
+
* a locked channel asked for through the door as every locked play is (a refused visitor gets the LOCKED line and
|
|
1381
|
+
* nothing plays). With none kept, the default slot, as before. Until then only the default slot played at load, so
|
|
1382
|
+
* a copy that loaded more than 30 s after a PLAY NOW (the queue's window) never saw it.
|
|
1383
|
+
*/
|
|
1384
|
+
private playAtLoad;
|
|
1377
1385
|
/**
|
|
1378
1386
|
* Auto-play the default slot if configured
|
|
1379
1387
|
*/
|
|
@@ -1677,6 +1685,9 @@ declare class StaticTVClient {
|
|
|
1677
1685
|
* Stop video playback on the configured videoScreen entity.
|
|
1678
1686
|
* If fallbackVideoUrl is configured (default), plays the fallback loop.
|
|
1679
1687
|
* Called by Admin Panel.
|
|
1688
|
+
* The watch heartbeat ends with it (2026-11-30): nothing is on the screen to watch, so no minute (and no Sparks) is
|
|
1689
|
+
* credited after a stop - an admin's Stop or Reset Default, a queued stop or clear, a locked re-ask refused, a dead
|
|
1690
|
+
* stream, or a scene's own call (TheStatic.tv HQ's radio pick). Until then it ran on until the next pick.
|
|
1680
1691
|
*/
|
|
1681
1692
|
stopVideo(): void;
|
|
1682
1693
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1374,6 +1374,14 @@ declare class AdminPanelUIModule {
|
|
|
1374
1374
|
* Play a video slot by ID - looks up URL and calls onVideoPlay
|
|
1375
1375
|
*/
|
|
1376
1376
|
playSlot(slotId: string): void;
|
|
1377
|
+
/**
|
|
1378
|
+
* A late arrival's first play (2026-11-30, his find): the scene's kept current video when thestatic.tv keeps one - an
|
|
1379
|
+
* admin's PLAY NOW or Play on Screen (videoSetUrl), kept until Reset Default - a url played as the queue plays one,
|
|
1380
|
+
* a locked channel asked for through the door as every locked play is (a refused visitor gets the LOCKED line and
|
|
1381
|
+
* nothing plays). With none kept, the default slot, as before. Until then only the default slot played at load, so
|
|
1382
|
+
* a copy that loaded more than 30 s after a PLAY NOW (the queue's window) never saw it.
|
|
1383
|
+
*/
|
|
1384
|
+
private playAtLoad;
|
|
1377
1385
|
/**
|
|
1378
1386
|
* Auto-play the default slot if configured
|
|
1379
1387
|
*/
|
|
@@ -1677,6 +1685,9 @@ declare class StaticTVClient {
|
|
|
1677
1685
|
* Stop video playback on the configured videoScreen entity.
|
|
1678
1686
|
* If fallbackVideoUrl is configured (default), plays the fallback loop.
|
|
1679
1687
|
* Called by Admin Panel.
|
|
1688
|
+
* The watch heartbeat ends with it (2026-11-30): nothing is on the screen to watch, so no minute (and no Sparks) is
|
|
1689
|
+
* credited after a stop - an admin's Stop or Reset Default, a queued stop or clear, a locked re-ask refused, a dead
|
|
1690
|
+
* stream, or a scene's own call (TheStatic.tv HQ's radio pick). Until then it ran on until the next pick.
|
|
1680
1691
|
*/
|
|
1681
1692
|
stopVideo(): void;
|
|
1682
1693
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3408,6 +3408,25 @@ function BlockedNotice(props) {
|
|
|
3408
3408
|
);
|
|
3409
3409
|
}
|
|
3410
3410
|
|
|
3411
|
+
// src/ui/trial-text.ts
|
|
3412
|
+
function trialHours(trialSparks) {
|
|
3413
|
+
if (typeof trialSparks !== "number" || !Number.isFinite(trialSparks) || trialSparks <= 0) return null;
|
|
3414
|
+
return Math.round(trialSparks / 60 * 10) / 10;
|
|
3415
|
+
}
|
|
3416
|
+
var hoursWord = (h) => h === 1 ? "hour" : "hours";
|
|
3417
|
+
function trialButtonText(trialSparks) {
|
|
3418
|
+
const h = trialHours(trialSparks);
|
|
3419
|
+
return h === null ? "Start Free Trial" : `Start Free ${h}-Hour Trial`;
|
|
3420
|
+
}
|
|
3421
|
+
function trialNoteText(trialSparks) {
|
|
3422
|
+
const h = trialHours(trialSparks);
|
|
3423
|
+
return h === null ? "One-time streaming trial" : `One-time trial \u2022 ${h} ${hoursWord(h)} of streaming`;
|
|
3424
|
+
}
|
|
3425
|
+
function trialActivatedText(hoursGranted) {
|
|
3426
|
+
const h = typeof hoursGranted === "number" && Number.isFinite(hoursGranted) && hoursGranted > 0 ? hoursGranted : null;
|
|
3427
|
+
return h === null ? "Streaming trial activated!" : `${h}-hour streaming trial activated!`;
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3411
3430
|
// src/utils/player-wait.ts
|
|
3412
3431
|
var PLAYER_WAIT_STEP_MS = 1e3;
|
|
3413
3432
|
var PLAYER_WAIT_MAX_MS = 30 * 1e3;
|
|
@@ -3910,12 +3929,12 @@ var AdminPanelUIModule = class {
|
|
|
3910
3929
|
{
|
|
3911
3930
|
uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
3912
3931
|
uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
|
|
3913
|
-
value: this.trialClaiming ? "Claiming..." :
|
|
3932
|
+
value: this.trialClaiming ? "Claiming..." : trialButtonText(this.streamData?.trialSparks),
|
|
3914
3933
|
fontSize: t.button,
|
|
3915
3934
|
color: C2.text,
|
|
3916
3935
|
onMouseDown: () => this.claimTrial()
|
|
3917
3936
|
}
|
|
3918
|
-
), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value:
|
|
3937
|
+
), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: trialNoteText(this.streamData?.trialSparks), fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
3919
3938
|
import_react_ecs6.Button,
|
|
3920
3939
|
{
|
|
3921
3940
|
uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
@@ -4546,7 +4565,7 @@ var AdminPanelUIModule = class {
|
|
|
4546
4565
|
});
|
|
4547
4566
|
await this.checkAdminStatus();
|
|
4548
4567
|
await this.fetchVideoState();
|
|
4549
|
-
this.
|
|
4568
|
+
this.playAtLoad();
|
|
4550
4569
|
this.loadReadsDone = true;
|
|
4551
4570
|
await this.readSavedState();
|
|
4552
4571
|
this.startCommandPolling();
|
|
@@ -5032,6 +5051,26 @@ var AdminPanelUIModule = class {
|
|
|
5032
5051
|
this.config.onVideoSlotPlay?.(slotId);
|
|
5033
5052
|
}
|
|
5034
5053
|
}
|
|
5054
|
+
/**
|
|
5055
|
+
* A late arrival's first play (2026-11-30, his find): the scene's kept current video when thestatic.tv keeps one - an
|
|
5056
|
+
* admin's PLAY NOW or Play on Screen (videoSetUrl), kept until Reset Default - a url played as the queue plays one,
|
|
5057
|
+
* a locked channel asked for through the door as every locked play is (a refused visitor gets the LOCKED line and
|
|
5058
|
+
* nothing plays). With none kept, the default slot, as before. Until then only the default slot played at load, so
|
|
5059
|
+
* a copy that loaded more than 30 s after a PLAY NOW (the queue's window) never saw it.
|
|
5060
|
+
*/
|
|
5061
|
+
playAtLoad() {
|
|
5062
|
+
if (this.currentLockedChannel) {
|
|
5063
|
+
this.log("Playing the kept locked channel at load:", this.currentLockedChannel);
|
|
5064
|
+
this.playLocked(this.currentLockedChannel);
|
|
5065
|
+
return;
|
|
5066
|
+
}
|
|
5067
|
+
if (this.currentVideoUrl) {
|
|
5068
|
+
this.log("Playing the kept video at load:", this.currentVideoUrl);
|
|
5069
|
+
this.playUrl(this.currentVideoUrl);
|
|
5070
|
+
return;
|
|
5071
|
+
}
|
|
5072
|
+
this.autoPlayDefault();
|
|
5073
|
+
}
|
|
5035
5074
|
/**
|
|
5036
5075
|
* Auto-play the default slot if configured
|
|
5037
5076
|
*/
|
|
@@ -5096,7 +5135,7 @@ var AdminPanelUIModule = class {
|
|
|
5096
5135
|
this.log("Trial claimed:", data.channel);
|
|
5097
5136
|
this.streamFetched = false;
|
|
5098
5137
|
await this.fetchStreamData();
|
|
5099
|
-
this.config.onBroadcast?.(
|
|
5138
|
+
this.config.onBroadcast?.(trialActivatedText(data.trial?.hoursGranted));
|
|
5100
5139
|
} else {
|
|
5101
5140
|
this.trialClaimError = data.error || "Failed to claim trial";
|
|
5102
5141
|
this.log("Trial claim failed:", data.error);
|
|
@@ -6015,10 +6054,14 @@ var StaticTVClient = class {
|
|
|
6015
6054
|
* Stop video playback on the configured videoScreen entity.
|
|
6016
6055
|
* If fallbackVideoUrl is configured (default), plays the fallback loop.
|
|
6017
6056
|
* Called by Admin Panel.
|
|
6057
|
+
* The watch heartbeat ends with it (2026-11-30): nothing is on the screen to watch, so no minute (and no Sparks) is
|
|
6058
|
+
* credited after a stop - an admin's Stop or Reset Default, a queued stop or clear, a locked re-ask refused, a dead
|
|
6059
|
+
* stream, or a scene's own call (TheStatic.tv HQ's radio pick). Until then it ran on until the next pick.
|
|
6018
6060
|
*/
|
|
6019
6061
|
stopVideo() {
|
|
6020
6062
|
const screen = this.config.videoScreen;
|
|
6021
6063
|
this.streamLink.cancel();
|
|
6064
|
+
this.heartbeat?.stopWatching();
|
|
6022
6065
|
this._pendingVideoData = null;
|
|
6023
6066
|
this._streamVerified = false;
|
|
6024
6067
|
this._clearVerificationTimeout();
|
package/dist/index.mjs
CHANGED
|
@@ -3357,6 +3357,25 @@ function BlockedNotice(props) {
|
|
|
3357
3357
|
);
|
|
3358
3358
|
}
|
|
3359
3359
|
|
|
3360
|
+
// src/ui/trial-text.ts
|
|
3361
|
+
function trialHours(trialSparks) {
|
|
3362
|
+
if (typeof trialSparks !== "number" || !Number.isFinite(trialSparks) || trialSparks <= 0) return null;
|
|
3363
|
+
return Math.round(trialSparks / 60 * 10) / 10;
|
|
3364
|
+
}
|
|
3365
|
+
var hoursWord = (h) => h === 1 ? "hour" : "hours";
|
|
3366
|
+
function trialButtonText(trialSparks) {
|
|
3367
|
+
const h = trialHours(trialSparks);
|
|
3368
|
+
return h === null ? "Start Free Trial" : `Start Free ${h}-Hour Trial`;
|
|
3369
|
+
}
|
|
3370
|
+
function trialNoteText(trialSparks) {
|
|
3371
|
+
const h = trialHours(trialSparks);
|
|
3372
|
+
return h === null ? "One-time streaming trial" : `One-time trial \u2022 ${h} ${hoursWord(h)} of streaming`;
|
|
3373
|
+
}
|
|
3374
|
+
function trialActivatedText(hoursGranted) {
|
|
3375
|
+
const h = typeof hoursGranted === "number" && Number.isFinite(hoursGranted) && hoursGranted > 0 ? hoursGranted : null;
|
|
3376
|
+
return h === null ? "Streaming trial activated!" : `${h}-hour streaming trial activated!`;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3360
3379
|
// src/utils/player-wait.ts
|
|
3361
3380
|
var PLAYER_WAIT_STEP_MS = 1e3;
|
|
3362
3381
|
var PLAYER_WAIT_MAX_MS = 30 * 1e3;
|
|
@@ -3859,12 +3878,12 @@ var AdminPanelUIModule = class {
|
|
|
3859
3878
|
{
|
|
3860
3879
|
uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
3861
3880
|
uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
|
|
3862
|
-
value: this.trialClaiming ? "Claiming..." :
|
|
3881
|
+
value: this.trialClaiming ? "Claiming..." : trialButtonText(this.streamData?.trialSparks),
|
|
3863
3882
|
fontSize: t.button,
|
|
3864
3883
|
color: C2.text,
|
|
3865
3884
|
onMouseDown: () => this.claimTrial()
|
|
3866
3885
|
}
|
|
3867
|
-
), this.trialClaimError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value:
|
|
3886
|
+
), this.trialClaimError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: trialNoteText(this.streamData?.trialSparks), fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs6.createElement(
|
|
3868
3887
|
Button4,
|
|
3869
3888
|
{
|
|
3870
3889
|
uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
|
|
@@ -4495,7 +4514,7 @@ var AdminPanelUIModule = class {
|
|
|
4495
4514
|
});
|
|
4496
4515
|
await this.checkAdminStatus();
|
|
4497
4516
|
await this.fetchVideoState();
|
|
4498
|
-
this.
|
|
4517
|
+
this.playAtLoad();
|
|
4499
4518
|
this.loadReadsDone = true;
|
|
4500
4519
|
await this.readSavedState();
|
|
4501
4520
|
this.startCommandPolling();
|
|
@@ -4981,6 +5000,26 @@ var AdminPanelUIModule = class {
|
|
|
4981
5000
|
this.config.onVideoSlotPlay?.(slotId);
|
|
4982
5001
|
}
|
|
4983
5002
|
}
|
|
5003
|
+
/**
|
|
5004
|
+
* A late arrival's first play (2026-11-30, his find): the scene's kept current video when thestatic.tv keeps one - an
|
|
5005
|
+
* admin's PLAY NOW or Play on Screen (videoSetUrl), kept until Reset Default - a url played as the queue plays one,
|
|
5006
|
+
* a locked channel asked for through the door as every locked play is (a refused visitor gets the LOCKED line and
|
|
5007
|
+
* nothing plays). With none kept, the default slot, as before. Until then only the default slot played at load, so
|
|
5008
|
+
* a copy that loaded more than 30 s after a PLAY NOW (the queue's window) never saw it.
|
|
5009
|
+
*/
|
|
5010
|
+
playAtLoad() {
|
|
5011
|
+
if (this.currentLockedChannel) {
|
|
5012
|
+
this.log("Playing the kept locked channel at load:", this.currentLockedChannel);
|
|
5013
|
+
this.playLocked(this.currentLockedChannel);
|
|
5014
|
+
return;
|
|
5015
|
+
}
|
|
5016
|
+
if (this.currentVideoUrl) {
|
|
5017
|
+
this.log("Playing the kept video at load:", this.currentVideoUrl);
|
|
5018
|
+
this.playUrl(this.currentVideoUrl);
|
|
5019
|
+
return;
|
|
5020
|
+
}
|
|
5021
|
+
this.autoPlayDefault();
|
|
5022
|
+
}
|
|
4984
5023
|
/**
|
|
4985
5024
|
* Auto-play the default slot if configured
|
|
4986
5025
|
*/
|
|
@@ -5045,7 +5084,7 @@ var AdminPanelUIModule = class {
|
|
|
5045
5084
|
this.log("Trial claimed:", data.channel);
|
|
5046
5085
|
this.streamFetched = false;
|
|
5047
5086
|
await this.fetchStreamData();
|
|
5048
|
-
this.config.onBroadcast?.(
|
|
5087
|
+
this.config.onBroadcast?.(trialActivatedText(data.trial?.hoursGranted));
|
|
5049
5088
|
} else {
|
|
5050
5089
|
this.trialClaimError = data.error || "Failed to claim trial";
|
|
5051
5090
|
this.log("Trial claim failed:", data.error);
|
|
@@ -5964,10 +6003,14 @@ var StaticTVClient = class {
|
|
|
5964
6003
|
* Stop video playback on the configured videoScreen entity.
|
|
5965
6004
|
* If fallbackVideoUrl is configured (default), plays the fallback loop.
|
|
5966
6005
|
* Called by Admin Panel.
|
|
6006
|
+
* The watch heartbeat ends with it (2026-11-30): nothing is on the screen to watch, so no minute (and no Sparks) is
|
|
6007
|
+
* credited after a stop - an admin's Stop or Reset Default, a queued stop or clear, a locked re-ask refused, a dead
|
|
6008
|
+
* stream, or a scene's own call (TheStatic.tv HQ's radio pick). Until then it ran on until the next pick.
|
|
5967
6009
|
*/
|
|
5968
6010
|
stopVideo() {
|
|
5969
6011
|
const screen = this.config.videoScreen;
|
|
5970
6012
|
this.streamLink.cancel();
|
|
6013
|
+
this.heartbeat?.stopWatching();
|
|
5971
6014
|
this._pendingVideoData = null;
|
|
5972
6015
|
this._streamVerified = false;
|
|
5973
6016
|
this._clearVerificationTimeout();
|
package/package.json
CHANGED