Meituan-Dianping / mpvue

基于 Vue.js 的小程序开发框架,从底层支持 Vue.js 语法和构建工具体系。
http://mpvue.com
MIT License
20.42k stars 2.07k forks source link

onTimeUpdate在 播放结束后再次播放不会执行 #1146

Open mschange opened 5 years ago

mschange commented 5 years ago

mpvue使用背景音乐播放,监听音频播放进度更新事件onTimeUpdate回调函数,在初始的时候可以正常调用,但是播放结束后,再次点击播放,不会执行该回调函数,有人遇到过吗

zxzhgk commented 5 years ago

为啥符合格式的issue 通过不了,不符合的反而可以通过,机器人管理逻辑坑爹

mschange commented 5 years ago

什么意思

zxzhgk commented 5 years ago

就是他不是搞了个机器人专门检测issue的格式么,你去看看关闭的issue上面的,格式基本都是对的,但是没被打开,你这个issue格式按道理是不对的,反而打开了

mschange commented 5 years ago

我刚刚提交的,先解决问题啊

zxzhgk commented 5 years ago

视频播放我没做过,等做过的大佬来帮你看吧。。祝顺利解决

mschange commented 5 years ago

是音频,原生的没有问题,mpvue出了问题,

nullwuwu commented 5 years ago

@zxzhgk 试了下 没问题阿。。

mschange commented 5 years ago

@kailcc 有问题啊,我的那个事件在播放结束后点击播放不执行了,你的是?

nullwuwu commented 5 years ago

@mschange 播放结束后,你有seek(0)吗

mschange commented 5 years ago

在哪里seek(0)啊,什么意思

nullwuwu commented 5 years ago

@mschange https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html?search-key=audio

mschange commented 5 years ago

@kailcc 你的意思是在播放结束后添加this.context.seek(0);就可以了?

mschange commented 5 years ago

@kailcc 在播放结束加了也不行啊

mschange commented 5 years ago

@kailcc https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html 使用的是这个,背景音乐

nullwuwu commented 5 years ago

@mschange 额,背景音乐没使用过。

mschange commented 5 years ago

@kailcc 我在网上查了,好像都没遇到过,

mschange commented 5 years ago

代码:

<button @click='plays'>播放

export default { data () { return { motto: 'Hello World', userInfo: {}, pt: '', } },

onLoad() { this.pt = wx.getBackgroundAudioManager(); this.pt.title = '此时此刻' this.pt.epname = '此时此刻' this.pt.singer = '许巍' this.pt.src = 'https://cdn.audio.xxbmm.com/xxbmm/cloud/videos/1536910813abwWMtest.mp3'; this.pt.onPlay(() => { console.log('开始播放') }) this.pt.onTimeUpdate(() => { console.log('播放的时候触发'); }) }, methods: { plays() { console.log('jinglaile'); const audioStatus = this.pt.paused; if (audioStatus) this.pt.play(); else this.pt.pause(); this.audioStatus = (!audioStatus); } }, }

当播放结束后,点击播放,this.pt.onTimeUpdate(() => { console.log('播放的时候触发'); })不会被触发, 使用的是https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html

来个大佬给我解决下啊

zxzhgk commented 5 years ago

https://developers.weixin.qq.com/community/develop/doc/000c0064034160ebb2872c4bc51000