chore: update path

master
wuzhihao 2022-02-21 15:20:22 +08:00
parent 3487f7799c
commit 2cc71f2a4c
1 changed files with 22 additions and 21 deletions

View File

@ -4,24 +4,25 @@ const app = getApp()
Page({
data: {
volume:1,
rate:1,
volume: 1,
rate: 1,
},
onLoad(){
onLoad() {
const innerAudioContext = wx.createInnerAudioContext()
this.ctx = innerAudioContext
console.log(innerAudioContext)
// innerAudioContext.playbackRate = 2.0
innerAudioContext.src = '/packageAPI/pages/innerAudioContext/mucis.mp3'
// innerAudioContext.src = '/packageAPI/pages/innerAudioContext/mucis.mp3'
// innerAudioContext.src = 'http://cdn.amathclass.cn/quesAudio/42fe780d-1607959109843.m4a'
innerAudioContext.src = 'https://public-1251849568.cos.ap-guangzhou.myqcloud.com/temp/mucis.mp3'
const listener = ['Canplay', 'Ended', 'Pause', 'Play', 'Seeked', 'Seeking', 'Stop', 'TimeUpdate', 'Waiting']
listener.forEach(key=>{
innerAudioContext['on'+key](()=>{
console.log('on'+key)
listener.forEach(key => {
innerAudioContext['on' + key](() => {
console.log('on' + key)
})
})
innerAudioContext.onError((res) => {
@ -38,33 +39,33 @@ Page({
this.ctx.destroy()
console.log(this.ctx)
},
play(){
this.ctx.play()
// this.ctx.src = '/mucis.mp3'
// this.ctx.autoplay = true
play() {
this.ctx.play()
// this.ctx.src = '/mucis.mp3'
// this.ctx.autoplay = true
},
seek(){
seek() {
this.ctx.seek(60)
},
pause(){
pause() {
this.ctx.pause()
},
destroy(){
destroy() {
this.ctx.destroy()
console.log(this.ctx)
},
stop(){
stop() {
this.ctx.stop()
},
handleVolumeChange(e){
handleVolumeChange(e) {
this.setData({
volume:e.detail.value
volume: e.detail.value
})
this.ctx.volume = this.data.volume
},
handleRateChange(e){
handleRateChange(e) {
this.setData({
rate:e.detail.value
rate: e.detail.value
})
this.ctx.playbackRate = this.data.rate
}