senza-sdk 4.3.2-3c99350.0 → 4.3.2-a581729.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "senza-sdk",
3
- "version": "4.3.2-3c99350.0",
3
+ "version": "4.3.2-a581729.0",
4
4
  "main": "./src/api.js",
5
5
  "description": "API for Senza application",
6
6
  "license": "MIT",
@@ -1367,6 +1367,15 @@ class RemotePlayer extends RemotePlayerInterface {
1367
1367
  }
1368
1368
  }
1369
1369
 
1370
+ /**
1371
+ * The function sets a blackout time for the screen.
1372
+ * The blackout time is the time when the screen will be blacked out.
1373
+ * This is useful for parental controls where the screen should be blacked out during certain times
1374
+ *
1375
+ * @param {Date} date
1376
+ * @returns {Promise<void>} A Promise that resolves once the blackout time is set.
1377
+ * @throws {RemotePlayerError} If the player is not initialized or not loaded. if date is not a Date object or if the remote player api version is not supported
1378
+ */
1370
1379
  setScreenBlackout(date) {
1371
1380
 
1372
1381
  if (!this._isInitialized) {
@@ -1382,13 +1391,21 @@ class RemotePlayer extends RemotePlayerInterface {
1382
1391
  }
1383
1392
 
1384
1393
  if (this._remotePlayerApiVersion < 2) {
1385
- throw new RemotePlayerError(6504, `setScreenBlackout is not supported in remotePlayerApiVersion=${this._remotePlayerApiVersion}. remotePlayerApiVersion >= 2 required`);
1394
+ throw new RemotePlayerError(6504, `setScreenBlackout() is not supported in remotePlayerApiVersion=${this._remotePlayerApiVersion}`);
1386
1395
  }
1387
1396
 
1388
1397
  const blackoutTime = (date.getTime()/1000).toFixed(2);
1398
+ sdkLogger.info(`remotePlayer.setScreenBlackout(): setting blackout time to ${blackoutTime}`);
1389
1399
  return this._setScreenBlackout(blackoutTime);
1390
1400
  }
1391
1401
 
1402
+ /**
1403
+ * The function resets the currently set blackout time for the screen.
1404
+ * This is useful for parental controls to be reset the blackout time after it has been set.
1405
+ *
1406
+ * @returns {Promise<void>} A Promise that resolves once the blackout time is reset.
1407
+ * @throws {RemotePlayerError} If the player is not initialized or not loaded. if the remote player api version is not supported
1408
+ */
1392
1409
  resetScreenBlackout() {
1393
1410
  if (!this._isInitialized) {
1394
1411
  throw new RemotePlayerError(6500, "Cannot call resetScreenBlackout() if remote player is not initialized");
@@ -1399,8 +1416,9 @@ class RemotePlayer extends RemotePlayerInterface {
1399
1416
  }
1400
1417
 
1401
1418
  if (this._remotePlayerApiVersion < 2) {
1402
- throw new RemotePlayerError(6504, `resetScreenBlackout is not supported in remotePlayerApiVersion=${this._remotePlayerApiVersion}. remotePlayerApiVersion >= 2 required`);
1419
+ throw new RemotePlayerError(6504, `resetScreenBlackout() is not supported in remotePlayerApiVersion=${this._remotePlayerApiVersion}`);
1403
1420
  }
1421
+ sdkLogger.info("remotePlayer.resetScreenBlackout(): resetting blackout time");
1404
1422
  return this._setScreenBlackout(0);
1405
1423
  }
1406
1424
 
@@ -1757,11 +1775,10 @@ class RemotePlayer extends RemotePlayerInterface {
1757
1775
  }
1758
1776
 
1759
1777
  _setScreenBlackout(blackoutTime) {
1760
- const functionName = blackoutTime === 0 ? "resetScreenBlackout" : "setScreenBlackout";
1761
1778
  if (window.cefQuery) {
1762
1779
  const FCID = getFCID();
1763
1780
  const logger = sdkLogger.withFields({ FCID });
1764
- logger.log(`remotePlayer ${functionName}: sending screenBlackout action at ${blackoutTime}`);
1781
+ logger.log(`sending screenBlackout action at ${blackoutTime}`);
1765
1782
  const message = {
1766
1783
  type: "remotePlayer.screenBlackout",
1767
1784
  class: "remotePlayer",
@@ -1790,16 +1807,16 @@ class RemotePlayer extends RemotePlayerInterface {
1790
1807
  }
1791
1808
  });
1792
1809
 
1793
- logger.log(`window.cefQuery for ${functionName} returned query id ${queryId}`);
1810
+ logger.log(`window.cefQuery for screenBlackout returned query id ${queryId}`);
1794
1811
  const timeout = this._remotePlayerConfirmationTimeout + 1000;
1795
1812
  timerId = setTimeout(() => {
1796
- logger.log(`${functionName} reached timeout of ${timeout} ms, canceling query id ${queryId}`);
1813
+ logger.log(`screenBlackout reached timeout of ${timeout} ms, canceling query id ${queryId}`);
1797
1814
  window.cefQueryCancel(queryId);
1798
- reject(new RemotePlayerError(6000, `${functionName} reached timeout of ${timeout} ms`));
1815
+ reject(new RemotePlayerError(6000, `screenBlackout reached timeout of ${timeout} ms`));
1799
1816
  }, timeout, queryId);
1800
1817
  });
1801
1818
  }
1802
- sdkLogger.error(`remotePlayer ${functionName}: window.cefQuery is undefined`);
1819
+ sdkLogger.error("screenBlackout: window.cefQuery is undefined");
1803
1820
  return Promise.resolve(undefined);
1804
1821
  }
1805
1822
  }
@@ -400,19 +400,24 @@ class RemotePlayer extends EventTarget {
400
400
  }
401
401
 
402
402
  /**
403
+ * The function sets a blackout time for the screen.
404
+ * The blackout time is the time when the screen will be blacked out.
405
+ * This is useful for parental controls where the screen should be blacked out during certain times
403
406
  *
404
407
  * @param {Date} date
405
408
  * @returns {Promise<void>} A Promise that resolves once the blackout time is set.
406
- * @throws {RemotePlayerError} If the player is not initialized or not loaded. if date is not a Date object or if the remote player api version is less than 2
409
+ * @throws {RemotePlayerError} If the player is not initialized or not loaded. if date is not a Date object or if the remote player api version is not supported
407
410
  */
408
411
  setScreenBlackout(date) {
409
412
  return noop("RemotePlayer.setScreenBlackout", date);
410
413
  }
411
414
 
412
415
  /**
416
+ * The function resets the currently set blackout time for the screen.
417
+ * This is useful for parental controls to be reset the blackout time after it has been set.
413
418
  *
414
419
  * @returns {Promise<void>} A Promise that resolves once the blackout time is reset.
415
- * @throws {RemotePlayerError} If the player is not initialized or not loaded. if the remote player api version is less than 2
420
+ * @throws {RemotePlayerError} If the player is not initialized or not loaded. if the remote player api version is not supported
416
421
  */
417
422
  resetScreenBlackout() {
418
423
  return noop("RemotePlayer.resetScreenBlackout");