@thestatic-tv/dcl-sdk 2.11.1 → 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 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
- // Handle video playback
85
- console.log('Playing:', video.name)
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
- // Initialize UI components
94
- staticTV.guideUI.init()
95
- staticTV.chatUI.init()
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
@@ -4565,7 +4565,7 @@ var AdminPanelUIModule = class {
4565
4565
  });
4566
4566
  await this.checkAdminStatus();
4567
4567
  await this.fetchVideoState();
4568
- this.autoPlayDefault();
4568
+ this.playAtLoad();
4569
4569
  this.loadReadsDone = true;
4570
4570
  await this.readSavedState();
4571
4571
  this.startCommandPolling();
@@ -5051,6 +5051,26 @@ var AdminPanelUIModule = class {
5051
5051
  this.config.onVideoSlotPlay?.(slotId);
5052
5052
  }
5053
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
+ }
5054
5074
  /**
5055
5075
  * Auto-play the default slot if configured
5056
5076
  */
@@ -6034,10 +6054,14 @@ var StaticTVClient = class {
6034
6054
  * Stop video playback on the configured videoScreen entity.
6035
6055
  * If fallbackVideoUrl is configured (default), plays the fallback loop.
6036
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.
6037
6060
  */
6038
6061
  stopVideo() {
6039
6062
  const screen = this.config.videoScreen;
6040
6063
  this.streamLink.cancel();
6064
+ this.heartbeat?.stopWatching();
6041
6065
  this._pendingVideoData = null;
6042
6066
  this._streamVerified = false;
6043
6067
  this._clearVerificationTimeout();
package/dist/index.mjs CHANGED
@@ -4514,7 +4514,7 @@ var AdminPanelUIModule = class {
4514
4514
  });
4515
4515
  await this.checkAdminStatus();
4516
4516
  await this.fetchVideoState();
4517
- this.autoPlayDefault();
4517
+ this.playAtLoad();
4518
4518
  this.loadReadsDone = true;
4519
4519
  await this.readSavedState();
4520
4520
  this.startCommandPolling();
@@ -5000,6 +5000,26 @@ var AdminPanelUIModule = class {
5000
5000
  this.config.onVideoSlotPlay?.(slotId);
5001
5001
  }
5002
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
+ }
5003
5023
  /**
5004
5024
  * Auto-play the default slot if configured
5005
5025
  */
@@ -5983,10 +6003,14 @@ var StaticTVClient = class {
5983
6003
  * Stop video playback on the configured videoScreen entity.
5984
6004
  * If fallbackVideoUrl is configured (default), plays the fallback loop.
5985
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.
5986
6009
  */
5987
6010
  stopVideo() {
5988
6011
  const screen = this.config.videoScreen;
5989
6012
  this.streamLink.cancel();
6013
+ this.heartbeat?.stopWatching();
5990
6014
  this._pendingVideoData = null;
5991
6015
  this._streamVerified = false;
5992
6016
  this._clearVerificationTimeout();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestatic-tv/dcl-sdk",
3
- "version": "2.11.1",
3
+ "version": "2.11.2",
4
4
  "description": "Connect your Decentraland scene to thestatic.tv - full channel lineup, metrics tracking, and interactions",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",