xiangyuecn / Recorder

html5 js 录音 mp3 wav ogg webm amr g711a g711u 格式,支持pc和Android、iOS部分浏览器、Hybrid App(提供Android iOS App源码)、微信,提供ASR语音识别转文字 H5版语音通话聊天示例 DTMF编码解码
https://xiangyuecn.github.io/Recorder/
MIT License
4.89k stars 1.04k forks source link

Cannot read properties of undefined (reading 'i18n') #211

Closed SHSSNN closed 8 months ago

SHSSNN commented 8 months ago

页面引入任何一个插件或者格式文件都报这个错误,

微信图片_20240229160626 微信图片_20240229155836

我使用的框架是vite+vue3+ts

xiangyuecn commented 8 months ago

已收到群里反馈,是因为类似 import Recorder from 'recorder-core' 但未引用Recorder导致的此import被优化干掉了,只需随便调用一下Recorder变量保证强引用即可

SHSSNN commented 8 months ago

多谢指导

krmao commented 1 month ago

recoder import must be first and then import wav and waview

import Recorder from 'recorder-core';
import 'recorder-core/src/engine/wav';
import 'recorder-core/src/extensions/waveview';
// https://github.com/xiangyuecn/Recorder/issues/211
Recorder.ConnectEnableWorklet = false;