当前位置:网站首页>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
边栏推荐
- Differences and connections between MinGW, mingw-w64, tdm-gcc and other tool chains "suggestions collection"
- guava多线程,futurecallback线程调用不平均
- Optimization cases of complex factor calculation: deep imbalance, buying and selling pressure index, volatility calculation
- 程序猿赚的那点钱算个P啊!
- Cantata9.0 | 全 新 功 能
- Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
- Onespin | solve the problems of hardware Trojan horse and security trust in IC Design
- Write a jump table
- Ubuntu安装mysql8遇到的问题以及详细安装过程
- 死锁的产生条件和预防处理[通俗易懂]
猜你喜欢

C语言 整型 和 浮点型 数据在内存中存储详解(内含原码反码补码,大小端存储等详解)

OneSpin 360 DV新版发布,刷新FPGA形式化验证功能体验

ISO 26262 - 基于需求测试以外的考虑因素
Klocwork code static analysis tool

Tensorflow2.x下如何运行1.x的代码

Small guide for rapid formation of manipulator (12): inverse kinematics analysis
MySQL约束之默认约束default与零填充约束zerofill

Make this crmeb single merchant wechat mall system popular, so easy to use!
Mysql子查询关键字的使用方式(exists)

How to meet the dual needs of security and confidentiality of medical devices?
随机推荐
Codeforces 474 F. Ant colony
MySQL storage expression error
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
Cantata9.0 | new features
Referrer和Referrer-Policy简介
Mahout-Pearson correlation的实现
Nebula Importer 数据导入实践
死锁的产生条件和预防处理[通俗易懂]
恶魔奶爸 B2 突破语法,完成正统口语练习
Codesonar enhances software reliability through innovative static analysis
margin 等高布局
POJ 3140 Contestants Division「建议收藏」
Le capital - investissement est - il légal en Chine? C'est sûr?
201215-03-19—cocos2dx内存管理–具体解释「建议收藏」
Implement secondary index with Gaussian redis
95年专注安全这一件事 沃尔沃未来聚焦智能驾驶与电气化领域安全
恶魔奶爸 A1 语音听力初挑战
开户必须往账户里面赚钱吗,资金安全吗?
gridView自己定义做时间排版「建议收藏」
[UVALive 6663 Count the Regions] (dfs + 离散化)[通俗易懂]