From 7a31bf7c2acf8017ab8839029a81fcb4fb23acc4 Mon Sep 17 00:00:00 2001 From: 86156 <823267011@qq.com> Date: Thu, 2 Oct 2025 15:14:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtsp-vue/src/views/video/device/component/flv.vue | 14 +++++++------- .../video/thread/MediaTransferFlvByJavacv.java | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/rtsp-vue/src/views/video/device/component/flv.vue b/rtsp-vue/src/views/video/device/component/flv.vue index b04cced..040e31a 100644 --- a/rtsp-vue/src/views/video/device/component/flv.vue +++ b/rtsp-vue/src/views/video/device/component/flv.vue @@ -30,7 +30,7 @@
- +
@@ -46,6 +46,7 @@ import {ref, onMounted} from 'vue'; import 'xgplayer'; import FlvJsPlayer from 'xgplayer-flv.js'; import CusPlayer from './cusPlayer.vue'; +import JpegPlayer from './jpegPlayer.vue'; import {getDevice} from "@/api/video/device"; const {proxy} = getCurrentInstance(); @@ -68,12 +69,11 @@ onMounted(() => { const getDetails = async (deviceId) => { const res = await getDevice(deviceId); tableData.value = res.data; - // 直接访问后端视频流服务器(10083端口),绕过Nginx反代,避免缓冲问题 - // 注意:RTSP URL需要原样传递,不要编码,&&&作为特殊分隔符 - // 🔧 测试:使用 JavaCV 方案(不使用 FFmpeg) - const videoServerUrl = 'http://49.232.154.205:10083'; - playUrl.value = `${videoServerUrl}/live?url=${tableData.value.url}`; // 不加 &&&ffmpeg=true - console.log('📺 播放地址(JavaCV 方案):', playUrl.value); + // 🔧 测试:使用 JavaCV 方案 + WebSocket(推送 JPEG 帧) + // WebSocket 地址格式: ws://host:port/live?url=rtsp://... + const videoServerUrl = 'ws://49.232.154.205:10083'; + playUrl.value = `${videoServerUrl}/live?url=${tableData.value.url}`; + console.log('📺 播放地址(JavaCV WebSocket 方案):', playUrl.value); handlePlay(); } diff --git a/ruoyi-video/src/main/java/com/ruoyi/video/thread/MediaTransferFlvByJavacv.java b/ruoyi-video/src/main/java/com/ruoyi/video/thread/MediaTransferFlvByJavacv.java index 18f84b8..cfbba74 100644 --- a/ruoyi-video/src/main/java/com/ruoyi/video/thread/MediaTransferFlvByJavacv.java +++ b/ruoyi-video/src/main/java/com/ruoyi/video/thread/MediaTransferFlvByJavacv.java @@ -214,6 +214,8 @@ public class MediaTransferFlvByJavacv extends MediaTransfer implements Runnable /** ================ 构造函数与初始化 ================ */ public MediaTransferFlvByJavacv(CameraDto camera) { cameraDto = camera; + running = true; // 初始化为 true,准备启动 + log.info("🎥 创建 JavaCV 媒体传输器: {}", camera.getUrl()); } public void setRun(boolean run) {