- 音频播放概率性失败
请教一下,我现在使用 wx.createInnerAudioContext 这个接口,进行播放mp3格式的音频文件,src是http://www.xxx.com/xxx.mp3, 现在经常出现点了不播方法,触发了onplay事件(输出了onplay is running),但是不触发onended事件(未输出onEnded is running) 情况(也没有声音) 我在开发工具中怎么点都能播放,在真机上就概率性(较大概率)出现上述情况 手机是iPhonese。 麻烦指导下 [代码]const app = getApp();[代码][代码]const recorderManager = wx.getRecorderManager();[代码][代码]const innerAudioContext = wx.createInnerAudioContext();[代码][代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码]);[代码][代码]Page({[代码][代码] [代码][代码]。。。。。[代码][代码] [代码][代码]//语音播放[代码][代码] [代码][代码]audioPlay: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码],[代码][代码] [代码][代码]innerAudioContext.stop();[代码][代码] [代码][代码]innerAudioContext.src = url;[代码][代码] [代码][代码]innerAudioContext.play();[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]/***音频组件开始 */[代码][代码] [代码][代码]innerAudioContext.obeyMuteSwitch = [代码][代码]false[代码][代码];[代码][代码] [代码][代码]innerAudioContext.onPlay(() => {[代码][代码] [代码][代码]console.log([代码][代码]"onplay is running"[代码][代码])[代码][代码] [代码][代码]var[代码] [代码]i = that.data.i;[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]playID: i[代码][代码] [代码][代码]});[代码][代码] [代码][代码]})[代码][代码] [代码][代码]innerAudioContext.onEnded(() => {[代码][代码] [代码][代码]console.log([代码][代码]"onEnded is running"[代码][代码])[代码][代码] [代码][代码]var[代码] [代码]i = that.data.i;[代码][代码] [代码][代码]if[代码] [代码](that.data.playID > -1) {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]playID: -1[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码]}[代码][代码]})[代码]
2018-02-08 - 两个页面wx.getRecorderManager冲突
您好,我现在遇到了一个问题。 我在两个页面index和detail页面的page上边声明了两个 const recorderManager = wx.getRecorderManager(); 然后在各自的onload中声明了onstop事件,现在出现了一个问题 程序启动进入首页(index页)以后,在进入detail页面,再回到首页,进行录音 此时录音结束以后的onstop执行的却是detail页面的事件,不知道该如何处理,麻烦指导下 谢谢 [代码]//index.js[代码][代码]//获取应用实例[代码][代码]const app = getApp()[代码][代码]const recorderManager = wx.getRecorderManager();[代码][代码]const innerAudioContext = wx.createInnerAudioContext();[代码][代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码]);[代码][代码]Page({[代码][代码] [代码][代码]。。。。。。。[代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]innerAudioContext.onPlay(() => {[代码] [代码] [代码][代码]})[代码][代码] [代码][代码]recorderManager.onStart(() => {[代码] [代码] [代码][代码]});[代码][代码] [代码][代码]recorderManager.onStop((res) => {[代码][代码] [代码][代码]console.log([代码][代码]"首页输出"[代码][代码])[代码][代码]})[代码][代码]})[代码]上边是index的 [代码]const app = getApp();[代码][代码]const recorderManager = wx.getRecorderManager();[代码][代码]const innerAudioContext = wx.createInnerAudioContext();[代码][代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码]);[代码][代码]Page({[代码][代码]。。。。。[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]recorderManager.onStop((res) => {[代码][代码] [代码][代码]console.log([代码][代码]"detail输出"[代码][代码])[代码][代码]})[代码][代码]}[代码][代码]})[代码][代码] [代码]
2018-02-07 - 音频播放概率性失败
请教一下,我现在使用 wx.createInnerAudioContext 这个接口,进行播放mp3格式的音频文件,src是http://www.xxx.com/xxx.mp3, 现在经常出现点了不播方法,触发了onplay事件,但是不触发onended事件 情况 我在开发工具中怎么点都能播放,在真机上就概率性(较大概率)出现上述情况 手机是iPhonese。 麻烦指导下 [代码]const app = getApp();[代码][代码]const recorderManager = wx.getRecorderManager();[代码][代码]const innerAudioContext = wx.createInnerAudioContext();[代码][代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码]);[代码][代码]Page({[代码][代码] [代码][代码]。。。。。[代码][代码] [代码][代码]//语音播放[代码][代码] [代码][代码]audioPlay: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码],[代码][代码] [代码][代码]innerAudioContext.stop();[代码][代码] [代码][代码]innerAudioContext.src = url;[代码][代码] [代码][代码]innerAudioContext.play();[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]/***音频组件开始 */[代码][代码] [代码][代码]innerAudioContext.obeyMuteSwitch = [代码][代码]false[代码][代码];[代码][代码] [代码][代码]innerAudioContext.onPlay(() => {[代码][代码] [代码][代码]console.log([代码][代码]"onplay is running"[代码][代码])[代码][代码] [代码][代码]var[代码] [代码]i = that.data.i;[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]playID: i[代码][代码] [代码][代码]});[代码][代码] [代码][代码]})[代码][代码] [代码][代码]innerAudioContext.onEnded(() => {[代码][代码] [代码][代码]console.log([代码][代码]"onEnded is running"[代码][代码])[代码][代码] [代码][代码]var[代码] [代码]i = that.data.i;[代码][代码] [代码][代码]if[代码] [代码](that.data.playID > -1) {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]playID: -1[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码]}[代码][代码]})[代码]
2018-02-02 - 两个页面getRecorderManager的onStop冲突
您好,我现在遇到了一个问题。 我在两个页面index和detail页面的page上边声明了两个 const recorderManager = wx.getRecorderManager(); 然后在各自的onload中声明了onstop事件,现在出现了一个问题 程序启动进入首页(index页)以后,在进入detail页面,再回到首页,进行录音 此时录音结束以后的onstop执行的却是detail页面的事件,不知道该如何处理,麻烦指导下 谢谢 [代码]//index.js[代码][代码]//获取应用实例[代码][代码]const app = getApp()[代码][代码]const recorderManager = wx.getRecorderManager();[代码][代码]const innerAudioContext = wx.createInnerAudioContext();[代码][代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码]);[代码][代码]Page({[代码][代码] [代码][代码]。。。。。。。[代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]innerAudioContext.onPlay(() => {[代码] [代码] [代码][代码]})[代码][代码] [代码][代码]recorderManager.onStart(() => {[代码] [代码] [代码][代码]});[代码][代码] [代码][代码]recorderManager.onStop((res) => {[代码][代码] [代码][代码]console.log([代码][代码]"首页输出"[代码][代码])[代码][代码]})[代码][代码]})[代码]上边是index的 [代码]const app = getApp();[代码][代码]const recorderManager = wx.getRecorderManager();[代码][代码]const innerAudioContext = wx.createInnerAudioContext();[代码][代码]var[代码] [代码]util = require([代码][代码]'../../utils/util.js'[代码][代码]);[代码][代码]Page({[代码][代码]。。。。。[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]recorderManager.onStop((res) => {[代码][代码] [代码][代码]console.log([代码][代码]"detail输出"[代码][代码])[代码][代码]})[代码][代码]}[代码][代码]})[代码]
2018-02-02