@ray-js/ray-ipc-player 2.0.14 → 2.0.17-beta-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 +13 -12
- package/lib/typings/index.d.ts +6 -0
- package/package.json +7 -1
package/lib/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var Player = function (props) {
|
|
|
43
43
|
ptzControllable = _props$ptzControllabl === void 0 ? true : _props$ptzControllabl,
|
|
44
44
|
_props$clarity = props.clarity,
|
|
45
45
|
clarity = _props$clarity === void 0 ? 'normal' : _props$clarity,
|
|
46
|
+
ipcPlayerContext = props.ipcPlayerContext,
|
|
46
47
|
onCtx = props.onCtx,
|
|
47
48
|
_props$playerStyle = props.playerStyle,
|
|
48
49
|
playerStyle = _props$playerStyle === void 0 ? {
|
|
@@ -83,6 +84,13 @@ var Player = function (props) {
|
|
|
83
84
|
|
|
84
85
|
var ipcCtx = useRef(null); // ipc实例
|
|
85
86
|
|
|
87
|
+
if (!ipcCtx.current) {
|
|
88
|
+
var _ty;
|
|
89
|
+
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
ipcCtx.current = ipcPlayerContext || ((_ty = ty) === null || _ty === void 0 ? void 0 : _ty.createIpcPlayerContext(devId));
|
|
92
|
+
}
|
|
93
|
+
|
|
86
94
|
var retryCount = useRef(0); // 重试次数
|
|
87
95
|
|
|
88
96
|
var muteRef = useRef(defaultMute); // 静音
|
|
@@ -109,15 +117,13 @@ var Player = function (props) {
|
|
|
109
117
|
while (1) {
|
|
110
118
|
switch (_context2.prev = _context2.next) {
|
|
111
119
|
case 0:
|
|
112
|
-
// console.log('hide');
|
|
113
120
|
setPlayState(function (d) {
|
|
114
121
|
d.loadingState = true;
|
|
115
|
-
});
|
|
116
|
-
_context2.next = 3;
|
|
117
|
-
return getCurMute();
|
|
122
|
+
}); // 先停流
|
|
118
123
|
|
|
119
|
-
case 3:
|
|
120
124
|
stopPreview();
|
|
125
|
+
_context2.next = 4;
|
|
126
|
+
return getCurMute();
|
|
121
127
|
|
|
122
128
|
case 4:
|
|
123
129
|
case "end":
|
|
@@ -127,7 +133,7 @@ var Player = function (props) {
|
|
|
127
133
|
}, _callee2);
|
|
128
134
|
})));
|
|
129
135
|
useEffect(function () {
|
|
130
|
-
onlineStatus && createIpcCtx(
|
|
136
|
+
onlineStatus && createIpcCtx();
|
|
131
137
|
return function () {
|
|
132
138
|
disconnect();
|
|
133
139
|
ipcCtx.current = null;
|
|
@@ -203,12 +209,7 @@ var Player = function (props) {
|
|
|
203
209
|
!privateState && _retry();
|
|
204
210
|
}, [playState.connectState, privateState]); // 创建ipc实例
|
|
205
211
|
|
|
206
|
-
var createIpcCtx = function (
|
|
207
|
-
var _ty;
|
|
208
|
-
|
|
209
|
-
// @ts-ignore
|
|
210
|
-
ipcCtx.current = (_ty = ty) === null || _ty === void 0 ? void 0 : _ty.createIpcPlayerContext(id); // console.log('创建实例:', devId);
|
|
211
|
-
|
|
212
|
+
var createIpcCtx = function () {
|
|
212
213
|
onCtx && onCtx({
|
|
213
214
|
ctx: ipcCtx.current,
|
|
214
215
|
retry: retry
|
package/lib/typings/index.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ export type IProps = {
|
|
|
42
42
|
* @default ""
|
|
43
43
|
*/
|
|
44
44
|
updateLayout?: any;
|
|
45
|
+
/**
|
|
46
|
+
* @description.en IPC Player instance. If not passed, an instance will be generated inside the component.
|
|
47
|
+
* @description.zh IPC Player实例,如果不传组件内部会生成实例
|
|
48
|
+
* @default ""
|
|
49
|
+
*/
|
|
50
|
+
ipcPlayerContext?: IpcContext;
|
|
45
51
|
/**
|
|
46
52
|
* @description.en onChangeStreamStatus
|
|
47
53
|
* @description.zh 通知视频流状态发生变化
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ray-ipc-player",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17-beta-beta-1",
|
|
4
4
|
"description": "ray小程序播放器",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tuya-miniapp",
|
|
@@ -45,6 +45,12 @@
|
|
|
45
45
|
"lint-staged": "^10.2.11",
|
|
46
46
|
"standard-version": "9.3.2"
|
|
47
47
|
},
|
|
48
|
+
"resolutions": {
|
|
49
|
+
"follow-redirects": "1.15.6",
|
|
50
|
+
"shell-quote": "1.7.3",
|
|
51
|
+
"@babel/traverse": "7.23.2",
|
|
52
|
+
"decode-uri-component": "0.2.1"
|
|
53
|
+
},
|
|
48
54
|
"husky": {
|
|
49
55
|
"hooks": {
|
|
50
56
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS --config commitlint.config.js"
|