当前位置:网站首页>Solve the problem of using uni app mediaerror mediaerror errorcode -5
Solve the problem of using uni app mediaerror mediaerror errorcode -5
2022-07-07 21:06:00 【No Bug】
Need to give app Make a voice broadcast , First find an online Hecheng MP3 File website , The voice needed for synthesis is downloaded well .
Put it in the local file , To use it directly innerAudioContext.onPlay Just go .
I didn't expect it to be
After searching online for a long time, I couldn't find a solution ,/(ㄒoㄒ)/~~.
Then I tried the example of the official website , It can be played normally . I will change the broadcast address of the official example to my local address , Then it's the same !
It should not be able to play audio files with local addresses , Then I put my mp3 Save the file to Tencent cloud , It can be used normally .
Change to network address
openVoice() {
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src =
'http://1.14.142.212/zjl.mp3'
innerAudioContext.onPlay(() => {
console.log(' Start playing ');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
}
Played successfully . crying /(ㄒoㄒ)/~~
Here is a little talk about how to put local files on the network address .
Ideas :
1. You need a cloud server ( Buy ).
2. establish FTP Site
3. Create a website, map the file to the network address
The detailed steps
1. I use Tencent cloud , Enter the pagoda panel to create a FTP Site
2. Enter when you create FTP Root directory
Upload your file
3. Create a web site , Use it without a domain name IP, My domain name is still on record , So I used IP. Pay attention to the root directory and you FTP The consistency of .
Use
For example, I uploaded a mp3 file , The access address is
边栏推荐
猜你喜欢
万字总结数据存储,三大知识点
使用高斯Redis实现二级索引
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
Make this crmeb single merchant wechat mall system popular, so easy to use!
最新版本的CodeSonar改进了功能安全性,支持MISRA,C ++解析和可视化
MySQL storage expression error
上海交大最新《标签高效深度分割》研究进展综述,全面阐述无监督、粗监督、不完全监督和噪声监督的深度分割方法
OneSpin | 解决IC设计中的硬件木马和安全信任问题
Klocwork 代码静态分析工具
CodeSonar通过创新型静态分析增强软件可靠性
随机推荐
【C语言】指针进阶---指针你真的学懂了吗?
软件缺陷静态分析 CodeSonar 5.2 新版发布
Hoj 2245 planktonic triangle cell (Mathematics)
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
写了个 Markdown 命令行小工具,希望能提高园友们发文的效率!
恶魔奶爸 A0 英文零基础的自我提升路
数值法求解最优控制问题(〇)——定义
Intelligent transportation is full of vitality. What will happen in the future? [easy to understand]
FTP steps for downloading files from Huawei CE switches
Écrivez une liste de sauts
gridView自己定义做时间排版「建议收藏」
Write a jump table
Tensorflow2. How to run under x 1 Code of X
恶魔奶爸 指南帖——简易版
AADL inspector fault tree safety analysis module
恶魔奶爸 B3 少量泛读,完成两万词汇量+
OneSpin 360 DV新版发布,刷新FPGA形式化验证功能体验
MinGW MinGW-w64 TDM-GCC等工具链之间的差别与联系「建议收藏」
Codeforces Round #296 (Div. 2) A. Playing with Paper[通俗易懂]
私募基金在中国合法吗?安全吗?