@x-edu/live-player 0.0.12 → 0.0.13

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.
@@ -25817,7 +25817,7 @@ module.exports = __webpack_require__(5666);
25817
25817
  /***/ 3006:
25818
25818
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
25819
25819
 
25820
- var _regeneratorRuntime = __webpack_require__(7757);
25820
+ var _regeneratorRuntime = __webpack_require__(5273);
25821
25821
 
25822
25822
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
25823
25823
 
@@ -30746,7 +30746,7 @@ var LIVING_CLOSE_LOGIN = {
30746
30746
  CLOSE: '1'
30747
30747
  }; // 子类型 1 网龙会议 2 外部推流 3 转播
30748
30748
 
30749
- var SUB_TYPE = {
30749
+ var publicLive_SUB_TYPE = {
30750
30750
  NET_DRAGON: 1,
30751
30751
  OUTSIDE: 2,
30752
30752
  REBROADCAST: 3
@@ -31762,7 +31762,7 @@ function _getOpenClassLiveBase() {
31762
31762
  data = _context14.sent;
31763
31763
  subType = data.sub_type; // 外部推流则直接返回, 不去请求兼容接口
31764
31764
 
31765
- if (!(subType === SUB_TYPE.OUTSIDE)) {
31765
+ if (!(subType === publicLive_SUB_TYPE.OUTSIDE)) {
31766
31766
  _context14.next = 7;
31767
31767
  break;
31768
31768
  }
@@ -32523,6 +32523,119 @@ function Loading_Loading(_ref) {
32523
32523
  wrapperClassName: classnames_default()('x-edu-nested-loading', wrapperClassName)
32524
32524
  }, children);
32525
32525
  }
32526
+ // EXTERNAL MODULE: ./node_modules/@sdp.nd/fish/es/loader/style/index.js
32527
+ var loader_style = __webpack_require__(4646);
32528
+ ;// CONCATENATED MODULE: ./src/util/push/index.js
32529
+
32530
+
32531
+
32532
+
32533
+ function push_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
32534
+
32535
+ function push_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { push_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { push_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
32536
+
32537
+ function push_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
32538
+
32539
+ function push_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
32540
+
32541
+ function push_createClass(Constructor, protoProps, staticProps) { if (protoProps) push_defineProperties(Constructor.prototype, protoProps); if (staticProps) push_defineProperties(Constructor, staticProps); return Constructor; }
32542
+
32543
+
32544
+ var push_url = '/3rd/im-web-push/index.umd.js';
32545
+ var push_loadJS = loader.loadJS;
32546
+ var instPromise; // http://git.sdp.nd/component-h5/web-im-push/-/tree/master
32547
+
32548
+ var ImPush = /*#__PURE__*/function () {
32549
+ function ImPush() {
32550
+ push_classCallCheck(this, ImPush);
32551
+
32552
+ this.listeners = [];
32553
+ }
32554
+
32555
+ push_createClass(ImPush, [{
32556
+ key: "init",
32557
+ value: function () {
32558
+ var _init = push_asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee() {
32559
+ return regenerator_default().wrap(function _callee$(_context) {
32560
+ while (1) {
32561
+ switch (_context.prev = _context.next) {
32562
+ case 0:
32563
+ if (!instPromise) {
32564
+ _context.next = 2;
32565
+ break;
32566
+ }
32567
+
32568
+ return _context.abrupt("return", instPromise);
32569
+
32570
+ case 2:
32571
+ instPromise = push_loadJS(push_url, 'ndiot_push').then(function () {
32572
+ window.ndiot_push.open({
32573
+ url: env["default"].push.host,
32574
+ appId: env["default"].app.appid,
32575
+ disableSharedWorker: true
32576
+ });
32577
+ return window.ndiot_push;
32578
+ });
32579
+ return _context.abrupt("return", instPromise);
32580
+
32581
+ case 4:
32582
+ case "end":
32583
+ return _context.stop();
32584
+ }
32585
+ }
32586
+ }, _callee);
32587
+ }));
32588
+
32589
+ function init() {
32590
+ return _init.apply(this, arguments);
32591
+ }
32592
+
32593
+ return init;
32594
+ }()
32595
+ }, {
32596
+ key: "getInstance",
32597
+ value: function getInstance() {
32598
+ return window.ndiot_push;
32599
+ }
32600
+ }, {
32601
+ key: "addTopicListener",
32602
+ value: function addTopicListener(name, listener) {
32603
+ var inst = this.getInstance();
32604
+ this.listeners.push(listener);
32605
+ inst.subscribe(name);
32606
+ this.listen();
32607
+ }
32608
+ }, {
32609
+ key: "removeTopicListener",
32610
+ value: function removeTopicListener(name, listener) {
32611
+ var inst = this.getInstance();
32612
+ this.listeners = this.listeners.filter(function (l) {
32613
+ return l !== listener;
32614
+ });
32615
+ inst.unsubscribe(name);
32616
+ this.listen();
32617
+ }
32618
+ }, {
32619
+ key: "listen",
32620
+ value: function listen() {
32621
+ var _this = this;
32622
+
32623
+ var inst = this.getInstance();
32624
+
32625
+ inst.onNewMessage = function (data) {
32626
+ console.log('im-push', data);
32627
+
32628
+ _this.listeners.forEach(function (l) {
32629
+ l(data);
32630
+ });
32631
+ };
32632
+ }
32633
+ }]);
32634
+
32635
+ return ImPush;
32636
+ }();
32637
+
32638
+ /* harmony default export */ var push = (new ImPush());
32526
32639
  ;// CONCATENATED MODULE: ./src/util/object.js
32527
32640
  function pick(obj, keys) {
32528
32641
  if (!Array.isArray(keys)) {
@@ -33264,8 +33377,8 @@ function usePullSource_isSourceReady(_x) {
33264
33377
  }
33265
33378
 
33266
33379
  function hook_usePullSource_isSourceReady() {
33267
- hook_usePullSource_isSourceReady = usePullSource_asyncToGenerator( /*#__PURE__*/runtime_regenerator_default().mark(function _callee(url) {
33268
- return runtime_regenerator_default().wrap(function _callee$(_context) {
33380
+ hook_usePullSource_isSourceReady = usePullSource_asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(url) {
33381
+ return regenerator_default().wrap(function _callee$(_context) {
33269
33382
  while (1) {
33270
33383
  switch (_context.prev = _context.next) {
33271
33384
  case 0:
@@ -33370,8 +33483,7 @@ function LiveStatus_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33370
33483
 
33371
33484
 
33372
33485
  function LiveStatus(_ref) {
33373
- var isStreamLive = _ref.isStreamLive,
33374
- handleLogin = _ref.handleLogin,
33486
+ var handleLogin = _ref.handleLogin,
33375
33487
  userInfo = _ref.userInfo,
33376
33488
  liveInfo = _ref.liveInfo,
33377
33489
  hasPlayed = _ref.hasPlayed,
@@ -33402,7 +33514,8 @@ function LiveStatus(_ref) {
33402
33514
  var isCompleted = liveInfo.status === publicLive_PUBLIC_LIVE_STATUS.COMPLETEED;
33403
33515
  var isPaused = liveInfo.status === publicLive_PUBLIC_LIVE_STATUS.PASUED;
33404
33516
  var isOffline = liveInfo.status === publicLive_PUBLIC_LIVE_STATUS.OFFLINE;
33405
- var isRecordLive = liveInfo.type === PUBLIC_LIVE_MODE.RECORDED; // 当前时间是否在回放时间开始前, 如果没有回放开始时间, 则直接判断未回放还没生成
33517
+ var isRecordLive = liveInfo.type === PUBLIC_LIVE_MODE.RECORDED;
33518
+ var isStreamLive = liveInfo.type === PUBLIC_LIVE_MODE.LIVING && (liveInfo.sub_type === SUB_TYPE.OUTSIDE || liveInfo.sub_type === SUB_TYPE.REBROADCAST); // 当前时间是否在回放时间开始前, 如果没有回放开始时间, 则直接判断未回放还没生成
33406
33519
 
33407
33520
  var isBeforeRecordTime = liveInfo.replay_begin_time ? dayjs_min_default()().isBefore(dayjs_min_default()(liveInfo.replay_begin_time)) : true;
33408
33521
  var mustLogin = !userInfo && liveInfo.login;
@@ -33581,8 +33694,7 @@ function RecordVideo_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33581
33694
 
33582
33695
 
33583
33696
  function RecordVideo(_ref) {
33584
- var isStreamLive = _ref.isStreamLive,
33585
- userInfo = _ref.userInfo,
33697
+ var userInfo = _ref.userInfo,
33586
33698
  liveInfo = _ref.liveInfo,
33587
33699
  visitTime = _ref.visitTime,
33588
33700
  diffTime = _ref.diffTime,
@@ -33723,7 +33835,6 @@ function RecordVideo(_ref) {
33723
33835
  options: options,
33724
33836
  onReady: handleVideoReady
33725
33837
  }), /*#__PURE__*/external_commonjs_react_commonjs2_react_root_React_default().createElement(detail_LiveStatus, {
33726
- isStreamLive: isStreamLive,
33727
33838
  userInfo: userInfo,
33728
33839
  visitTime: visitTime,
33729
33840
  diffTime: diffTime,
@@ -33735,8 +33846,6 @@ function RecordVideo(_ref) {
33735
33846
  onReloadLive: handleVideoReload
33736
33847
  }));
33737
33848
  }
33738
- // EXTERNAL MODULE: ./node_modules/@sdp.nd/fish/es/loader/style/index.js
33739
- var loader_style = __webpack_require__(4646);
33740
33849
  ;// CONCATENATED MODULE: ./src/component/AliPlayer/index.jsx
33741
33850
 
33742
33851
 
@@ -44356,8 +44465,7 @@ var shouldfixedLoading = window.navigator.userAgent.indexOf('iPad') > -1 || wind
44356
44465
  function LiveVideo(_ref) {
44357
44466
  var _liveInfo$imInfo9, _liveInfo$imInfo9$par;
44358
44467
 
44359
- var isStreamLive = _ref.isStreamLive,
44360
- handleLogin = _ref.handleLogin,
44468
+ var handleLogin = _ref.handleLogin,
44361
44469
  userInfo = _ref.userInfo,
44362
44470
  liveInfo = _ref.liveInfo,
44363
44471
  visitTime = _ref.visitTime,
@@ -44455,7 +44563,7 @@ function LiveVideo(_ref) {
44455
44563
  onRequestFullScreen();
44456
44564
  });
44457
44565
  aliPlayer.on('liveStreamStop', function (err) {
44458
- setIsLiveLoadError(true);
44566
+ setIsLiveException(true);
44459
44567
  console.warn("liveStreamStop: isOnline ".concat(window.navigator.onLine));
44460
44568
  console.error('liveStreamStop', err);
44461
44569
  });
@@ -44491,7 +44599,6 @@ function LiveVideo(_ref) {
44491
44599
  options: options,
44492
44600
  onReady: handleVideoReady
44493
44601
  }), supportM3u8 && /*#__PURE__*/external_commonjs_react_commonjs2_react_root_React_default().createElement(detail_LiveStatus, {
44494
- isStreamLive: isStreamLive,
44495
44602
  handleLogin: handleLogin,
44496
44603
  userInfo: userInfo,
44497
44604
  visitTime: visitTime,
@@ -55262,6 +55369,7 @@ function detail_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
55262
55369
 
55263
55370
 
55264
55371
 
55372
+
55265
55373
  // import IMChatroom from '@/component/IMChatroom'
55266
55374
 
55267
55375
 
@@ -55352,7 +55460,7 @@ function PublicLiveDetail(_ref) {
55352
55460
  userRole = loginInfo.userRole,
55353
55461
  loginStatus = loginInfo.loginStatus;
55354
55462
  var isLiveToReplay = !replay;
55355
- var isStreamLive = liveInfo && liveInfo.type === PUBLIC_LIVE_MODE.LIVING;
55463
+ var isStreamLive = liveInfo && liveInfo.type === PUBLIC_LIVE_MODE.LIVING && (liveInfo.sub_type === publicLive_SUB_TYPE.OUTSIDE || liveInfo.sub_type === publicLive_SUB_TYPE.REBROADCAST);
55356
55464
 
55357
55465
  var handleStatusChange = /*#__PURE__*/function () {
55358
55466
  var _ref2 = detail_asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(status) {
@@ -55377,7 +55485,7 @@ function PublicLiveDetail(_ref) {
55377
55485
  subType = liveInfo.sub_type, bid = liveInfo.bid, roomId = liveInfo.room_id;
55378
55486
  imLiveInfoResp = {}; // 如果类型为外部推流, 则去请求新的直播详情接口
55379
55487
 
55380
- if (!(subType === SUB_TYPE.OUTSIDE || subType === SUB_TYPE.REBROADCAST)) {
55488
+ if (!(subType === publicLive_SUB_TYPE.OUTSIDE || subType === publicLive_SUB_TYPE.REBROADCAST)) {
55381
55489
  _context.next = 14;
55382
55490
  break;
55383
55491
  }
@@ -55498,7 +55606,7 @@ function PublicLiveDetail(_ref) {
55498
55606
  subType = data.sub_type, bid = data.bid, roomId = data.room_id;
55499
55607
  imLiveInfoResp = {}; // 如果类型为外部推流, 则去请求新的直播详情接口
55500
55608
 
55501
- if (!(subType === SUB_TYPE.OUTSIDE || subType === SUB_TYPE.REBROADCAST)) {
55609
+ if (!(subType === publicLive_SUB_TYPE.OUTSIDE || subType === publicLive_SUB_TYPE.REBROADCAST)) {
55502
55610
  _context2.next = 26;
55503
55611
  break;
55504
55612
  }
@@ -55535,6 +55643,19 @@ function PublicLiveDetail(_ref) {
55535
55643
  data.imInfo = imLiveInfoResp;
55536
55644
 
55537
55645
  case 31:
55646
+ if (!(data.type === PUBLIC_LIVE_MODE.LIVING && data.sub_type === publicLive_SUB_TYPE.OUTSIDE)) {
55647
+ _context2.next = 34;
55648
+ break;
55649
+ }
55650
+
55651
+ _context2.next = 36;
55652
+ break;
55653
+
55654
+ case 34:
55655
+ _context2.next = 36;
55656
+ return push.init();
55657
+
55658
+ case 36:
55538
55659
  // 如果是转播或者是推流 直接播放(用于调试模式)
55539
55660
  _getUrlQuery2 = (0,url/* getUrlQuery */.pf)(), preview = _getUrlQuery2.preview; // 后台点预览会加这个参数
55540
55661
 
@@ -55543,7 +55664,7 @@ function PublicLiveDetail(_ref) {
55543
55664
  }) : data;
55544
55665
  setLiveInfo(generateInfo);
55545
55666
 
55546
- case 34:
55667
+ case 39:
55547
55668
  case "end":
55548
55669
  return _context2.stop();
55549
55670
  }
@@ -55558,6 +55679,31 @@ function PublicLiveDetail(_ref) {
55558
55679
 
55559
55680
  init();
55560
55681
  }, []);
55682
+ (0,external_commonjs_react_commonjs2_react_root_React_namespaceObject.useEffect)(function () {
55683
+ if (!liveInfo || liveInfo.sub_type === publicLive_SUB_TYPE.OUTSIDE) {
55684
+ return;
55685
+ }
55686
+
55687
+ var handler = function handler(data) {
55688
+ var _data$extraFields = data.extraFields,
55689
+ extraFields = _data$extraFields === void 0 ? {} : _data$extraFields;
55690
+ console.log('public Live:', data);
55691
+
55692
+ if (extraFields.event === PUBLIC_LIVE_PUSH_EVENT.STATUS_CHANGE && extraFields.liveId === liveId) {
55693
+ console.log("public Live: receive push status ".concat(parseInt(extraFields.status, 10)));
55694
+ handleStatusChange(parseInt(extraFields.status, 10));
55695
+ }
55696
+ };
55697
+
55698
+ push.addTopicListener("".concat(PUBLIC_LIVE_PUSH_TOPIC, "_").concat(liveId), handler);
55699
+ return function () {
55700
+ if (!liveInfo || liveInfo.sub_type === publicLive_SUB_TYPE.OUTSIDE) {
55701
+ return;
55702
+ }
55703
+
55704
+ push.removeTopicListener("".concat(PUBLIC_LIVE_PUSH_TOPIC, "_").concat(liveId), handler);
55705
+ };
55706
+ }, [!!liveInfo]);
55561
55707
  (0,external_commonjs_react_commonjs2_react_root_React_namespaceObject.useEffect)(function () {
55562
55708
  if (userInfo) {
55563
55709
  onReportProgress();
@@ -55684,7 +55830,6 @@ function PublicLiveDetail(_ref) {
55684
55830
  },
55685
55831
  onRequestFullScreen: handleRequestFullScreen
55686
55832
  }) : isRecordLive ? /*#__PURE__*/external_commonjs_react_commonjs2_react_root_React_default().createElement(RecordVideo, {
55687
- isStreamLive: isStreamLive,
55688
55833
  userInfo: userInfo,
55689
55834
  liveInfo: liveInfo,
55690
55835
  visitTime: visitTime,
@@ -55698,7 +55843,6 @@ function PublicLiveDetail(_ref) {
55698
55843
  },
55699
55844
  onRequestFullScreen: handleRequestFullScreen
55700
55845
  }) : /*#__PURE__*/external_commonjs_react_commonjs2_react_root_React_default().createElement(LiveVideo, {
55701
- isStreamLive: isStreamLive,
55702
55846
  handleLogin: handleLogin,
55703
55847
  userInfo: userInfo,
55704
55848
  liveInfo: liveInfo,
@@ -55712,7 +55856,7 @@ function PublicLiveDetail(_ref) {
55712
55856
  handleVideoPlay(true);
55713
55857
  },
55714
55858
  onRequestFullScreen: handleRequestFullScreen
55715
- })), !isReplayMode && !isRecordLive && liveInfo.sub_type !== SUB_TYPE.NET_DRAGON && liveInfo.status !== publicLive_PUBLIC_LIVE_STATUS.COMPLETEED && /*#__PURE__*/external_commonjs_react_commonjs2_react_root_React_default().createElement(LineSwitch, {
55859
+ })), !isReplayMode && !isRecordLive && isStreamLive && liveInfo.status !== publicLive_PUBLIC_LIVE_STATUS.COMPLETEED && /*#__PURE__*/external_commonjs_react_commonjs2_react_root_React_default().createElement(LineSwitch, {
55716
55860
  className: src_detail_index_module["live-line-switch"],
55717
55861
  liveInfo: liveInfo,
55718
55862
  onChange: handleSelectChange
@@ -61285,10 +61429,10 @@ function Action(_ref) {
61285
61429
  setCurAction = _useState2[1];
61286
61430
 
61287
61431
  var handleBtnClick = /*#__PURE__*/function () {
61288
- var _ref2 = Action_asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(e) {
61432
+ var _ref2 = Action_asyncToGenerator( /*#__PURE__*/runtime_regenerator_default().mark(function _callee(e) {
61289
61433
  var now, begin, _error$response, _error$response$data, _error$response2, _error$response2$data;
61290
61434
 
61291
- return regenerator_default().wrap(function _callee$(_context) {
61435
+ return runtime_regenerator_default().wrap(function _callee$(_context) {
61292
61436
  while (1) {
61293
61437
  switch (_context.prev = _context.next) {
61294
61438
  case 0: