语音文件格式修改

This commit is contained in:
2025-10-14 23:28:38 +08:00
parent f4371f332f
commit 4f918b91c7

View File

@@ -80,7 +80,7 @@ public class ChatWebSocketHandler {
byteBuffer.get(bytes);
log.info("2、运行时间:{}",System.currentTimeMillis()/1000);
// 生成唯一文件名
String fileName = clientId + "_" + System.currentTimeMillis() + ".opus";
String fileName = clientId + "_" + System.currentTimeMillis() + ".webm";
String pathUrl = RuoYiConfig.getProfile()+VOICE_STORAGE_DIR + fileName;
// String pathUrl = "/Users/wangxiangshun/Desktop/0.8733346782733291.webm";
log.info("文件路径为:{}", pathUrl);
@@ -153,8 +153,8 @@ public class ChatWebSocketHandler {
}
// 确保文件以.webm结尾
if (!filePath.toLowerCase().endsWith(".opus")) {
filePath += ".opus";
if (!filePath.toLowerCase().endsWith(".webm")) {
filePath += ".webm";
}
FileOutputStream fos = null;