|
@@ -12,17 +12,30 @@
|
|
|
<view class="card-title text_oneLine">
|
|
|
{{ title }}
|
|
|
</view>
|
|
|
- <slider activeColor="#3385FF" :max="audioTime" :value="curTime" @change="handleAudioSliderChange($event)" block-size="16" class="slider" />
|
|
|
- <view class="card-time">
|
|
|
- <text class="time">{{ curTime | formatVoiceTime }}</text>
|
|
|
- <text class="time">{{ audioTime | formatVoiceTime }}</text>
|
|
|
+ <view class="slider-paly">
|
|
|
+ <view style="flex: 1; padding-top: 20rpx">
|
|
|
+ <slider activeColor="#3385FF" :max="audioTime" :value="curTime" @change="handleAudioSliderChange($event)" block-size="16" class="slider" />
|
|
|
+ <view class="card-time">
|
|
|
+ <text class="time">{{ curTime | formatVoiceTime }}</text>
|
|
|
+ <text class="time">{{ audioTime | formatVoiceTime }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="is-paly-card">
|
|
|
+ <image
|
|
|
+ @click.stop="handleChangePlayStatus"
|
|
|
+ class=""
|
|
|
+ :src="play ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/play_icon.gif' : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/pause_icon.png'"
|
|
|
+ ></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="is-paly-card">
|
|
|
- <image
|
|
|
- @click.stop="handleChangePlayStatus"
|
|
|
- class=""
|
|
|
- :src="play ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/suspend_icon.png' : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/play_icon.png'"
|
|
|
- ></image>
|
|
|
+ <view class="fast-reverse">
|
|
|
+ <image @click="speedReverseHandler('reverse')" class="speed-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/fastReverse_icon.png"></image>
|
|
|
+ <block v-for="(item, index) in timesTheSpeed" :key="item.value">
|
|
|
+ <view class="speed-button" v-if="isTimes == item.value" @click="isTimesHandler(index)">
|
|
|
+ {{ item.name }}
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ <image @click="speedReverseHandler('speed')" class="speed-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/speed_icon.png"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -56,6 +69,13 @@ export default {
|
|
|
activityTitle: "", //当前活动标题
|
|
|
play: false,
|
|
|
isEnded: false,
|
|
|
+ timesTheSpeed: [
|
|
|
+ { name: "倍速", value: 1 },
|
|
|
+ { name: "1.25倍", value: 1.25 },
|
|
|
+ { name: "1.5倍", value: 1.5 },
|
|
|
+ { name: "2倍", value: 2 },
|
|
|
+ ],
|
|
|
+ isTimes: 1,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -90,11 +110,13 @@ export default {
|
|
|
if (this.globalBgAudioManager.src != curAudio.Url) {
|
|
|
this.globalBgAudioManager.src = curAudio.Url;
|
|
|
this.globalBgAudioManager.title = curAudio.Name;
|
|
|
+ this.isTimes = 1;
|
|
|
}
|
|
|
+ this.globalBgAudioManager.playbackRate = this.isTimes;
|
|
|
this.audioTime = curAudio.PlaySeconds;
|
|
|
this.title = curAudio.Name;
|
|
|
this.activityTitle = this.$store.state.audioBg.activityTitle;
|
|
|
- this.curTime = parseInt(this.globalBgAudioManager.currentTime);
|
|
|
+ this.curTime = parseInt(this.globalBgAudioManager.currentTime || 0);
|
|
|
this.play = !this.globalBgAudioManager.paused;
|
|
|
this.listenAudio();
|
|
|
},
|
|
@@ -148,6 +170,7 @@ export default {
|
|
|
//拖动进度条
|
|
|
handleAudioSliderChange(e) {
|
|
|
const value = e.detail.value;
|
|
|
+ console.log(value, "value");
|
|
|
this.globalBgAudioManager.seek(value);
|
|
|
},
|
|
|
//音频点击暂停播放
|
|
@@ -162,6 +185,25 @@ export default {
|
|
|
this.init();
|
|
|
}
|
|
|
},
|
|
|
+ //倍速播放
|
|
|
+ isTimesHandler(i) {
|
|
|
+ let index = i == 3 ? 0 : i + 1;
|
|
|
+ this.isTimes = this.timesTheSpeed[index].value;
|
|
|
+ this.globalBgAudioManager.pause();
|
|
|
+ this.play = true;
|
|
|
+ this.globalBgAudioManager.playbackRate = this.isTimes;
|
|
|
+ this.globalBgAudioManager.startTime = this.curTime;
|
|
|
+ this.globalBgAudioManager.play();
|
|
|
+ },
|
|
|
+ //快进 快退
|
|
|
+ speedReverseHandler(type) {
|
|
|
+ if (!this.globalBgAudioManager.src) {
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+ let isTime = type == "reverse" ? this.curTime - 15 : this.curTime + 15;
|
|
|
+ isTime = isTime <= 0 ? 0 : isTime;
|
|
|
+ this.globalBgAudioManager.seek(isTime);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -214,7 +256,7 @@ export default {
|
|
|
.audio-card {
|
|
|
width: 100%;
|
|
|
height: 282rpx;
|
|
|
- background: #f5f9ff;
|
|
|
+ background: #f9f9f9;
|
|
|
border-radius: 16rpx;
|
|
|
margin: 0 auto;
|
|
|
padding: 30rpx;
|
|
@@ -222,10 +264,15 @@ export default {
|
|
|
width: 100%;
|
|
|
margin: 0;
|
|
|
}
|
|
|
+ .slider-paly {
|
|
|
+ display: flex;
|
|
|
+ height: 80rpx;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
.card-title {
|
|
|
color: #3385ff;
|
|
|
font-size: 28rpx;
|
|
|
- padding: 0 66rpx;
|
|
|
+ padding: 0 40rpx;
|
|
|
text-align: center;
|
|
|
margin-bottom: 35rpx;
|
|
|
}
|
|
@@ -236,12 +283,32 @@ export default {
|
|
|
font-size: 20rpx;
|
|
|
}
|
|
|
.is-paly-card {
|
|
|
- width: 100%;
|
|
|
- text-align: center;
|
|
|
+ width: 70rpx;
|
|
|
+ height: 70rpx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ margin-left: 30rpx;
|
|
|
image {
|
|
|
- margin-top: 5rpx;
|
|
|
- width: 100rpx;
|
|
|
- height: 100rpx;
|
|
|
+ width: 70rpx;
|
|
|
+ height: 70rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .fast-reverse {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ margin-top: 30rpx;
|
|
|
+ .speed-button {
|
|
|
+ width: 96rpx;
|
|
|
+ height: 47rpx;
|
|
|
+ background: #eaeaea;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 47rpx;
|
|
|
+ margin: 0 70rpx;
|
|
|
+ }
|
|
|
+ .speed-img {
|
|
|
+ width: 50rpx;
|
|
|
+ height: 50rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|