在使用wx.createInnerAudioContent()时,逻辑相同的代码,自己的代码+音频可播放,别人的代码+音频就不可播放了。但是都是mp3,用了格式工厂,怎么搞也不会出现音频码率什么的差别太大的问题吧。
在别人电脑上用自己的代码+别人的音频,也无法播放。
界面
<view class="container">
<image wx:if="{{!isPlay}}" bind:tap="play" class="record" src="/icons/record-0.png"></image>
<image wx:else bind:tap="pause" class="record" src="/icons/record-ing.png"></image>
<image bind:tap="stop" class="record" src="/icons/record-stop.png"></image>
</view>
JS
// pages/index/index.js
Page({
/**
* 页面的初始数据
*/
data: {
music: {},
isPlay: false,
content: {
src: "cloud://===========================/01.mp3"
}
},
play(){
const music = this.data.music;
music.play()
this.setData({
isPlay: true
})
},
pause(){
const music = this.data.music;
music.pause()
this.setData({
isPlay: false
})
},
stop(){
const music = this.data.music;
music.stop()
this.setData({
isPlay: false
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const music = wx.createInnerAudioContext();
music.src = this.data.content.src;
this.setData({
music
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.stop()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
this.stop()
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)