|
@@ -16,6 +16,9 @@ import {
|
|
|
import {
|
|
|
store
|
|
|
} from '~/store/index'
|
|
|
+import {
|
|
|
+ setDuration
|
|
|
+} from '~/utils/util'
|
|
|
const aiengine = require('~/utils/ChivoxAiEngine')
|
|
|
const sha1 = require('~/utils/sha1');
|
|
|
// 文章行高
|
|
@@ -55,7 +58,12 @@ Page({
|
|
|
readingType: 'public',
|
|
|
percent: 0,
|
|
|
uploadState: false,
|
|
|
- article: []
|
|
|
+ article: [],
|
|
|
+ silderData: {
|
|
|
+ currentTime: '00:00',
|
|
|
+ endTime: '00:00',
|
|
|
+ silderValue: 0
|
|
|
+ }
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
let videoId = options.videoId
|
|
@@ -100,6 +108,12 @@ Page({
|
|
|
});
|
|
|
this.innerAudioContext = wx.createInnerAudioContext();
|
|
|
this.resultAudioContext = wx.createInnerAudioContext();
|
|
|
+ this.resultAudioContext.onTimeUpdate(res => {
|
|
|
+ this.setData({
|
|
|
+ ["silderData.sliderValue"]: Math.round(this.resultAudioContext.currentTime / this.resultAudioContext.duration * 100),
|
|
|
+ ["silderData.currentTime"]: setDuration(this.resultAudioContext.currentTime)
|
|
|
+ })
|
|
|
+ })
|
|
|
this.resultAudioContext.onEnded(res => {
|
|
|
console.log('102-resultAudioContext.ended');
|
|
|
this.setData({
|
|
@@ -120,6 +134,11 @@ Page({
|
|
|
this.videoContext.seek(0)
|
|
|
}
|
|
|
});
|
|
|
+ this.resultAudioContext.onEnded(res => {
|
|
|
+ this.setData({
|
|
|
+ ["silderData.sliderValue"]: 100
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
// 获取阅读内容
|
|
|
async getreadInfo(videoId, reset = false) {
|
|
@@ -136,7 +155,8 @@ Page({
|
|
|
this.setData({
|
|
|
videoPath: videoInfo.userRead.originVideo,
|
|
|
article: data,
|
|
|
- videoInfo
|
|
|
+ videoInfo,
|
|
|
+ ["silderData.endTime"]: setDuration(videoInfo.userRead.duration)
|
|
|
})
|
|
|
if (!reset) {
|
|
|
this.getHeight()
|
|
@@ -144,7 +164,6 @@ Page({
|
|
|
if (this.data.videoInfo.userReadExtend.resourcesType == 0) {
|
|
|
this.videoContext = wx.createVideoContext('myVideo')
|
|
|
} else {
|
|
|
- console.log('走了136');
|
|
|
this.innerAudioContext.src = videoInfo.userRead.originVideo
|
|
|
this.innerAudioContext.onEnded(res => {
|
|
|
console.log("138innerAudioContext触发的");
|
|
@@ -405,7 +424,9 @@ Page({
|
|
|
return this.resultAudioContext.stop()
|
|
|
}
|
|
|
this.resultAudioContext.src = this.data.readingReset ? this.data.readDetail.tempFilePath : this.data.videoInfo.userRead.audioPath;
|
|
|
- this.resultAudioContext.play();
|
|
|
+ setTimeout(() => {
|
|
|
+ this.resultAudioContext.play();
|
|
|
+ }, 200)
|
|
|
this.setData({
|
|
|
exampleState: true
|
|
|
})
|
|
@@ -497,6 +518,17 @@ Page({
|
|
|
this.rowH = rect.height
|
|
|
}).exec()
|
|
|
},
|
|
|
+ // 进度条
|
|
|
+ slider({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.resultAudioContext.pause();
|
|
|
+ console.log(detail.value / 100 * this.data.videoInfo.userRead.duration)
|
|
|
+ this.resultAudioContext.seek(detail.value / 100 * this.data.videoInfo.userRead.duration)
|
|
|
+ setTimeout(() => {
|
|
|
+ this.resultAudioContext.play()
|
|
|
+ }, 300)
|
|
|
+ },
|
|
|
onHide() {
|
|
|
this.resetReading()
|
|
|
},
|