@ray-js/ray-ipc-player 2.0.12 → 2.0.14

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.
Files changed (2) hide show
  1. package/lib/index.js +58 -15
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import "core-js/modules/es.array.includes.js";
5
+ import "core-js/modules/es.string.includes.js";
4
6
  import "core-js/modules/es.object.to-string.js";
5
7
  import "core-js/modules/es.promise.js";
6
8
  import "core-js/modules/es.array.concat.js";
@@ -179,6 +181,7 @@ var Player = function (props) {
179
181
  d.errorState = false;
180
182
  d.loadingState = isOnPreview ? false : true;
181
183
  }); // !prePlayRef.current && connectState && (await disconnect());
184
+ // console.log(connectState, isOnPreview, '当前链接状态和预览状态');
182
185
 
183
186
  ipcCtx.current && createConnect();
184
187
 
@@ -275,15 +278,55 @@ var Player = function (props) {
275
278
  params && onInitPreview && onInitPreview(devId);
276
279
  onChangeStreamStatus && onChangeStreamStatus(1002);
277
280
  },
278
- fail: function fail() {
279
- // console.error('开启失败:', devId);
280
- setPlayState(function (d) {
281
- d.errorState = true;
282
- d.loadingState = false;
283
- d.errorMsg = locals.getLang('ipc_player_preview_fail');
284
- });
285
- onChangeStreamStatus && onChangeStreamStatus(-1002);
286
- },
281
+ fail: function () {
282
+ var _fail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(e) {
283
+ var isOnPreview;
284
+ return _regeneratorRuntime.wrap(function (_context5) {
285
+ while (1) {
286
+ switch (_context5.prev = _context5.next) {
287
+ case 0:
288
+ _context5.next = 2;
289
+ return getIsOnPreview(ipcCtx.current);
290
+
291
+ case 2:
292
+ isOnPreview = _context5.sent;
293
+
294
+ if (!(!isOnPreview || e !== null && e !== void 0 && e.errorMsg.includes('doing preview'))) {
295
+ _context5.next = 7;
296
+ break;
297
+ }
298
+
299
+ // 忽略重复预览异常的报错
300
+ setPlayState(function (d) {
301
+ d.loadingState = false;
302
+ d.errorState = false;
303
+ d.errorMsg = '';
304
+ });
305
+ onChangeStreamStatus && onChangeStreamStatus(1002);
306
+ return _context5.abrupt("return");
307
+
308
+ case 7:
309
+ setPlayState(function (d) {
310
+ d.errorState = true;
311
+ d.loadingState = false;
312
+ d.errorMsg = locals.getLang('ipc_player_preview_fail');
313
+ });
314
+ onChangeStreamStatus && onChangeStreamStatus(-1002);
315
+
316
+ case 9:
317
+ case "end":
318
+ return _context5.stop();
319
+ }
320
+ }
321
+ }, _callee5);
322
+ }));
323
+
324
+ function fail() {
325
+ return _fail.apply(this, arguments);
326
+ }
327
+
328
+ return fail;
329
+ }(),
287
330
  complete: function complete() {
288
331
  // console.log('startPreview:', muteRef.current);
289
332
  setMuted(muteRef.current);
@@ -393,22 +436,22 @@ var Player = function (props) {
393
436
 
394
437
 
395
438
  var handleReWakeCamera = /*#__PURE__*/function () {
396
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
397
- return _regeneratorRuntime.wrap(function (_context5) {
439
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
440
+ return _regeneratorRuntime.wrap(function (_context6) {
398
441
  while (1) {
399
- switch (_context5.prev = _context5.next) {
442
+ switch (_context6.prev = _context6.next) {
400
443
  case 0:
401
- _context5.next = 2;
444
+ _context6.next = 2;
402
445
  return putDpData({
403
446
  105: false
404
447
  }, devId);
405
448
 
406
449
  case 2:
407
450
  case "end":
408
- return _context5.stop();
451
+ return _context6.stop();
409
452
  }
410
453
  }
411
- }, _callee5);
454
+ }, _callee6);
412
455
  }));
413
456
 
414
457
  return function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-player",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "ray小程序播放器",
5
5
  "keywords": [
6
6
  "tuya-miniapp",