@eluvio/elv-client-js 4.0.107 → 4.0.109

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.
@@ -108,7 +108,7 @@ var UserProfileClient = /*#__PURE__*/function () {
108
108
  });
109
109
  case 12:
110
110
  balance = _context.sent;
111
- if (!(balance < 0.1)) {
111
+ if (!(balance < 0.05)) {
112
112
  _context.next = 15;
113
113
  break;
114
114
  }
@@ -81,7 +81,7 @@ exports.ValidateDate = function (date) {
81
81
  };
82
82
  exports.ValidateUserWallet = /*#__PURE__*/function () {
83
83
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
84
- var address, client, walletAddress, balance;
84
+ var address, client, walletAddress;
85
85
  return _regeneratorRuntime.wrap(function _callee$(_context) {
86
86
  while (1) switch (_context.prev = _context.next) {
87
87
  case 0:
@@ -110,18 +110,6 @@ exports.ValidateUserWallet = /*#__PURE__*/function () {
110
110
  }
111
111
  throw Error("User address has no wallet: ".concat(address));
112
112
  case 12:
113
- _context.next = 14;
114
- return client.GetBalance({
115
- address: address
116
- });
117
- case 14:
118
- balance = _context.sent;
119
- if (!(balance < 0.1)) {
120
- _context.next = 17;
121
- break;
122
- }
123
- throw Error("User has no funds: ".concat(address));
124
- case 17:
125
113
  case "end":
126
114
  return _context.stop();
127
115
  }
@@ -427,7 +427,7 @@ var StreamGenerateOffering = /*#__PURE__*/function () {
427
427
  */
428
428
  exports.StreamStatus = /*#__PURE__*/function () {
429
429
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
430
- var name, _ref7$stopLro, stopLro, _ref7$showParams, showParams, objectId, status, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, period, tlro, videoLastFinalizationTimeEpochSec, videoFinalizedParts, sinceLastFinalize, recording_period, insertions, i, insertionTimeSinceEpoch, state, lroStatus, playout_urls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net, embed_url;
430
+ var name, _ref7$stopLro, stopLro, _ref7$showParams, showParams, objectId, status, libraryId, mainMeta, fabURI, edgeWriteToken, edgeMeta, recordings, sequence, period, tlro, videoLastFinalizationTimeEpochSec, videoFinalizedParts, sinceLastFinalize, recording_period, insertions, i, insertionTimeSinceEpoch, state, lroStatus, segDurationMeta, playout_urls, playout_options, hls_clear_enabled, hls_aes128_enabled, hls_sample_aes_enabled, networkInfo, token, embed_net, embed_url;
431
431
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
432
432
  while (1) switch (_context4.prev = _context4.next) {
433
433
  case 0:
@@ -605,107 +605,107 @@ exports.StreamStatus = /*#__PURE__*/function () {
605
605
  status.error = _context4.t3.response;
606
606
  return _context4.abrupt("return", status);
607
607
  case 89:
608
- // Convert LRO 'state' to desired 'state'
608
+ segDurationMeta = edgeMeta.live_recording.recording_config.recording_params.xc_params.seg_duration; // Convert LRO 'state' to desired 'state'
609
609
  if (state === "running" && videoLastFinalizationTimeEpochSec <= 0) {
610
610
  state = "starting";
611
- } else if (state === "running" && sinceLastFinalize > 32.9) {
611
+ } else if (state === "running" && segDurationMeta !== undefined && sinceLastFinalize > parseInt(segDurationMeta) + 5) {
612
612
  state = "stalled";
613
613
  } else if (state == "terminated") {
614
614
  state = "stopped";
615
615
  }
616
616
  status.state = state;
617
617
  if (!((state === "running" || state === "stalled" || state === "starting") && stopLro)) {
618
- _context4.next = 110;
618
+ _context4.next = 111;
619
619
  break;
620
620
  }
621
- _context4.next = 94;
621
+ _context4.next = 95;
622
622
  return this.FabricUrl({
623
623
  libraryId: libraryId,
624
624
  objectId: objectId,
625
625
  writeToken: edgeWriteToken,
626
626
  call: "live/stop/" + tlro
627
627
  });
628
- case 94:
628
+ case 95:
629
629
  lroStopUrl = _context4.sent;
630
- _context4.prev = 95;
630
+ _context4.prev = 96;
631
631
  _context4.t4 = this.utils;
632
- _context4.next = 99;
632
+ _context4.next = 100;
633
633
  return HttpClient.Fetch(lroStopUrl);
634
- case 99:
634
+ case 100:
635
635
  _context4.t5 = _context4.sent;
636
- _context4.next = 102;
636
+ _context4.next = 103;
637
637
  return _context4.t4.ResponseToJson.call(_context4.t4, _context4.t5);
638
- case 102:
638
+ case 103:
639
639
  console.log("LRO Stop: ", lroStatus.body);
640
- _context4.next = 108;
640
+ _context4.next = 109;
641
641
  break;
642
- case 105:
643
- _context4.prev = 105;
644
- _context4.t6 = _context4["catch"](95);
642
+ case 106:
643
+ _context4.prev = 106;
644
+ _context4.t6 = _context4["catch"](96);
645
645
  console.log("LRO Stop (failed): ", _context4.t6.response.statusCode);
646
- case 108:
646
+ case 109:
647
647
  state = "stopped";
648
648
  status.state = state;
649
- case 110:
649
+ case 111:
650
650
  if (!(state === "running")) {
651
- _context4.next = 141;
651
+ _context4.next = 142;
652
652
  break;
653
653
  }
654
654
  playout_urls = {};
655
- _context4.next = 114;
655
+ _context4.next = 115;
656
656
  return this.PlayoutOptions({
657
657
  objectId: objectId,
658
658
  linkPath: "public/asset_metadata/sources/default"
659
659
  });
660
- case 114:
660
+ case 115:
661
661
  playout_options = _context4.sent;
662
662
  hls_clear_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods.clear !== undefined;
663
663
  if (!hls_clear_enabled) {
664
- _context4.next = 120;
664
+ _context4.next = 121;
665
665
  break;
666
666
  }
667
- _context4.next = 119;
667
+ _context4.next = 120;
668
668
  return this.FabricUrl({
669
669
  libraryId: libraryId,
670
670
  objectId: objectId,
671
671
  rep: "playout/default/hls-clear/playlist.m3u8"
672
672
  });
673
- case 119:
674
- playout_urls.hls_clear = _context4.sent;
675
673
  case 120:
674
+ playout_urls.hls_clear = _context4.sent;
675
+ case 121:
676
676
  hls_aes128_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods["aes-128"] !== undefined;
677
677
  if (!hls_aes128_enabled) {
678
- _context4.next = 125;
678
+ _context4.next = 126;
679
679
  break;
680
680
  }
681
- _context4.next = 124;
681
+ _context4.next = 125;
682
682
  return this.FabricUrl({
683
683
  libraryId: libraryId,
684
684
  objectId: objectId,
685
685
  rep: "playout/default/hls-aes128/playlist.m3u8"
686
686
  });
687
- case 124:
688
- playout_urls.hls_aes128 = _context4.sent;
689
687
  case 125:
688
+ playout_urls.hls_aes128 = _context4.sent;
689
+ case 126:
690
690
  hls_sample_aes_enabled = playout_options && playout_options.hls && playout_options.hls.playoutMethods && playout_options.hls.playoutMethods["sample-aes"] !== undefined;
691
691
  if (!hls_sample_aes_enabled) {
692
- _context4.next = 130;
692
+ _context4.next = 131;
693
693
  break;
694
694
  }
695
- _context4.next = 129;
695
+ _context4.next = 130;
696
696
  return this.FabricUrl({
697
697
  libraryId: libraryId,
698
698
  objectId: objectId,
699
699
  rep: "playout/default/hls-sample-aes/playlist.m3u8"
700
700
  });
701
- case 129:
702
- playout_urls.hls_sample_aes = _context4.sent;
703
701
  case 130:
704
- _context4.next = 132;
702
+ playout_urls.hls_sample_aes = _context4.sent;
703
+ case 131:
704
+ _context4.next = 133;
705
705
  return this.NetworkInfo();
706
- case 132:
706
+ case 133:
707
707
  networkInfo = _context4.sent;
708
- _context4.next = 135;
708
+ _context4.next = 136;
709
709
  return this.authClient.AuthorizationToken({
710
710
  libraryId: libraryId,
711
711
  objectId: objectId,
@@ -713,7 +713,7 @@ exports.StreamStatus = /*#__PURE__*/function () {
713
713
  noCache: true,
714
714
  noAuth: true
715
715
  });
716
- case 135:
716
+ case 136:
717
717
  token = _context4.sent;
718
718
  embed_net = "main";
719
719
  if (networkInfo.name.includes("demo")) {
@@ -722,20 +722,20 @@ exports.StreamStatus = /*#__PURE__*/function () {
722
722
  embed_url = "https://embed.v3.contentfabric.io/?net=".concat(embed_net, "&p&ct=h&oid=").concat(objectId, "&mt=lv&ath=").concat(token);
723
723
  playout_urls.embed_url = embed_url;
724
724
  status.playout_urls = playout_urls;
725
- case 141:
726
- _context4.next = 146;
725
+ case 142:
726
+ _context4.next = 147;
727
727
  break;
728
- case 143:
729
- _context4.prev = 143;
728
+ case 144:
729
+ _context4.prev = 144;
730
730
  _context4.t7 = _context4["catch"](3);
731
731
  console.error(_context4.t7);
732
- case 146:
733
- return _context4.abrupt("return", status);
734
732
  case 147:
733
+ return _context4.abrupt("return", status);
734
+ case 148:
735
735
  case "end":
736
736
  return _context4.stop();
737
737
  }
738
- }, _callee4, this, [[3, 143], [34, 40], [69, 83], [95, 105]]);
738
+ }, _callee4, this, [[3, 144], [34, 40], [69, 83], [96, 106]]);
739
739
  }));
740
740
  return function (_x4) {
741
741
  return _ref8.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "4.0.107",
3
+ "version": "4.0.109",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -76,7 +76,7 @@ await client.userProfileClient.UserMetadata()
76
76
 
77
77
  // Don't attempt to create a user wallet if user has no funds
78
78
  const balance = await this.client.GetBalance({address: this.client.signer.address});
79
- if(balance < 0.1) {
79
+ if(balance < 0.05) {
80
80
  return undefined;
81
81
  }
82
82
 
package/src/Validation.js CHANGED
@@ -104,10 +104,4 @@ exports.ValidateUserWallet = async ({address, client}) => {
104
104
  if(!walletAddress) {
105
105
  throw Error(`User address has no wallet: ${address}`);
106
106
  }
107
-
108
- const balance = await client.GetBalance({address});
109
-
110
- if(balance < 0.1) {
111
- throw Error(`User has no funds: ${address}`);
112
- }
113
107
  };
@@ -515,10 +515,12 @@ exports.StreamStatus = async function({name, stopLro=false, showParams=false}) {
515
515
  return status;
516
516
  }
517
517
 
518
+ const segDurationMeta = edgeMeta.live_recording.recording_config.recording_params.xc_params.seg_duration
519
+
518
520
  // Convert LRO 'state' to desired 'state'
519
521
  if(state === "running" && videoLastFinalizationTimeEpochSec <= 0) {
520
522
  state = "starting";
521
- } else if(state === "running" && sinceLastFinalize > 32.9) {
523
+ } else if(state === "running" && segDurationMeta !== undefined && sinceLastFinalize > (parseInt(segDurationMeta) + 5)) {
522
524
  state = "stalled";
523
525
  } else if(state == "terminated") {
524
526
  state = "stopped";