@ray-js/ray-ipc-player 2.0.1 → 2.0.3-beta-1
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/lib/index.js +20 -27
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -85,8 +85,10 @@ var Player = function (props) {
|
|
|
85
85
|
// console.log('show');
|
|
86
86
|
if (ipcCtx.current && playState.connectState) {
|
|
87
87
|
startPreview('');
|
|
88
|
+
} else if (ipcCtx.current) {
|
|
89
|
+
retry();
|
|
88
90
|
}
|
|
89
|
-
}, [playState.connectState]));
|
|
91
|
+
}, [playState.connectState, privateState]));
|
|
90
92
|
usePageEvent('onHide', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
91
93
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
92
94
|
while (1) {
|
|
@@ -108,17 +110,14 @@ var Player = function (props) {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
}, _callee);
|
|
111
|
-
})));
|
|
112
|
-
|
|
113
|
+
})));
|
|
113
114
|
useEffect(function () {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}, [privateState]);
|
|
115
|
+
onlineStatus && createIpcCtx(devId);
|
|
116
|
+
return function () {
|
|
117
|
+
disconnect();
|
|
118
|
+
ipcCtx.current = null;
|
|
119
|
+
};
|
|
120
|
+
}, [devId, onlineStatus]);
|
|
122
121
|
useEffect(function () {
|
|
123
122
|
muteRef.current = defaultMute;
|
|
124
123
|
}, [defaultMute]);
|
|
@@ -126,11 +125,12 @@ var Player = function (props) {
|
|
|
126
125
|
setPlayState(function (d) {
|
|
127
126
|
d.updateLy = updateLayout;
|
|
128
127
|
});
|
|
129
|
-
}, [updateLayout]); //
|
|
128
|
+
}, [updateLayout]); // 设备离线、隐私模式
|
|
130
129
|
|
|
131
130
|
useEffect(function () {
|
|
132
131
|
setPlayState(function (d) {
|
|
133
132
|
d.deviceOnlineState = onlineStatus;
|
|
133
|
+
d.errorState = privateState;
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
if (!onlineStatus) {
|
|
@@ -138,13 +138,13 @@ var Player = function (props) {
|
|
|
138
138
|
d.errorState = true;
|
|
139
139
|
d.errorMsg = locals.getLang('ipc_player_no_line');
|
|
140
140
|
});
|
|
141
|
-
} else if (playState.initLy) {
|
|
141
|
+
} else if (playState.initLy && !privateState) {
|
|
142
142
|
retry();
|
|
143
143
|
}
|
|
144
|
-
}, [onlineStatus, playState.initLy]); // 重试
|
|
144
|
+
}, [onlineStatus, playState.initLy, privateState]); // 重试
|
|
145
145
|
|
|
146
146
|
var _retry = /*#__PURE__*/function () {
|
|
147
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
147
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(connectState) {
|
|
148
148
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
149
149
|
while (1) {
|
|
150
150
|
switch (_context2.prev = _context2.next) {
|
|
@@ -155,7 +155,7 @@ var Player = function (props) {
|
|
|
155
155
|
d.errorState = false;
|
|
156
156
|
d.loadingState = true;
|
|
157
157
|
});
|
|
158
|
-
_context2.t0 =
|
|
158
|
+
_context2.t0 = connectState;
|
|
159
159
|
|
|
160
160
|
if (!_context2.t0) {
|
|
161
161
|
_context2.next = 5;
|
|
@@ -166,7 +166,7 @@ var Player = function (props) {
|
|
|
166
166
|
return disconnect();
|
|
167
167
|
|
|
168
168
|
case 5:
|
|
169
|
-
createConnect();
|
|
169
|
+
ipcCtx.current && createConnect();
|
|
170
170
|
|
|
171
171
|
case 6:
|
|
172
172
|
case "end":
|
|
@@ -183,7 +183,7 @@ var Player = function (props) {
|
|
|
183
183
|
|
|
184
184
|
var retry = useCallback(function () {
|
|
185
185
|
// console.log('retry:', muteRef.current);
|
|
186
|
-
!privateState && _retry();
|
|
186
|
+
!privateState && _retry(playState.connectState);
|
|
187
187
|
}, [playState.connectState, privateState]); // 创建ipc实例
|
|
188
188
|
|
|
189
189
|
var createIpcCtx = function (id) {
|
|
@@ -196,15 +196,8 @@ var Player = function (props) {
|
|
|
196
196
|
ctx: ipcCtx.current,
|
|
197
197
|
retry: retry
|
|
198
198
|
});
|
|
199
|
-
};
|
|
199
|
+
}; // 建立连接
|
|
200
200
|
|
|
201
|
-
useEffect(function () {
|
|
202
|
-
onlineStatus && createIpcCtx(devId);
|
|
203
|
-
return function () {
|
|
204
|
-
disconnect();
|
|
205
|
-
ipcCtx.current = null;
|
|
206
|
-
};
|
|
207
|
-
}, [devId, onlineStatus]); // 建立连接
|
|
208
201
|
|
|
209
202
|
var createConnect = function (params) {
|
|
210
203
|
var _ipcCtx$current;
|
|
@@ -432,7 +425,7 @@ var Player = function (props) {
|
|
|
432
425
|
autoPauseIfNavigate: false,
|
|
433
426
|
autoPauseIfOpenNative: false,
|
|
434
427
|
muted: defaultMute,
|
|
435
|
-
objectFit: "
|
|
428
|
+
objectFit: "contain",
|
|
436
429
|
clarity: clarity,
|
|
437
430
|
rotateZ: rotateZ,
|
|
438
431
|
scalable: scalable,
|