diff --git a/manifest.json b/manifest.json index 535a253..529278f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "海驰24", "appid" : "__UNI__7302921", "description" : "111", - "versionName" : "1.2.1", - "versionCode" : 102, + "versionName" : "1.2.6", + "versionCode" : 106, "transformPx" : false, "app-plus" : { "usingComponents" : true, @@ -20,7 +20,7 @@ }, "distribute" : { "android" : { - "minSdkVersion" : 21, + "minSdkVersion" : 24, "permissions" : [ "", "", @@ -36,7 +36,7 @@ "", "" ], - "abiFilters" : [ "armeabi-v7a" ] + "abiFilters" : [ "arm64-v8a" ] }, "ios" : { "dSYMs" : false, diff --git a/nativeplugins/ry-ipc-video/android/ipc-video-plugin-release.aar b/nativeplugins/ry-ipc-video/android/ipc-video-plugin-release.aar deleted file mode 100644 index f1f486c..0000000 Binary files a/nativeplugins/ry-ipc-video/android/ipc-video-plugin-release.aar and /dev/null differ diff --git a/nativeplugins/ry-ipc-video/android/libs/p2plibrary-release.aar b/nativeplugins/ry-ipc-video/android/libs/p2plibrary-release.aar deleted file mode 100644 index 750ddfc..0000000 Binary files a/nativeplugins/ry-ipc-video/android/libs/p2plibrary-release.aar and /dev/null differ diff --git a/nativeplugins/ry-ipc-video/android/ry-ipc-video.aar b/nativeplugins/ry-ipc-video/android/ry-ipc-video.aar new file mode 100644 index 0000000..f1b0bb6 Binary files /dev/null and b/nativeplugins/ry-ipc-video/android/ry-ipc-video.aar differ diff --git a/nativeplugins/ry-ipc-video/package.json b/nativeplugins/ry-ipc-video/package.json index 7e18d03..9d4f040 100644 --- a/nativeplugins/ry-ipc-video/package.json +++ b/nativeplugins/ry-ipc-video/package.json @@ -14,10 +14,10 @@ } ], "integrateType": "aar", - "minSdkVersion": "21", + "minSdkVersion": "24", "permissions": [ "android.permission.CHANGE_WIFI_MULTICAST_STATE" ] } } -} +} \ No newline at end of file diff --git a/package_a/monitor/monitor.nvue b/package_a/monitor/monitor.nvue index e9ce448..075f042 100644 --- a/package_a/monitor/monitor.nvue +++ b/package_a/monitor/monitor.nvue @@ -9,6 +9,9 @@ ref="ipcVideo" class="ipc-video" :uid="deviceUid" + :channel="currentChannel" + :streamType="currentStreamType" + :isNvr="isNvr" @onStatus="onVideoStatusChange"> @@ -25,6 +28,35 @@ 状态:{{ statusMsg }} + + + + 设备类型: + + 单体(IPC) + 主机(NVR) + + + + + 通道: + + CH1 + CH2 + CH3 + CH4 + + + + + 清晰度: + + 高清 + 标清 + + + + @@ -36,21 +68,72 @@ export default { data() { return { - deviceUid: 'HLTY020667DHKCD', // 默认使用你 Demo 里的测试 UID + deviceUid: 'HLTY000072FFGGG', // 默认使用你 Demo 里的测试 UID isPlaying: false, - statusMsg: '等待操作' + statusMsg: '等待操作', + currentChannel: 0, // 0对应CH1, 1对应CH2... + currentStreamType: 1, // 1为高清(主码流),2为标清(子码流) + isNvr: false // 是否为 NVR 设备 } }, onLoad(options) { if (options && options.uid) { this.deviceUid = options.uid; } + // 如果上个页面传了 isNvr 参数,这里可以接收 + if (options && typeof options.isNvr !== 'undefined') { + // options.isNvr 通常传过来是字符串 'true' 或 'false' + this.isNvr = options.isNvr === 'true'; + } }, onUnload() { // 页面卸载时停止播放,释放资源 this.stopPlay(); }, methods: { + changeNvr(isNvrFlag) { + if (this.isNvr === isNvrFlag) return; + this.isNvr = isNvrFlag; + + // 如果切换到了单体 IPC,通道强制归 0 + if (!isNvrFlag) { + this.currentChannel = 0; + } + + // 如果正在播放,切换设备类型后需要完全重新连接并播放 + if (this.isPlaying) { + this.stopPlay(); + setTimeout(() => { + this.startPlay(); + }, 1000); // 切换设备类型可能需要稍长一点的时间断开重连 + } + }, + changeChannel(ch) { + if (this.currentChannel === ch) return; + this.currentChannel = ch; + // 如果正在播放,切换通道后重新播放 + if (this.isPlaying) { + this.stopPlay(); + setTimeout(() => { + this.startPlay(); + }, 500); + } + }, + changeStream(type) { + if (this.currentStreamType === type) return; + this.currentStreamType = type; + // 如果有单独切换清晰度的方法可以调用,如果没有就重启播放 + if (this.isPlaying) { + if (this.$refs.ipcVideo && typeof this.$refs.ipcVideo.setStreamType === 'function') { + this.$refs.ipcVideo.setStreamType(type); + } else { + this.stopPlay(); + setTimeout(() => { + this.startPlay(); + }, 500); + } + } + }, startPlay() { // #ifdef APP-PLUS if (this.$refs.ipcVideo) { @@ -84,31 +167,58 @@ // #endif }, onVideoStatusChange(e) { - console.log("视频状态改变:", e.detail); - // 根据我们在 Java 封装里写的 fireEventStatus 传回的 msg 显示 - if (e.detail) { - // 提取参数 - const status = e.detail.status; - const msg = e.detail.msg; - const msgParam = e.detail.msgParam; + try { + console.log("视频状态改变:", e); + // 根据我们在 Java 封装里写的 fireEventStatus 传回的 msg 显示 + if (e && e.detail) { + // 提取参数 + const status = e.detail.status; + const msg = e.detail.msg; + const msgParam = e.detail.msgParam; - // 更新页面显示的文字状态 - if (msg) { - this.statusMsg = msg; - } + // 更新页面显示的文字状态 + if (msg) { + this.statusMsg = msg; + } - // 处理特定的连接错误状态 - if (status === 'error' || msgParam === 7 || msgParam === 14) { + // 捕获来自 Java 层主动抛出的原生崩溃错误 + if (status === 'error' && msg && msg.indexOf('原生启动崩溃') !== -1) { + uni.showModal({ + title: '原生插件崩溃', + content: msg, + showCancel: false + }); + this.isPlaying = false; + return; + } + + // 处理特定的连接错误状态 + if (status === 'error' || msgParam === 7 || msgParam === 14) { + uni.showToast({ + title: msg ? msg : '摄像机离线,请检查设备网络', + icon: 'none', + duration: 3000 + }); + // 可以在这里做一些重置操作 + this.isPlaying = false; + } else if (status === 'playing') { + this.isPlaying = true; + } + } else { + // 如果 e.detail 是空对象或者 undefined,提示异常 + console.error("收到空的状态事件:", e); uni.showToast({ - title: '摄像机离线,请检查设备网络', - icon: 'none', - duration: 3000 + title: '收到空状态,原生可能发生异常', + icon: 'none' }); - // 可以在这里做一些重置操作 - this.isPlaying = false; - } else if (status === 'playing') { - this.isPlaying = true; } + } catch (err) { + console.error("解析状态回调时发生前端异常:", err); + uni.showModal({ + title: '前端回调解析异常', + content: err.toString(), + showCancel: false + }); } } } @@ -181,4 +291,35 @@ color: #ffffff; font-size: 30rpx; } +.settings-panel { + padding: 20rpx; + margin-top: 20rpx; + background-color: #ffffff; +} +.setting-row { + flex-direction: row; + align-items: center; + margin-bottom: 20rpx; +} +.setting-label { + font-size: 28rpx; + color: #333333; + width: 120rpx; +} +.options-group { + flex-direction: row; + flex: 1; +} +.option-btn { + padding: 10rpx 20rpx; + font-size: 26rpx; + color: #666666; + background-color: #f0f0f0; + border-radius: 8rpx; + margin-right: 20rpx; +} +.active-btn { + color: #ffffff; + background-color: #007aff; +} \ No newline at end of file