From a24b367a5b3b3c4c7ff3515d3c5d938b99a6aa43 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Mon, 7 Jul 2025 17:23:51 +0800 Subject: [PATCH 01/16] build: v1.3.0+37 --- App.vue | 2 +- pages/p2p/p2pPlayer.vue | 14 ++- .../xhj-record/utssdk/app-ios/hybrid.swift | 113 +++++++++--------- .../xhj-tencent-xp2p/utssdk/app-ios/index.uts | 6 +- 4 files changed, 67 insertions(+), 68 deletions(-) diff --git a/App.vue b/App.vue index 43adea6..412bcca 100644 --- a/App.vue +++ b/App.vue @@ -31,7 +31,7 @@ return 'XHJ' } // #endif - return 'DEV' + return 'XHJ' } }, computed: { diff --git a/pages/p2p/p2pPlayer.vue b/pages/p2p/p2pPlayer.vue index 7f287bf..4bc006d 100644 --- a/pages/p2p/p2pPlayer.vue +++ b/pages/p2p/p2pPlayer.vue @@ -250,7 +250,7 @@ return data }) - const cleanupResources = () => { + const cleanupResources = async () => { if (cleanupCalled.value) return cleanupCalled.value = true @@ -263,8 +263,8 @@ } releaseRecord() if (deviceInfo.value) { - stopSendServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`) - stopServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`) + await stopSendServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`) + await stopServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`) } // #endif // #ifdef MP-WEIXIN @@ -545,8 +545,12 @@ // #endif } - const callback = audioData => { - dataSendFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`, audioData) + const callback = async audioData => { + console.log('传输数据', audioData) + await dataSendFunction( + `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`, + audioData + ) } const handlePlaySuccess = () => { diff --git a/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift b/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift index c5194f2..09a47b8 100644 --- a/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift +++ b/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift @@ -49,62 +49,69 @@ public class AudioRecorderManager: NSObject { return } - let session = AVAudioSession.sharedInstance() - do { - try session.setCategory(.playAndRecord, mode: .default, options: .defaultToSpeaker) - try session.setPreferredSampleRate(16000.0) - try session.setPreferredInputNumberOfChannels(1) - try session.setActive(true) - } catch { - completion(nil, false, "Failed to set up audio session: \(error.localizedDescription)") - return - } + if audioEngine == nil { + let session = AVAudioSession.sharedInstance() + do { + try session.setCategory(.playAndRecord, mode: .default, options: .defaultToSpeaker) + try session.setPreferredSampleRate(16000.0) + try session.setPreferredInputNumberOfChannels(1) + try session.setActive(true) + } catch { + completion(nil, false, "Failed to set up audio session: \(error.localizedDescription)") + return + } - audioEngine = AVAudioEngine() - guard let audioEngine = audioEngine else { - completion(nil, false, "Failed to create audio engine") - return - } + audioEngine = AVAudioEngine() + guard let audioEngine = audioEngine else { + completion(nil, false, "Failed to create audio engine") + return + } - let inputNode = audioEngine.inputNode - let inputFormat = inputNode.outputFormat(forBus: 0) + let inputNode = audioEngine.inputNode + let inputFormat = inputNode.outputFormat(forBus: 0) - var outputFormatDescription = AudioStreamBasicDescription( - mSampleRate: 16000.0, - mFormatID: kAudioFormatMPEG4AAC, - mFormatFlags: 2, - mBytesPerPacket: 0, - mFramesPerPacket: 1024, - mBytesPerFrame: 0, - mChannelsPerFrame: 1, - mBitsPerChannel: 0, - mReserved: 0 - ) + var outputFormatDescription = AudioStreamBasicDescription( + mSampleRate: 16000.0, + mFormatID: kAudioFormatMPEG4AAC, + mFormatFlags: 2, + mBytesPerPacket: 0, + mFramesPerPacket: 1024, + mBytesPerFrame: 0, + mChannelsPerFrame: 1, + mBitsPerChannel: 0, + mReserved: 0 + ) - guard let outputFormat = AVAudioFormat(streamDescription: &outputFormatDescription) else { - completion(nil, false, "Failed to create output audio format") - return - } + guard let outputFormat = AVAudioFormat(streamDescription: &outputFormatDescription) else { + completion(nil, false, "Failed to create output audio format") + return + } - guard let converter = AVAudioConverter(from: inputFormat, to: outputFormat) else { - completion(nil, false, "Failed to create audio converter") - return - } - self.audioConverter = converter + guard let converter = AVAudioConverter(from: inputFormat, to: outputFormat) else { + completion(nil, false, "Failed to create audio converter") + return + } + self.audioConverter = converter - self.aacBuffer = AVAudioCompressedBuffer( - format: outputFormat, - packetCapacity: 1, - maximumPacketSize: converter.maximumOutputPacketSize - ) + self.aacBuffer = AVAudioCompressedBuffer( + format: outputFormat, + packetCapacity: 1, + maximumPacketSize: converter.maximumOutputPacketSize + ) - inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputFormat) { [weak self] (pcmBuffer, when) in - guard let self = self, self.isRecording else { return } - self.convert(pcmBuffer: pcmBuffer, completion: completion) - } + inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputFormat) { [weak self] (pcmBuffer, when) in + guard let self = self, self.isRecording else { return } + self.convert(pcmBuffer: pcmBuffer, completion: completion) + } - do { audioEngine.prepare() + } + + do { + guard let audioEngine = audioEngine else { + completion(nil, false, "Audio engine not initialized.") + return + } try audioEngine.start() self.isRecording = true completion(nil, true, "Recording started") @@ -193,19 +200,7 @@ public class AudioRecorderManager: NSObject { return } self.isRecording = false - audioEngine?.stop() - audioEngine?.inputNode.removeTap(onBus: 0) - audioEngine = nil - audioConverter = nil - aacBuffer = nil - - do { - try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation) - } catch { - print("Failed to deactivate audio session: \(error)") - } - completion(true, "Recording stopped", "") } diff --git a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts index e4cde93..2266e08 100644 --- a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts @@ -132,7 +132,7 @@ export const runSendServiceFunction = async function ( crypto: boolean ): Promise { try { - const result = runSendService(id, cmd, crypto) + const result = await runSendService(id, cmd, crypto) console.log('开始发送服务', result) return { code: 0, @@ -178,8 +178,8 @@ export const dataSendFunction = async function (id: string, data: Array) } try { - const result = dataSend(id, buffer, data.length) - // console.log('发送数据结果', result) + const result = await dataSend(id, buffer, data.length) + console.log('发送数据结果', result) XP2PDataHelper.deallocateBytes(buffer) From 61b32567e603a55dec0dcbe7a0d24cf34fa33088 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Tue, 8 Jul 2025 09:18:31 +0800 Subject: [PATCH 02/16] fix: fix bug --- pages/p2p/p2pPlayer.vue | 4 ++-- pages/user/login.vue | 6 +++--- uni_modules/xhj-record/utssdk/app-ios/hybrid.swift | 2 +- uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pages/p2p/p2pPlayer.vue b/pages/p2p/p2pPlayer.vue index 4bc006d..790d932 100644 --- a/pages/p2p/p2pPlayer.vue +++ b/pages/p2p/p2pPlayer.vue @@ -546,11 +546,11 @@ } const callback = async audioData => { - console.log('传输数据', audioData) - await dataSendFunction( + const result = await dataSendFunction( `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`, audioData ) + console.log(`数据传输结果:${result.data.result}`, audioData) } const handlePlaySuccess = () => { diff --git a/pages/user/login.vue b/pages/user/login.vue index c58f46b..f218b2e 100644 --- a/pages/user/login.vue +++ b/pages/user/login.vue @@ -94,10 +94,10 @@ abbreviation: 'CN', group: 'Z' }) - const username = ref('') - const password = ref('') + const username = ref('18174429647') + const password = ref('..022059') - const select = ref(false) + const select = ref(true) const pending = ref(false) diff --git a/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift b/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift index 09a47b8..1783300 100644 --- a/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift +++ b/uni_modules/xhj-record/utssdk/app-ios/hybrid.swift @@ -77,7 +77,7 @@ public class AudioRecorderManager: NSObject { mBytesPerPacket: 0, mFramesPerPacket: 1024, mBytesPerFrame: 0, - mChannelsPerFrame: 1, + mChannelsPerFrame: inputFormat.channelCount, mBitsPerChannel: 0, mReserved: 0 ) diff --git a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts index 2266e08..cb74ac9 100644 --- a/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts +++ b/uni_modules/xhj-tencent-xp2p/utssdk/app-ios/index.uts @@ -179,13 +179,14 @@ export const dataSendFunction = async function (id: string, data: Array) try { const result = await dataSend(id, buffer, data.length) - console.log('发送数据结果', result) XP2PDataHelper.deallocateBytes(buffer) return { code: 0, - data: {}, + data: { + result: result + }, message: '成功' } } catch (error) { From 2e23eaadd70548e583e9d4cc22651d4376908fd0 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Tue, 8 Jul 2025 10:24:49 +0800 Subject: [PATCH 03/16] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dpicker=E7=9A=84U?= =?UTF-8?q?I=20bug=20=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E9=80=BB=E8=BE=91bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/setting/autoLock.vue | 1 - pages/setting/customCatEye.vue | 2 -- pages/setting/faceSetting.vue | 2 -- pages/setting/notOpenDoor.vue | 1 - pages/setting/uploadLockData.vue | 11 +++++++++-- pages/setting/videoSlot.vue | 2 -- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pages/setting/autoLock.vue b/pages/setting/autoLock.vue index e3f958c..936354c 100644 --- a/pages/setting/autoLock.vue +++ b/pages/setting/autoLock.vue @@ -51,7 +51,6 @@ :defaultIndex="picker" title="选择时间" keyName="name" - :itemHeight="70" :visibleItemCount="5" @close="show = false" @cancel="show = false" diff --git a/pages/setting/customCatEye.vue b/pages/setting/customCatEye.vue index e90cc89..550581e 100644 --- a/pages/setting/customCatEye.vue +++ b/pages/setting/customCatEye.vue @@ -68,7 +68,6 @@ :show="showRecordingTime" :columns="recordingTimeList" keyName="name" - :itemHeight="70" title="有人出现时录像" :visibleItemCount="5" :defaultIndex="[recordingTimeIndex]" @@ -80,7 +79,6 @@ :show="showDetectionDistance" :columns="detectionDistanceList" title="人体侦测距离" - :itemHeight="70" :visibleItemCount="5" keyName="name" :defaultIndex="[detectionDistanceIndex]" diff --git a/pages/setting/faceSetting.vue b/pages/setting/faceSetting.vue index e404eb4..c5bde89 100644 --- a/pages/setting/faceSetting.vue +++ b/pages/setting/faceSetting.vue @@ -61,7 +61,6 @@ :defaultIndex="[distanceIndex]" title="感应距离" keyName="name" - :itemHeight="70" :visibleItemCount="5" @close="showDistance = false" @cancel="showDistance = false" @@ -73,7 +72,6 @@ :defaultIndex="[enErrUnlock]" title="防误开" keyName="name" - :itemHeight="70" :visibleItemCount="5" @close="showEnErrUnlock = false" @cancel="showEnErrUnlock = false" diff --git a/pages/setting/notOpenDoor.vue b/pages/setting/notOpenDoor.vue index c0c9dee..235ac35 100644 --- a/pages/setting/notOpenDoor.vue +++ b/pages/setting/notOpenDoor.vue @@ -61,7 +61,6 @@ Date: Tue, 8 Jul 2025 10:33:26 +0800 Subject: [PATCH 04/16] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0appUnlockOnline?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/setting/setting.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index a2afb14..425316b 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -446,6 +446,10 @@ pending.value = false uni.hideLoading() if (code === 0) { + if (key === 'appUnlockOnline') { + $bluetooth.currentLockInfo.appUnlockOnline = + $bluetooth.currentLockSetting.lockSettingInfo[key] === 1 ? 0 : 1 + } $bluetooth.updateCurrentLockSetting({ ...$bluetooth.currentLockSetting, lockSettingInfo: { From 0e2b845f72b1e0c21077c8c8dd68119f8c2c4b30 Mon Sep 17 00:00:00 2001 From: fanpeng <438123081@qq.com> Date: Tue, 8 Jul 2025 10:41:42 +0800 Subject: [PATCH 05/16] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF=EF=BC=8C=E6=98=8E=E7=A1=AE=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E5=9C=A8APP=E4=B8=8A=E6=89=BE=E5=9B=9E=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=92=8C=E7=99=BB=E5=BD=95=E6=96=B0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=82=AE=E7=AE=B1=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/updateEmail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/user/updateEmail.vue b/pages/user/updateEmail.vue index 441b380..daea8a1 100644 --- a/pages/user/updateEmail.vue +++ b/pages/user/updateEmail.vue @@ -1,6 +1,6 @@