From ad58b16d00b2e57a7d0ff53580cc59050c17c766 Mon Sep 17 00:00:00 2001 From: wangyan <405898180@qq.com> Date: Fri, 31 Oct 2025 19:46:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(video):=E9=87=8D=E6=9E=84=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E7=9B=91=E6=8E=A7=E6=A8=A1=E5=9D=97=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AE=9E=E6=97=B6=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除旧的 DahuaVideoController 控制器及相关接口 - 在 NetSDKService 中实现基于 FFmpeg 的实时流转码与推送逻辑 - 新增对 H.264 和 HEVC 编码格式的识别与动态转码支持 - 实现 FLV 流封装及 WebSocket 推送机制 - 添加 WebSocket 会话管理与多用户连接跟踪 - 更新平台视频管理控制器中的通道标识字段 - 配置文件中增加大华设备连接参数- 调整日志级别为 debug 以便于开发调试 - 完善资源清理逻辑,确保登出时释放所有相关句柄和进程 --- .../video_manager/components/playVideo.vue | 601 ++++++++++++++---- .../video_manager/video_manager/index.vue | 61 +- 2 files changed, 504 insertions(+), 158 deletions(-) diff --git a/src/views/video_manager/video_manager/components/playVideo.vue b/src/views/video_manager/video_manager/components/playVideo.vue index 1d9cb79..ad27230 100644 --- a/src/views/video_manager/video_manager/components/playVideo.vue +++ b/src/views/video_manager/video_manager/components/playVideo.vue @@ -1,22 +1,19 @@ diff --git a/src/views/video_manager/video_manager/index.vue b/src/views/video_manager/video_manager/index.vue index 8823e61..8de001a 100644 --- a/src/views/video_manager/video_manager/index.vue +++ b/src/views/video_manager/video_manager/index.vue @@ -18,8 +18,8 @@ 重置 - 播放后台转码视频播放实时视频(WebRTC) @@ -106,12 +106,11 @@ @get-data="fnResetPagination" /> - + @@ -130,8 +129,10 @@ import {ElMessage, ElMessageBox} from "element-plus"; import SelectingPoints from "./components/selecting_points.vue"; import LayoutVideo from "@/components/video/index.vue"; import {setVideoManagerList} from "@/request/eightwork_videomanager.js"; -import PlayVideo from "@/views/video_manager/video_manager/components/playVideo.vue"; // 引入新播放器组件 -import {startTransCode, stopTransCode} from "@/request/video_info.js"; // 转码接口 +import PlayVideo from "@/views/video_manager/video_manager/components/playVideo.vue"; + +// 更新相关导入 +import {startWebRtcStream, stopWebRtcStream} from "@/request/webrtc.js"; const data = reactive({ addDialog: { @@ -155,42 +156,32 @@ const data = reactive({ videomanagerId: "", visible: false, }, - transcodeVideoDialog: { + webRtcVideoDialog: { visible: false, - src: "http://localhost:8100/api/hls/stream.m3u8", // 后端转码后HLS流的访问路径 id: "", }, }); -// 启动转码并显示播放器 -const handleStartTranscode = async () => { +// 启动WebRTC流并显示播放器 +const handleStartWebRtcStream = async () => { try { - await startTransCode(); // 调用后端“启动转码”接口 - data.transcodeVideoDialog.visible = true; // 显示播放器弹窗 + // 这里应该选择一个默认视频或让用户选择 + await startWebRtcStream(); + data.webRtcVideoDialog.visible = true; } catch (error) { - ElMessage.error("启动转码失败: " + (error.message || "未知错误")); + ElMessage.error("启动实时视频流失败: " + (error.message || "未知错误")); } }; -// 转码停止后的回调 -const onTranscodeStopped = async () => { - await stopTransCode(); // 调用后端“停止转码”接口 +// WebRTC流停止后的回调 +const onWebRtcStreamStopped = async () => { + await stopWebRtcStream(); }; // 列表数据逻辑(保持不变) const {list, pagination, searchForm, fnGetData, fnResetPagination} = useListData(getHkVideoManagerList); -// 其他方法(保持不变) -// const fnSetPositioning = async (row) => { -// data.selectingPointsDialog.id = row.PLS_ID ? row.PLS_ID : ""; -// data.selectingPointsDialog.indexCode = row.indexCode; -// data.selectingPointsDialog.regionPathName = row.regionPathName; -// data.selectingPointsDialog.camName = row.name; -// data.selectingPointsDialog.videomanagerId = row.videomanagerId; -// data.selectingPointsDialog.visible = true; -// }; - const fnUpToBi = async (videomanagerId) => { await ElMessageBox.confirm("确定要置顶吗?置顶后将会默认展示在Bi页", { type: "warning", @@ -201,13 +192,11 @@ const fnUpToBi = async (videomanagerId) => { const fnPreviewVideo = async (row) => { try { - const resData = await startTransCode({url: row.url, id: row.PLS_ID}); // 调用后端“启动转码”接口 - data.transcodeVideoDialog.visible = true; // 显示播放器弹窗 - data.transcodeVideoDialog.id = row.PLS_ID; // 显示播放器弹窗 - data.transcodeVideoDialog.src = - "http://172.16.70.226:7811/" + resData.videoUrl + "stream.m3u8"; + await startWebRtcStream({url: row.url, id: row.PLS_ID}); + data.webRtcVideoDialog.visible = true; + data.webRtcVideoDialog.id = row.PLS_ID; } catch (error) { - ElMessage.error("启动转码失败: " + (error.message || "未知错误")); + ElMessage.error("启动实时视频流失败: " + (error.message || "未知错误")); } }; @@ -233,4 +222,4 @@ const fnDeleteVideo = async (row) => { }; - + \ No newline at end of file