Commit 5f7083d7 authored by sujie@126.com's avatar sujie@126.com

dd

parent c6c4ebbb
......@@ -152,7 +152,36 @@ Page({
},
},
onLoad: function(options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext();
const that = this;
this.innerAudioContext = wx.getBackgroundAudioManager(); // 当前页面唯一的一个音频容器
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
return
}
audioStorage[actPalyaudioValue].isWaiting = true
that.setData({
audioStorage,
})
setTimeout((e)=>{
this.data.audioStorage[actPalyaudioValue].isWaiting = false;
this.setData({
audioStorage: this.data.audioStorage
})
},5000)
})
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
const {id, tid, cid, pagefrom,clockdate,sub} = options;
this.setData({
tid,
......@@ -1091,12 +1120,13 @@ audioStorage[value].isWaiting = true;
const {value, duration} = e.currentTarget.dataset;
const that = this;
let audioStorage = that.data.audioStorage;
this.innerAudioContext.src = audioorigin(value);
this.innerAudioContext.title = '正在播放';
this.innerAudioContext.startTime = audioStorage[value] ? audioStorage[value].currentTime : 0;
this.innerAudioContext.obeyMuteSwitch = false;
that.resetAudiosPlayStatus();
clearInterval(that.data.voiceInterval);
let audioStorage = that.data.audioStorage;
if (!audioStorage[value]) {
audioStorage[value] = {
play: true,
......@@ -1113,46 +1143,8 @@ audioStorage[value].isWaiting = true;
audioStorage[value].play = true;
}
}
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
return
}
audioStorage[actPalyaudioValue].isWaiting = true
that.setData({
audioStorage,
})
setTimeout((e)=>{
this.data.audioStorage[actPalyaudioValue].isWaiting = false;
this.setData({
audioStorage: this.data.audioStorage
})
},5000)
})
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
this.innerAudioContext.onCanplay((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
this.innerAudioContext.seek(audioStorage[value].currentTime)
//this.innerAudioContext.seek(audioStorage[value].currentTime)
this.innerAudioContext.play();
this.innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
......
......@@ -191,7 +191,35 @@ Page({
hasBack:false
},
onLoad: function (options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
const that = this;
this.innerAudioContext = wx.getBackgroundAudioManager(); // 当前页面唯一的一个音频容器
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
return
}
audioStorage[actPalyaudioValue].isWaiting = true
that.setData({
audioStorage,
})
setTimeout((e)=>{
this.data.audioStorage[actPalyaudioValue].isWaiting = false;
this.setData({
audioStorage: this.data.audioStorage
})
},5000)
})
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
const visitor = LocalStorage.getItem('visitor');
if (options.scene) {
let sceneQuery = scenQueryGet(options.scene);
......@@ -1861,11 +1889,13 @@ Page({
duration
} = e.detail;
const that = this;
let audioStorage = that.data.audioStorage;
this.innerAudioContext.src = audioorigin(value);
this.innerAudioContext.title = '正在播放';
this.innerAudioContext.startTime = audioStorage[value] ? audioStorage[value].currentTime : 0;
this.innerAudioContext.obeyMuteSwitch = false;
that.resetAudiosPlayStatus();
clearInterval(that.data.voiceInterval);
let audioStorage = that.data.audioStorage;
if (!audioStorage[value]) {
audioStorage[value] = {
play: true,
......@@ -1874,6 +1904,7 @@ Page({
isWaiting: true
}
} else {
audioStorage[value].isWaiting = true
if (audioStorage[value].currentTime == audioStorage[value].duration) {
audioStorage[value].currentTime = 0;
audioStorage[value].play = true;
......@@ -1881,46 +1912,8 @@ Page({
audioStorage[value].play = true;
}
}
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
return
}
audioStorage[actPalyaudioValue].isWaiting = true
that.setData({
audioStorage,
})
setTimeout((e)=>{
this.data.audioStorage[actPalyaudioValue].isWaiting = false;
this.setData({
audioStorage: this.data.audioStorage
})
},5000)
})
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
this.innerAudioContext.onCanplay((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
clearInterval(that.data.voiceInterval);
that.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
that.setData({
audioStorage,
})
}
})
this.innerAudioContext.seek(audioStorage[value].currentTime)
// this.innerAudioContext.seek(audioStorage[value].currentTime)
this.innerAudioContext.play();
this.innerAudioContext.onError((e)=>{
const audioStorage = this.data.audioStorage;
......
......@@ -154,7 +154,7 @@ Page({
loginCode: '',
},
onLoad: function (options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
this.innerAudioContext = wx.getBackgroundAudioManager(); // 当前页面唯一的一个音频容器
this.innerAudioContext.onWaiting((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
if(audioStorage[actPalyaudioValue].isWaiting){
......@@ -174,15 +174,26 @@ Page({
this.innerAudioContext.onTimeUpdate((e) => {
const { actPalyaudioValue, audioStorage} = this.data
if (audioStorage[actPalyaudioValue].isWaiting) {
//this.innerAudioContext.seek(audioStorage[actPalyaudioValue].currentTime || 0)
clearInterval(this.data.voiceInterval);
this.voiceIntervalPlay(actPalyaudioValue);
audioStorage[actPalyaudioValue].isWaiting = false
this.setData({
[`audioStorage.${actPalyaudioValue}`] : audioStorage[actPalyaudioValue],
})
}
})
// this.innerAudioContext.onPlay(()=>{
// const { actPalyaudioValue, audioStorage} = this.data;
// console.log(audioStorage[actPalyaudioValue], 'audioStorage[actPalyaudioValue]')
// if(audioStorage[actPalyaudioValue]){
// this.innerAudioContext.seek(audioStorage[actPalyaudioValue].currentTime || 0)
// }
// this.data.audioStorage[actPalyaudioValue].isFirst = true;
// })
if (options.scene) {
let sceneQuery = scenQueryGet(options.scene);
const {
......@@ -1391,11 +1402,15 @@ Page({
duration
} = e.detail;
const that = this;
let audioStorage = that.data.audioStorage;
this.innerAudioContext.src = audioorigin(value);
this.innerAudioContext.title = '正在播放';
this.innerAudioContext.startTime = audioStorage[value] ? audioStorage[value].currentTime : 0;
this.innerAudioContext.obeyMuteSwitch = false;
that.resetAudiosPlayStatus();
clearInterval(that.data.voiceInterval);
let audioStorage = that.data.audioStorage;
if (!audioStorage[value]) {
audioStorage[value] = {
play: true,
......@@ -1411,11 +1426,9 @@ Page({
} else {
audioStorage[value].play = true;
}
}
this.innerAudioContext.seek(audioStorage[value].currentTime)
}
this.innerAudioContext.play();
this.innerAudioContext.onError((e)=>{
const { actPalyaudioValue, audioStorage} = this.data
audioStorage[actPalyaudioValue].isWaiting = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment