@ray-js/ray-ipc-player 2.0.26 → 2.0.28
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/config/errCodeConfig.js +1 -1
- package/lib/index.js +28 -13
- package/lib/typings/index.d.ts +24 -0
- package/lib/utils.js +14 -10
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export const errCodeLabs = [{
|
|
|
24
24
|
type: 'feedBackDirectly',
|
|
25
25
|
try: true,
|
|
26
26
|
help: false,
|
|
27
|
-
feedBack:
|
|
27
|
+
feedBack: true,
|
|
28
28
|
suggestedText: Strings.getLang('ipc_player_suggest_feed_back_err_factory_text'),
|
|
29
29
|
helpFeedBack: false,
|
|
30
30
|
codes: ['-1021', '-10008', '-41001', '-39', '-30082', '-30083', '-40301', '-40302', '-40303', '-41000', '-40206']
|
package/lib/index.js
CHANGED
|
@@ -56,7 +56,11 @@ const Player = props => {
|
|
|
56
56
|
onPlayerContainerTap,
|
|
57
57
|
reConnect = false,
|
|
58
58
|
awakeStatus = undefined,
|
|
59
|
-
ignoreHideStopPreview = false
|
|
59
|
+
ignoreHideStopPreview = false,
|
|
60
|
+
onChangeIgnoreHideStopPreview,
|
|
61
|
+
hideSuggestedText = false,
|
|
62
|
+
hideHelpButton = false,
|
|
63
|
+
hideFeedBackButton = false
|
|
60
64
|
} = props;
|
|
61
65
|
const {
|
|
62
66
|
borderRadius,
|
|
@@ -123,19 +127,21 @@ const Player = props => {
|
|
|
123
127
|
const muteRef = useRef(defaultMute); // 静音
|
|
124
128
|
|
|
125
129
|
usePageEvent('onShow', useMemoizedFn(async () => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
retry();
|
|
130
|
+
if (ignoreHideStopPreview) {
|
|
131
|
+
onChangeIgnoreHideStopPreview && onChangeIgnoreHideStopPreview(false);
|
|
132
|
+
return;
|
|
130
133
|
}
|
|
131
|
-
}));
|
|
132
|
-
usePageEvent('onShow', () => {
|
|
133
134
|
getNetworkType({
|
|
134
135
|
success: res => {
|
|
135
136
|
setPhoneNetworkConnect(res.networkType !== 'none');
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
|
-
|
|
139
|
+
// 视图准备就绪
|
|
140
|
+
if (phoneNetworkConnect && playState.initLy && ipcCtx.current && onlineStatus && !privateState) {
|
|
141
|
+
ipcTTTOperatorLog('VID: onShow_event_to_retry');
|
|
142
|
+
retry();
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
139
145
|
usePageEvent('onResize', sizeData => {
|
|
140
146
|
const {
|
|
141
147
|
type
|
|
@@ -180,19 +186,18 @@ const Player = props => {
|
|
|
180
186
|
onDpDataChange(handleDpDataChange);
|
|
181
187
|
}, []);
|
|
182
188
|
usePageEvent('onHide', useMemoizedFn(async () => {
|
|
183
|
-
setPlayState(d => {
|
|
184
|
-
d.loadingState = true;
|
|
185
|
-
});
|
|
186
189
|
if (ignoreHideStopPreview) {
|
|
187
190
|
return;
|
|
188
191
|
}
|
|
192
|
+
setPlayState(d => {
|
|
193
|
+
d.loadingState = true;
|
|
194
|
+
});
|
|
189
195
|
// 先停流
|
|
190
196
|
stopPreview();
|
|
191
197
|
// await getCurMute();
|
|
192
198
|
}));
|
|
193
199
|
useMount(() => {
|
|
194
200
|
onNetworkStatusChange(res => {
|
|
195
|
-
console.log(res, 'res==========onNetworkStatusChange');
|
|
196
201
|
setPhoneNetworkConnect(res.isConnected);
|
|
197
202
|
if (!res.isConnected) {
|
|
198
203
|
// 断网,需要主动调用断流以及断开P2P
|
|
@@ -803,7 +808,6 @@ const Player = props => {
|
|
|
803
808
|
return Strings.getLang('ipc_player_no_line');
|
|
804
809
|
}
|
|
805
810
|
if (videoErrCode !== '') {
|
|
806
|
-
console.log(Strings["ipc_player_error_".concat(codeCoverToInt(videoErrCode))], '多语言');
|
|
807
811
|
if (Strings["ipc_player_error_".concat(codeCoverToInt(videoErrCode))]) {
|
|
808
812
|
return "".concat(Strings.getLang("ipc_player_error_".concat(codeCoverToInt(videoErrCode))), "(").concat(videoErrCode, ")");
|
|
809
813
|
}
|
|
@@ -815,16 +819,21 @@ const Player = props => {
|
|
|
815
819
|
/**
|
|
816
820
|
* 根据自定义类型获取错误码展示内容
|
|
817
821
|
*/
|
|
822
|
+
|
|
818
823
|
const getErrorContentByType = useMemoizedFn((errCode, type) => {
|
|
819
824
|
const errContent = getErrCodeDetailDataByCode(String(errCode));
|
|
820
825
|
const contentEmpty = _isEmpty(errContent);
|
|
821
826
|
switch (type) {
|
|
822
827
|
// 是否展示建议文案
|
|
823
828
|
case 'suggestedFlag':
|
|
829
|
+
if (hideSuggestedText) {
|
|
830
|
+
return false;
|
|
831
|
+
}
|
|
824
832
|
if (contentEmpty) {
|
|
825
833
|
return false;
|
|
826
834
|
}
|
|
827
835
|
return errContent.suggestedText !== '';
|
|
836
|
+
|
|
828
837
|
// 建议文案
|
|
829
838
|
case 'suggestedText':
|
|
830
839
|
if (contentEmpty || privateState) {
|
|
@@ -864,6 +873,9 @@ const Player = props => {
|
|
|
864
873
|
}
|
|
865
874
|
return Strings.getLang('ipc_player_retry');
|
|
866
875
|
case 'help':
|
|
876
|
+
if (hideHelpButton) {
|
|
877
|
+
return false;
|
|
878
|
+
}
|
|
867
879
|
if (!phoneNetworkConnect || privateState) {
|
|
868
880
|
return false;
|
|
869
881
|
}
|
|
@@ -889,6 +901,9 @@ const Player = props => {
|
|
|
889
901
|
}
|
|
890
902
|
return errContent.helpNum;
|
|
891
903
|
case 'feedBack':
|
|
904
|
+
if (hideFeedBackButton) {
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
892
907
|
if (!phoneNetworkConnect) {
|
|
893
908
|
return true;
|
|
894
909
|
}
|
package/lib/typings/index.d.ts
CHANGED
|
@@ -186,4 +186,28 @@ export type IProps = {
|
|
|
186
186
|
* @default false
|
|
187
187
|
*/
|
|
188
188
|
ignoreHideStopPreview?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* @description.en onChangeIgnoreHideStopPreview
|
|
191
|
+
* @description.zh 更新 ignoreHideStopPreview 数据
|
|
192
|
+
* @default (data) => void
|
|
193
|
+
*/
|
|
194
|
+
onChangeIgnoreHideStopPreview?: (data: boolean) => void;
|
|
195
|
+
/**
|
|
196
|
+
* @description.en hide suggested text
|
|
197
|
+
* @description.zh 隐藏建议文案
|
|
198
|
+
* @default (data) => void
|
|
199
|
+
*/
|
|
200
|
+
hideSuggestedText?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* @description.en hide help button
|
|
203
|
+
* @description.zh 隐藏反馈帮助按钮
|
|
204
|
+
* @default (data) => void
|
|
205
|
+
*/
|
|
206
|
+
hideHelpButton?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* @description.en hide feedback button
|
|
209
|
+
* @description.zh 隐藏反馈按钮
|
|
210
|
+
* @default (data) => void
|
|
211
|
+
*/
|
|
212
|
+
hideFeedBackButton?: boolean;
|
|
189
213
|
};
|
package/lib/utils.js
CHANGED
|
@@ -158,14 +158,18 @@ export const ipcTTTOperatorLog = ipcLogString => {
|
|
|
158
158
|
*/
|
|
159
159
|
export const wakeUpDevice = deviceId => {
|
|
160
160
|
ipcTTTOperatorLog('start publish wakeUpDevice');
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
try {
|
|
162
|
+
ty.device.wakeUpDevice({
|
|
163
|
+
deviceId,
|
|
164
|
+
dps: {},
|
|
165
|
+
success: () => {
|
|
166
|
+
ipcTTTOperatorLog('publish wakeUpDevice success');
|
|
167
|
+
},
|
|
168
|
+
fail: () => {
|
|
169
|
+
ipcTTTOperatorLog('publish wakeUpDevice fail');
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
} catch (err) {
|
|
173
|
+
console.log('wakeUpDevice error', err);
|
|
174
|
+
}
|
|
171
175
|
};
|