@lox-audioserver/node-airplay-sender 0.4.3 → 0.4.4

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/dist/core/rtsp.js CHANGED
@@ -289,6 +289,13 @@ Client.prototype.setVolume = function (volume, callback) {
289
289
  this.sendNextRequest();
290
290
  };
291
291
  Client.prototype.setProgress = function (progress, duration, callback) {
292
+ if (this.airplay2) {
293
+ this.progress = progress;
294
+ this.duration = duration;
295
+ if (typeof callback === 'function')
296
+ callback();
297
+ return;
298
+ }
292
299
  if (this.status !== PLAYING)
293
300
  return;
294
301
  let normProgress = progress;
@@ -334,6 +341,12 @@ Client.prototype.sendHeartBeat = function (callback) {
334
341
  this.sendNextRequest();
335
342
  };
336
343
  Client.prototype.setTrackInfo = function (name, artist, album, callback) {
344
+ if (this.airplay2) {
345
+ this.trackInfo = { name, artist, album };
346
+ if (typeof callback === 'function')
347
+ callback();
348
+ return;
349
+ }
337
350
  if (this.status !== PLAYING)
338
351
  return;
339
352
  if (name != this.trackInfo?.name || artist != this.trackInfo?.artist || album != this.trackInfo?.album) {
@@ -1076,6 +1089,10 @@ Client.prototype.sendNextRequest = async function (di) {
1076
1089
  //this.logLine?.(request);
1077
1090
  break;
1078
1091
  case SETPROGRESS:
1092
+ if (this.airplay2) {
1093
+ this.status = PLAYING;
1094
+ break;
1095
+ }
1079
1096
  function hms(seconds) {
1080
1097
  const h = Math.floor(seconds / 3600);
1081
1098
  const m = Math.floor((seconds % 3600) / 60);
@@ -1096,6 +1113,10 @@ Client.prototype.sendNextRequest = async function (di) {
1096
1113
  //this.logLine?.(request);
1097
1114
  break;
1098
1115
  case SETDAAP:
1116
+ if (this.airplay2) {
1117
+ this.status = PLAYING;
1118
+ break;
1119
+ }
1099
1120
  let daapenc = true;
1100
1121
  //daapenc = true
1101
1122
  var name = this.daapEncode('minm', this.trackInfo.name, daapenc);
@@ -1647,16 +1668,21 @@ Client.prototype.processData = function (blob, rawData) {
1647
1668
  this.status = SETVOLUME;
1648
1669
  break;
1649
1670
  case SETVOLUME:
1650
- if (!this.sentFakeProgess) {
1651
- this.progress = 10;
1652
- this.duration = 2000000;
1653
- this.sentFakeProgess = true;
1654
- this.status = SETPROGRESS;
1671
+ if (this.airplay2) {
1672
+ this.status = PLAYING;
1655
1673
  }
1656
1674
  else {
1657
- this.status = PLAYING;
1675
+ if (!this.sentFakeProgess) {
1676
+ this.progress = 10;
1677
+ this.duration = 2000000;
1678
+ this.sentFakeProgess = true;
1679
+ this.status = SETPROGRESS;
1680
+ }
1681
+ else {
1682
+ this.status = PLAYING;
1683
+ }
1684
+ ;
1658
1685
  }
1659
- ;
1660
1686
  break;
1661
1687
  case SETPROGRESS:
1662
1688
  // After reporting progress, stay in PLAYING; avoid forcing FLUSH on every update.
@@ -289,6 +289,13 @@ Client.prototype.setVolume = function (volume, callback) {
289
289
  this.sendNextRequest();
290
290
  };
291
291
  Client.prototype.setProgress = function (progress, duration, callback) {
292
+ if (this.airplay2) {
293
+ this.progress = progress;
294
+ this.duration = duration;
295
+ if (typeof callback === 'function')
296
+ callback();
297
+ return;
298
+ }
292
299
  if (this.status !== PLAYING)
293
300
  return;
294
301
  let normProgress = progress;
@@ -334,6 +341,12 @@ Client.prototype.sendHeartBeat = function (callback) {
334
341
  this.sendNextRequest();
335
342
  };
336
343
  Client.prototype.setTrackInfo = function (name, artist, album, callback) {
344
+ if (this.airplay2) {
345
+ this.trackInfo = { name, artist, album };
346
+ if (typeof callback === 'function')
347
+ callback();
348
+ return;
349
+ }
337
350
  if (this.status !== PLAYING)
338
351
  return;
339
352
  if (name != this.trackInfo?.name || artist != this.trackInfo?.artist || album != this.trackInfo?.album) {
@@ -1076,6 +1089,10 @@ Client.prototype.sendNextRequest = async function (di) {
1076
1089
  //this.logLine?.(request);
1077
1090
  break;
1078
1091
  case SETPROGRESS:
1092
+ if (this.airplay2) {
1093
+ this.status = PLAYING;
1094
+ break;
1095
+ }
1079
1096
  function hms(seconds) {
1080
1097
  const h = Math.floor(seconds / 3600);
1081
1098
  const m = Math.floor((seconds % 3600) / 60);
@@ -1096,6 +1113,10 @@ Client.prototype.sendNextRequest = async function (di) {
1096
1113
  //this.logLine?.(request);
1097
1114
  break;
1098
1115
  case SETDAAP:
1116
+ if (this.airplay2) {
1117
+ this.status = PLAYING;
1118
+ break;
1119
+ }
1099
1120
  let daapenc = true;
1100
1121
  //daapenc = true
1101
1122
  var name = this.daapEncode('minm', this.trackInfo.name, daapenc);
@@ -1647,16 +1668,21 @@ Client.prototype.processData = function (blob, rawData) {
1647
1668
  this.status = SETVOLUME;
1648
1669
  break;
1649
1670
  case SETVOLUME:
1650
- if (!this.sentFakeProgess) {
1651
- this.progress = 10;
1652
- this.duration = 2000000;
1653
- this.sentFakeProgess = true;
1654
- this.status = SETPROGRESS;
1671
+ if (this.airplay2) {
1672
+ this.status = PLAYING;
1655
1673
  }
1656
1674
  else {
1657
- this.status = PLAYING;
1675
+ if (!this.sentFakeProgess) {
1676
+ this.progress = 10;
1677
+ this.duration = 2000000;
1678
+ this.sentFakeProgess = true;
1679
+ this.status = SETPROGRESS;
1680
+ }
1681
+ else {
1682
+ this.status = PLAYING;
1683
+ }
1684
+ ;
1658
1685
  }
1659
- ;
1660
1686
  break;
1661
1687
  case SETPROGRESS:
1662
1688
  // After reporting progress, stay in PLAYING; avoid forcing FLUSH on every update.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lox-audioserver/node-airplay-sender",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "AirPlay sender (RAOP/AirPlay 1; AirPlay 2 control/auth, best-effort audio)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",