|
@@ -66,8 +66,16 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
+ console.log(options);
|
|
|
let videoId = options.videoId
|
|
|
- this.getreadInfo(videoId, options.reset)
|
|
|
+ this.getreadInfo(videoId, options.reset).then(res => {
|
|
|
+ if (options.voluntarily) {
|
|
|
+ this.setCountDown()
|
|
|
+ }
|
|
|
+ if (options.autoPlay) {
|
|
|
+ this.videoPlay()
|
|
|
+ }
|
|
|
+ })
|
|
|
this.setData({
|
|
|
readingReset: options.reset || false,
|
|
|
readingType: options.readingType || 'public',
|
|
@@ -151,40 +159,44 @@ Page({
|
|
|
["silderData.sliderValue"]: 100
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
// 获取阅读内容
|
|
|
- async getreadInfo(videoId, reset = false) {
|
|
|
- let videoInfo = await getreadInfo(videoId)
|
|
|
- /* wx.setNavigationBarTitle({
|
|
|
- title: videoInfo.userRead.title
|
|
|
- }) */
|
|
|
- let data = JSON.parse(videoInfo.userReadExtend.lessonText)
|
|
|
- data = data.map((item, index) => {
|
|
|
- item.time = Number(item.time)
|
|
|
- item.readTime = data[index + 1] ? data[index + 1].time - item.time : ''
|
|
|
- return item
|
|
|
- })
|
|
|
- this.setData({
|
|
|
- videoPath: videoInfo.userRead.originVideo,
|
|
|
- article: data,
|
|
|
- videoInfo,
|
|
|
- ["silderData.endTime"]: setDuration(videoInfo.userRead.duration)
|
|
|
- })
|
|
|
- if (!reset) {
|
|
|
- this.getHeight()
|
|
|
- }
|
|
|
- if (this.data.videoInfo.userReadExtend.resourcesType == 0) {
|
|
|
- this.videoContext = wx.createVideoContext('myVideo')
|
|
|
- } else {
|
|
|
- this.innerAudioContext.src = videoInfo.userRead.originVideo
|
|
|
- this.innerAudioContext.onEnded(res => {
|
|
|
- console.log("138innerAudioContext触发的");
|
|
|
- this.resetReading()
|
|
|
+ getreadInfo(videoId, reset = false) {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ let videoInfo = await getreadInfo(videoId)
|
|
|
+ /* wx.setNavigationBarTitle({
|
|
|
+ title: videoInfo.userRead.title
|
|
|
+ }) */
|
|
|
+ let data = JSON.parse(videoInfo.userReadExtend.lessonText)
|
|
|
+ data = data.map((item, index) => {
|
|
|
+ item.time = Number(item.time)
|
|
|
+ item.readTime = data[index + 1] ? data[index + 1].time - item.time : ''
|
|
|
+ return item
|
|
|
})
|
|
|
- this.innerAudioContext.onStop((res) => {
|
|
|
- console.log("143innerAudioContext触发的");
|
|
|
- });
|
|
|
- }
|
|
|
+ this.setData({
|
|
|
+ videoPath: videoInfo.userRead.originVideo,
|
|
|
+ article: data,
|
|
|
+ videoInfo,
|
|
|
+ ["silderData.endTime"]: setDuration(videoInfo.userRead.duration)
|
|
|
+ })
|
|
|
+ if (!reset) {
|
|
|
+ this.getHeight()
|
|
|
+ }
|
|
|
+ if (this.data.videoInfo.userReadExtend.resourcesType == 0) {
|
|
|
+ this.videoContext = wx.createVideoContext('myVideo')
|
|
|
+ } else {
|
|
|
+ this.innerAudioContext.src = videoInfo.userRead.originVideo
|
|
|
+ this.innerAudioContext.onEnded(res => {
|
|
|
+ console.log("138innerAudioContext触发的");
|
|
|
+ this.resetReading()
|
|
|
+ })
|
|
|
+ this.innerAudioContext.onStop((res) => {
|
|
|
+ console.log("143innerAudioContext触发的");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
},
|
|
|
// 开始录制
|
|
|
setCountDown() {
|
|
@@ -666,7 +678,7 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
- console.log(wx.getStorageSync('shareVideoId'),'reading-wx.getStorageSync');
|
|
|
+ console.log(wx.getStorageSync('shareVideoId'), 'reading-wx.getStorageSync');
|
|
|
wx.canvasToTempFilePath({
|
|
|
canvas: canvas,
|
|
|
success(res) {
|