- 复现路径:第1步,第一次点击播放正常播放;第二步,暂停;第三次,第二次点击播放,从头开始播放;
.audioBox{}
.audioBox>.top{
text-align: center;
}
.audioBox>.top>image{
width: 220rpx;
height: 297rpx;
border-radius: 8rpx;
box-shadow: 2rpx 2rpx 4rpx 2rpx #D4D4D4;
}
.audioBox>.top>.top_title{
font-size: 32rpx;
font-weight: bold;
margin: 36rpx 0 12rpx;
}
.audioBox>.top>.price{
font-size: 26rpx;
color: #a0a0a0;
}
.progress{
margin-top: 53rpx;
}
.progress>. time {
display: flex;
justify-content: space-between;
margin: 0 20rpx;
}
.progress>. time >text{
font-size: 26rpx;
color: #a0a0a0;
}
.control{
position: relative;
display: flex;
align-items: center;
justify-content: center;
margin: 20rpx 0 56rpx;
}
.control>icon{
font-size: 53rpx;
color: #ff3f61;
}
.control>.stateBtn {
position: relative;
width: 94rpx;
height: 94rpx;
border-radius: 50%;
background-color: #ff3f61;
text-align: center;
margin: 0 60rpx;
}
.control>.stateBtn>icon{
line-height: 93rpx;
font-size: 43rpx;
color: white;
}
.control>.speed {
position: absolute;
top: 26rpx;
right: 62rpx;
font-size: 28rpx;
color: #a0a0a0;
text-align: center;
}
.control>.speed>view {
display: block;
font-size: 23rpx;
color: #a0a0a0;
margin-top: 10rpx;
}
.audioBox>.bottom {
}
.audioCover {
position: absolute;
width: 94rpx;
height: 94rpx;
top: 0;
left: 0;
background-color: transparent;
z-index: 9998;
}
|
< view class = 'audioBox' wx:elif = "{{courseInfo.course_carrier == 2}}" >
< view class = 'top' >
< image src = '{{courseInfo.course_pictures}}' ></ image >
< view class = 'top_title' >{{courseInfo.course_name}}</ view >
< text class = 'price' >¥{{courseInfo.course_price}}</ text >
</ view >
< view class = 'bottom' >
< view class = 'progress' >
< slider class = 'slider'
bindchange = "sliderChange"
activeColor = 'red'
block-size = "12"
max = "{{max}}"
value = '{{offset}}' />
< view class = 'time' >
< text >{{starttime}}</ text >
< text >{{courseInfo.duration}}</ text >
</ view >
</ view >
< view class = 'control' >
< icon class = 'leftBtn iconfont iconai10' bindtap = 'prev' ></ icon >
< view class = 'stateBtn' wx:if = "{{!isOpen}}" bindtap = "listenerButtonPlay" >
< view class = 'audioCover' wx:if = "{{audioCover}}" ></ view >
< icon class = 'startBtn iconfont iconbofang2' ></ icon >
</ view >
< view class = 'stateBtn' wx:if = "{{isOpen}}" bindtap = "listenerButtonPause" >
< icon class = 'iconfont iconstop' ></ icon >
</ view >
< icon class = 'rightBtn iconfont iconai09' bindtap = 'next' ></ icon >
< view class = 'speed' bindtap = "audioPlaybackRateSpeedUp" >
1.5X
< view >倍速播放</ view >
</ view >
</ view >
</ view >
</ view >
|
小程序开发工具上测没问题,ios真机测试时暂停再播放是从头播。
listenerButtonPlay: function () {
let that = this ;
bgMusic.title = that.data.courseInfo.course_name;
bgMusic.epname = that.data.courseInfo.course_name;
bgMusic.src = that.data.src;
bgMusic.onTimeUpdate(() => {
let duration = bgMusic.duration;
let offset = bgMusic.currentTime;
let currentTime = parseInt(bgMusic.currentTime);
let min = "0" + parseInt(currentTime / 60);
let max = parseInt(bgMusic.duration);
let sec = currentTime % 60;
if (sec < 10) {
sec = "0" + sec;
};
let starttime = min + ':' + sec;
that.setData({
offset: currentTime,
starttime: starttime,
max: max,
});
});
bgMusic.play();
that.setData({
isOpen: true ,
});
bgMusic.onEnded(() => {
that.setData({
starttime: '00:00' ,
isOpen: false ,
offset: 0
})
that.updateViewTime();
console.log( "音乐播放结束" );
})
},
|
listenerButtonPause: function () {
let that = this
bgMusic.pause();
that.setData({
isOpen: false
});
that.updateViewTime();
},
|
请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
机型:iphone6plus 微信版本:最新的
我这是安卓的同样问题
你是写代码的托尼老师?
假的假的
???