build: v1.3.0+37

This commit is contained in:
fanpeng 2025-07-07 17:23:51 +08:00
parent 89fca5a450
commit a24b367a5b
4 changed files with 67 additions and 68 deletions

View File

@ -31,7 +31,7 @@
return 'XHJ' return 'XHJ'
} }
// #endif // #endif
return 'DEV' return 'XHJ'
} }
}, },
computed: { computed: {

View File

@ -250,7 +250,7 @@
return data return data
}) })
const cleanupResources = () => { const cleanupResources = async () => {
if (cleanupCalled.value) return if (cleanupCalled.value) return
cleanupCalled.value = true cleanupCalled.value = true
@ -263,8 +263,8 @@
} }
releaseRecord() releaseRecord()
if (deviceInfo.value) { if (deviceInfo.value) {
stopSendServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`) await stopSendServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`)
stopServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`) await stopServiceFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`)
} }
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
@ -545,8 +545,12 @@
// #endif // #endif
} }
const callback = audioData => { const callback = async audioData => {
dataSendFunction(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`, audioData) console.log('传输数据', audioData)
await dataSendFunction(
`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`,
audioData
)
} }
const handlePlaySuccess = () => { const handlePlaySuccess = () => {

View File

@ -49,6 +49,7 @@ public class AudioRecorderManager: NSObject {
return return
} }
if audioEngine == nil {
let session = AVAudioSession.sharedInstance() let session = AVAudioSession.sharedInstance()
do { do {
try session.setCategory(.playAndRecord, mode: .default, options: .defaultToSpeaker) try session.setCategory(.playAndRecord, mode: .default, options: .defaultToSpeaker)
@ -103,8 +104,14 @@ public class AudioRecorderManager: NSObject {
self.convert(pcmBuffer: pcmBuffer, completion: completion) self.convert(pcmBuffer: pcmBuffer, completion: completion)
} }
do {
audioEngine.prepare() audioEngine.prepare()
}
do {
guard let audioEngine = audioEngine else {
completion(nil, false, "Audio engine not initialized.")
return
}
try audioEngine.start() try audioEngine.start()
self.isRecording = true self.isRecording = true
completion(nil, true, "Recording started") completion(nil, true, "Recording started")
@ -193,19 +200,7 @@ public class AudioRecorderManager: NSObject {
return return
} }
self.isRecording = false self.isRecording = false
audioEngine?.stop() 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", "") completion(true, "Recording stopped", "")
} }

View File

@ -132,7 +132,7 @@ export const runSendServiceFunction = async function (
crypto: boolean crypto: boolean
): Promise<Result> { ): Promise<Result> {
try { try {
const result = runSendService(id, cmd, crypto) const result = await runSendService(id, cmd, crypto)
console.log('开始发送服务', result) console.log('开始发送服务', result)
return { return {
code: 0, code: 0,
@ -178,8 +178,8 @@ export const dataSendFunction = async function (id: string, data: Array<number>)
} }
try { try {
const result = dataSend(id, buffer, data.length) const result = await dataSend(id, buffer, data.length)
// console.log('发送数据结果', result) console.log('发送数据结果', result)
XP2PDataHelper.deallocateBytes(buffer) XP2PDataHelper.deallocateBytes(buffer)