-
+
+
@@ -52,7 +49,7 @@ import { Page } from '@vben/common-ui';
import ChannelTree from './channel-tree.vue';
import mpegts from 'mpegts.js';
import { message } from 'ant-design-vue';
-import { addFFmpegStreamProxy, addStreamProxy } from '#/api/sis/stream';
+import { addStreamProxy } from '#/api/sis/stream';
import {
Svg16FrameIcon,
Svg1FrameIcon,
@@ -296,8 +293,8 @@ function streamProxy(nodeData: any, cb: Function) {
if (isSupportH265) {
addStreamProxy(params).then((res) => cb(res));
} else {
- addFFmpegStreamProxy(params).then((res) => cb(res));
- // addStreamProxy(params).then((res) => cb(res));
+ // addFFmpegStreamProxy(params).then((res) => cb(res));
+ addStreamProxy(params).then((res) => cb(res));
}
}
@@ -310,7 +307,8 @@ function doPlayer(nodeData: any, index: number = 0) {
console.log('index=', index);
if (mpegts.isSupported()) {
streamProxy(nodeData, (res: AddStreamProxyResult) => {
- const url = res.wsFlv;
+ const host = window.location.host;
+ const url = `http://${host}/${res.app}/${res.streamId}.live.flv`;
// 将url 绑定到 nodeData
nodeData.url = url;
closePlayer(index);
@@ -337,7 +335,9 @@ function doPlayer(nodeData: any, index: number = 0) {
player.play();
playerList[index] = {
player,
+ key: nodeData.id,
data: nodeData,
+ el: videoElement,
};
} else {
console.log('视频播放元素获取异常');
@@ -381,10 +381,13 @@ function catchUp() {
if (playerData) {
const { player, el } = playerData;
const end = player.buffered.end(player.buffered.length - 1);
- const diff = end - el.currentTime;
- if (diff > 2) {
- // 如果延迟超过2秒
- el.currentTime = end - 0.5; // 跳转到接近直播点
+ const { currentTime } = el;
+ if (end && currentTime) {
+ const diff = end - el.currentTime;
+ if (diff > 2) {
+ // 如果延迟超过2秒
+ el.currentTime = end - 0.5; // 跳转到接近直播点
+ }
}
}
});