上传后音频无法播放
发布于 5 年前 作者 fjin 7475 次浏览 来自 问答

我在本地文件夹添加了一个mp3文件,然后测试的时候本地是可以播放的,编译后的文件也是没有超过2m的,但是预览和上传后都无法播放,是不是因为需要将这个文件uploadfile过啊,如果是的话这个url怎么填,填阿里云吗

6 回复

请提供一个可运行的代码片段并附上操作步骤说明:https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/minicode.html

你好,麻烦尝试使用从根目录开始的完整路径是否可以解决问题

是音频文件构建后完整名字中间多了串码,所以不能正常读取,我也在找这个问题怎么才能解决

wechatide://minicode/8XgcscmK69Yx   媒体文件上传不了,太大了

不需要 uploadFile。麻烦提供重现问题的代码片段。

js代码:

onReady: function () {

// this.audioCtx = wx.createAudioContext(‘myAudio’)

// this.audioCtx.setSrc(’…/…/media/111.mp3’)

// this.audioCtx.play()

},

data: {

// poster:’…/…/img/11.jpg’,

// name:‘asd’,

// author:‘asd’

}

// audioPause:function(){

//   console.log(2);

//   this.audioCtx.pause()

// },

// audioPlay:function(){

//   this.audioCtx.play()

// }

wxml代码:

<!-- <view class=“audio” >

   <view class=‘yinpin’ >

     <audio poster="{{poster}}" name="{{name}}" author="{{author}}" src="{{src}}" id=“myAudio” controls loop></audio>

   </view>

   <button type=“primary” bindtap=‘audioPlay’>播放</button>

   <button type=“primary” bindtap=“audioPause”>暂停</button>

 </view>

 <view class=‘photo’>

 

 </view>

 -->

回到顶部