Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
d2102ac20a |
2
apps/web-antd/src/api/sis/stream/model.d.ts
vendored
2
apps/web-antd/src/api/sis/stream/model.d.ts
vendored
@@ -1,5 +1,7 @@
|
|||||||
export interface AddStreamProxyResult {
|
export interface AddStreamProxyResult {
|
||||||
key:string;
|
key:string;
|
||||||
|
app:string;
|
||||||
|
streamId:string;
|
||||||
rtsp:string;
|
rtsp:string;
|
||||||
rtmp:string;
|
rtmp:string;
|
||||||
flv:string;
|
flv:string;
|
||||||
|
@@ -2,11 +2,8 @@
|
|||||||
<Page class="h-full w-full">
|
<Page class="h-full w-full">
|
||||||
<!-- 设备分组区域 -->
|
<!-- 设备分组区域 -->
|
||||||
<div class="flex h-full gap-[8px]">
|
<div class="flex h-full gap-[8px]">
|
||||||
<div class="h-full pb-[5px] c-tree bg-background">
|
<div class="c-tree bg-background h-full pb-[5px]">
|
||||||
<ChannelTree
|
<ChannelTree class="w-[300px]" @check="onNodeChecked" />
|
||||||
class="w-[300px]"
|
|
||||||
@check="onNodeChecked"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 设备分组区域 -->
|
<!-- 设备分组区域 -->
|
||||||
@@ -52,7 +49,7 @@ import { Page } from '@vben/common-ui';
|
|||||||
import ChannelTree from './channel-tree.vue';
|
import ChannelTree from './channel-tree.vue';
|
||||||
import mpegts from 'mpegts.js';
|
import mpegts from 'mpegts.js';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { addFFmpegStreamProxy, addStreamProxy } from '#/api/sis/stream';
|
import { addStreamProxy } from '#/api/sis/stream';
|
||||||
import {
|
import {
|
||||||
Svg16FrameIcon,
|
Svg16FrameIcon,
|
||||||
Svg1FrameIcon,
|
Svg1FrameIcon,
|
||||||
@@ -296,8 +293,8 @@ function streamProxy(nodeData: any, cb: Function) {
|
|||||||
if (isSupportH265) {
|
if (isSupportH265) {
|
||||||
addStreamProxy(params).then((res) => cb(res));
|
addStreamProxy(params).then((res) => cb(res));
|
||||||
} else {
|
} else {
|
||||||
addFFmpegStreamProxy(params).then((res) => cb(res));
|
// addFFmpegStreamProxy(params).then((res) => cb(res));
|
||||||
// addStreamProxy(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);
|
console.log('index=', index);
|
||||||
if (mpegts.isSupported()) {
|
if (mpegts.isSupported()) {
|
||||||
streamProxy(nodeData, (res: AddStreamProxyResult) => {
|
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
|
// 将url 绑定到 nodeData
|
||||||
nodeData.url = url;
|
nodeData.url = url;
|
||||||
closePlayer(index);
|
closePlayer(index);
|
||||||
@@ -337,7 +335,9 @@ function doPlayer(nodeData: any, index: number = 0) {
|
|||||||
player.play();
|
player.play();
|
||||||
playerList[index] = {
|
playerList[index] = {
|
||||||
player,
|
player,
|
||||||
|
key: nodeData.id,
|
||||||
data: nodeData,
|
data: nodeData,
|
||||||
|
el: videoElement,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log('视频播放元素获取异常');
|
console.log('视频播放元素获取异常');
|
||||||
@@ -381,10 +381,13 @@ function catchUp() {
|
|||||||
if (playerData) {
|
if (playerData) {
|
||||||
const { player, el } = playerData;
|
const { player, el } = playerData;
|
||||||
const end = player.buffered.end(player.buffered.length - 1);
|
const end = player.buffered.end(player.buffered.length - 1);
|
||||||
const diff = end - el.currentTime;
|
const { currentTime } = el;
|
||||||
if (diff > 2) {
|
if (end && currentTime) {
|
||||||
// 如果延迟超过2秒
|
const diff = end - el.currentTime;
|
||||||
el.currentTime = end - 0.5; // 跳转到接近直播点
|
if (diff > 2) {
|
||||||
|
// 如果延迟超过2秒
|
||||||
|
el.currentTime = end - 0.5; // 跳转到接近直播点
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user