Commit a1927dd398691b6d32b7977e45140d8935b14c98

Authored by xp.Huang
2 parents de7bb1b9 db6fdab2

Merge branch 'fix/DEFECT-1969' into 'main_dev'

fix: 隐藏视频组件无视频流时界面提示

See merge request yunteng/thingskit-front!1277
... ... @@ -94,8 +94,9 @@
94 94
95 95 function onDecodeError() {
96 96 console.warn('player happend decode error');
97   - playerRef.value?.destroy?.();
98   - initializePlayer();
  97 + // playerRef.value?.destroy?.();
  98 + // initializePlayer();
  99 + playerRef.value?.switchURL(props.url!);
99 100 }
100 101
101 102 function initializePlayer() {
... ... @@ -114,11 +115,31 @@
114 115 emits('ready', player);
115 116 });
116 117
117   - player.on(Events.ERROR, (error: IError) => {
118   - // https://h5player.bytedance.com/api/error.html#type
119   - if (error.errorCode === 5103) {
120   - onDecodeError();
121   - }
  118 + player.setEventsMiddleware({
  119 + error: (event, callback) => {
  120 + const code = (
  121 + event as unknown as {
  122 + error: MediaError;
  123 + }
  124 + ).error.code;
  125 + if (code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED) {
  126 + if (!props.url) {
  127 + return;
  128 + }
  129 + callback();
  130 + return;
  131 + }
  132 +
  133 + if (code === MediaError.MEDIA_ERR_DECODE) {
  134 + // 视频流可以播放 中途解码失败重载
  135 + if (playerRef.value?.isPlaying) {
  136 + onDecodeError();
  137 + }
  138 + return;
  139 + }
  140 +
  141 + callback();
  142 + },
122 143 });
123 144
124 145 player.on(Events.PAUSE, () => {
... ...
... ... @@ -293,9 +293,9 @@
293 293 height: 100%;
294 294 }
295 295
296   - .split-screen-mode:deep(.ant-spin-container) {
297   - height: 100% !important;
298   - }
  296 + // .split-screen-mode:deep(.ant-spin-container) {
  297 + //height: 100% !important;
  298 + // }
299 299
300 300 .video-container {
301 301 .video-container-mask {
... ...