diff --git a/src/manifest.json b/src/manifest.json
index 69811b3a..bd6d64b1 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -32,7 +32,9 @@
},
/* 模块配置 */
"modules" : {
- "Camera" : {},
+ "Camera" : {
+ "description": "用于访问摄像头进行实时预览"
+ },
"Barcode" : {},
"Record" : {},
"VideoPlayer" : {},
diff --git a/src/pages/sparring/components/talk-speaker.vue b/src/pages/sparring/components/talk-speaker.vue
index 46208773..1a6225f4 100644
--- a/src/pages/sparring/components/talk-speaker.vue
+++ b/src/pages/sparring/components/talk-speaker.vue
@@ -57,8 +57,10 @@
// 播放状态变更
changeStreamPlaying({ status }) {
if (status === false) {
- console.log('播放结束', this.playNumber);
- this.$emit('playOver', this.playNumber)
+ console.log('播放结束组件', this.playNumber);
+ const aaa = this.playNumber
+ this.playNumber = ''
+ this.$emit('playOver', aaa);
}
},
@@ -69,14 +71,6 @@
}
}
},
-
- // 若需要watch监听(原组合式API的watch),补充如下(当前代码无watch逻辑,可删)
- watch: {
- // 示例:监听playNumber变化(如有需要)
- // playNumber(newVal) {
- // console.log('播放id变更:', newVal);
- // }
- }
};
@@ -87,50 +81,6 @@
* 音频路由兼容方案(适配 H5/小程序/不支持 setAudioRoute 的设备)
* @param {string} type - earpiece(听筒)/speaker(扬声器)
*/
- function fallbackAudioRoute(type) {
- // 1. 通用:创建音频上下文(Web Audio API),控制输出设备
- try {
- const AudioContext = window.AudioContext || window.webkitAudioContext;
- if (AudioContext) {
- const audioCtx = new AudioContext();
- // 针对听筒:降低音量+强制单声道(模拟听筒效果)
- if (type === 'earpiece') {
- audioCtx.listener.setPosition(0, 0, 0); // 定位到听筒
- // 若有播放节点,设置音量为 0.3(听筒音量)
- if (window.audioSource) {
- window.audioSource.gain.value = 0.3;
- }
- } else {
- // 扬声器:恢复音量+立体声
- if (window.audioSource) {
- window.audioSource.gain.value = 1;
- }
- }
- }
- } catch (e) {}
-
- // 2. 安卓 H5 特殊处理:通过 Audio 对象的 speakerphone 属性(部分浏览器支持)
- const audio = new Audio();
- if (audio.setSpeakerphoneOn) {
- // 听筒:关闭扬声器;扬声器:打开
- audio.setSpeakerphoneOn(type !== 'earpiece');
- audio.play(); // 触发设置生效
- audio.pause(); // 无需播放实际音频
- }
-
- // 3. 小程序端(如微信小程序):调用小程序原生 API
- if (wx && wx.setAudioRoute) {
- // 微信小程序专属:切换音频输出(需基础库 2.10.0+)
- wx.setAudioRoute({
- route: type === 'earpiece' ? 'earpiece' : 'speaker',
- success: () => console.log('小程序音频路由切换成功'),
- fail: (e) => console.error('小程序路由切换失败:', e)
- });
- }
-
- // 4. 兜底提示(非 5+ 环境)
- console.log(`当前环境不支持强制音频路由,已模拟${type === 'earpiece' ? '听筒' : '扬声器'}效果`);
- }
export default {
mounted() {
@@ -150,9 +100,7 @@
console.log('切换音频输出')
},
appendPCMChunk(numArray) {
- // console.log('接收到', numArray.length);
if (!numArray || numArray.length === 0) return;
- // 数字数组转回ArrayBuffer
const uint8 = new Uint8Array(numArray);
const arrayBuffer = uint8.buffer;
player.appendChunk(arrayBuffer);
@@ -162,7 +110,7 @@
if (player) {
player.destroy();
player = null;
- // 重新初始化(方便后续再次播放)
+ // 重新初始化
const _this = this;
player = new StreamPlayer({
inputSampleRate: 16000,
@@ -176,8 +124,8 @@
},
// 播放结束回调(通知主线程)
callback(e) {
- console.log('播放结束回调', e);
if (e === 'ended') {
+ console.log('播放结束renderjs', e);
this.$ownerInstance.callMethod('changeStreamPlaying', {status:false});
}
}
diff --git a/src/pages/sparring/js/useWebSocket.js b/src/pages/sparring/js/useWebSocket.js
index 3cc755a3..723c88f2 100644
--- a/src/pages/sparring/js/useWebSocket.js
+++ b/src/pages/sparring/js/useWebSocket.js
@@ -94,7 +94,9 @@ export default function useWebSocket(aaas = null, options = {}) {
// 控制消息
console.log('控制消息', msgType, body);
if (body.type === 1) { // 开始播放,记录当前播放的语音id
+ console.log('开始播放,记录当前播放的语音id', body.lock);
setPlayNumber(body.lock)
+
}
break;
diff --git a/src/pages/sparring/talk.vue b/src/pages/sparring/talk.vue
index 47e074be..3d0d10df 100644
--- a/src/pages/sparring/talk.vue
+++ b/src/pages/sparring/talk.vue
@@ -135,10 +135,15 @@
});
};
const playOver = (id) => {
- send(ProtocolCodec.pack(MessageType.CONTROL_CMD, {
- type:2,
- lock:id
- }))
+ console.log('播放完毕talk通知后端', id);
+ if(id) {
+ setTimeout(() => {
+ send(ProtocolCodec.pack(MessageType.CONTROL_CMD, {
+ type:2,
+ lock:id
+ }))
+ }, 300)
+ }
};
const onError = (body) => {
// websocket错误处理
diff --git a/src/pages/sparring/tip.vue b/src/pages/sparring/tip.vue
index 8eb377f0..9188049f 100644
--- a/src/pages/sparring/tip.vue
+++ b/src/pages/sparring/tip.vue
@@ -251,7 +251,7 @@
console.log('申请权限',getPhoneEnvBool('AND'));
if(getPhoneEnvBool('AND')){
console.log('申请权限');
- // await initRecord();
+ await initRecord();
}
diff --git a/src/pages/test/testChat.vue b/src/pages/test/testChat.vue
index 02d0a00c..5ff66349 100644
--- a/src/pages/test/testChat.vue
+++ b/src/pages/test/testChat.vue
@@ -1,236 +1,13 @@
-
-
-
- {{ status }}
- 当前分贝:{{ currentDecibels }}
-
-
- xx
-
-
+
+
+
-
-
\ No newline at end of file
diff --git a/src/pages/test/testChat2.nvue b/src/pages/test/testChat2.nvue
new file mode 100644
index 00000000..e69de29b
diff --git a/src/pages/test/testChat2.vue b/src/pages/test/testChat2.vue
deleted file mode 100644
index e250a7d3..00000000
--- a/src/pages/test/testChat2.vue
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
-
- 预热
- 开始推流
- 暂停推流
- 恢复推流
- 停止推流
- 快照
- 开启摄像头预览
- 关闭摄像头预览
- 切换摄像头
-
-
-
-
-