x
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<yao-RecordFrame ref="recordFrame" @onFrameRecorded="frameRecorded" @currentDecibels="onCurrentDecibels"
|
||||
@onStop="stopIt">
|
||||
</yao-RecordFrame>
|
||||
<sdx-StreamPlayer>xx</sdx-StreamPlayer>
|
||||
<sdx-StreamPlayer ref="aaa">xx</sdx-StreamPlayer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
scriptProcessor: null, // 音频处理节点
|
||||
audioBufferSource: null, // 音频源节点
|
||||
frameBufferList: [], // 缓存音频帧
|
||||
wsUrl: "ws://10.10.10.201:8000/ws/audio", // 替换为实际后端地址
|
||||
wsUrl: "ws://172.16.89.58:8000/ws/audio", // 替换为实际后端地址
|
||||
};
|
||||
},
|
||||
onUnload() {
|
||||
@@ -80,6 +80,8 @@
|
||||
console.log('web');
|
||||
this.ws.onOpen((res) => {
|
||||
console.log('WebSocket连接已打开', res);
|
||||
|
||||
|
||||
this.ws.onMessage((res) => {
|
||||
let messageData = res.data;
|
||||
// 处理不同类型的数据
|
||||
@@ -94,7 +96,7 @@
|
||||
} else if (messageData instanceof ArrayBuffer) {
|
||||
// 二进制数据
|
||||
try {
|
||||
|
||||
this.$refs.aaa.appendBuffer(messageData)
|
||||
// const str = this.arrayBufferToStringCompat(messageData);
|
||||
// console.log('转换后的字符串:', str);
|
||||
|
||||
@@ -142,7 +144,7 @@
|
||||
this.isRecording = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 停止录音
|
||||
onStopRecord() {
|
||||
this.stopRecordAndClean();
|
||||
|
||||
Reference in New Issue
Block a user