|
@@ -8,7 +8,7 @@ import store from "store";
|
|
import { formateTimes } from "../../helpers/formateMusic";
|
|
import { formateTimes } from "../../helpers/formateMusic";
|
|
import { setCustomGradual, setCustomNoteRealValue } from "/src/helpers/customMusicScore"
|
|
import { setCustomGradual, setCustomNoteRealValue } from "/src/helpers/customMusicScore"
|
|
import { initSmoothAnimation, smoothAnimationState, destroySmoothAnimation, moveSmoothAnimationByPlayTime } from "../view-detail/smoothAnimation";
|
|
import { initSmoothAnimation, smoothAnimationState, destroySmoothAnimation, moveSmoothAnimationByPlayTime } from "../view-detail/smoothAnimation";
|
|
-import { api_playProgress, api_cloudLoading, simple_playProgress, simple_remove_playProgress, simple_play, simple_paused, simple_updateProgress, simple_musicPage } from "/src/helpers/communication";
|
|
|
|
|
|
+import { api_cloudLoading, simple_musicPage } from "/src/helpers/communication";
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: "simple-detail",
|
|
name: "simple-detail",
|
|
@@ -18,14 +18,14 @@ export default defineComponent({
|
|
const detailData = reactive({
|
|
const detailData = reactive({
|
|
isLoading: true,
|
|
isLoading: true,
|
|
currentTime: 0, // 当前播放的时间
|
|
currentTime: 0, // 当前播放的时间
|
|
- totalTime: 60000, // 音视频总时长
|
|
|
|
|
|
+ totalTime: 0, // 音视频总时长
|
|
});
|
|
});
|
|
|
|
|
|
const communicateCb = (res: any) => {
|
|
const communicateCb = (res: any) => {
|
|
// console.log('h5消息',res)
|
|
// console.log('h5消息',res)
|
|
// 开始播放
|
|
// 开始播放
|
|
if (res?.data?.api === "api_play") {
|
|
if (res?.data?.api === "api_play") {
|
|
- console.log('开始播放')
|
|
|
|
|
|
+ console.log('h5开始播放')
|
|
state.playState = 'play';
|
|
state.playState = 'play';
|
|
setStep();
|
|
setStep();
|
|
}
|
|
}
|
|
@@ -38,22 +38,24 @@ export default defineComponent({
|
|
if (res?.data?.api === "api_updateProgress") {
|
|
if (res?.data?.api === "api_updateProgress") {
|
|
console.log('拖动的进度')
|
|
console.log('拖动的进度')
|
|
if (state.playState === 'paused') {
|
|
if (state.playState === 'paused') {
|
|
- detailData.currentTime = res?.data?.data ? res?.data?.data : detailData.currentTime;
|
|
|
|
|
|
+ detailData.currentTime = res?.data?.content?.currentTime ? res?.data?.content?.currentTime : detailData.currentTime;
|
|
handlePlaying();
|
|
handlePlaying();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 播放进度
|
|
// 播放进度
|
|
if (res?.data?.api === "api_playProgress") {
|
|
if (res?.data?.api === "api_playProgress") {
|
|
- if (res?.data.data) {
|
|
|
|
- if (res?.data.data < detailData.currentTime) {
|
|
|
|
|
|
+ // console.log('h5播放进度',res)
|
|
|
|
+ if (res?.data?.content?.currentTime) {
|
|
|
|
+ if (res?.data?.content?.currentTime < detailData.currentTime) {
|
|
state.activeNoteIndex = 0
|
|
state.activeNoteIndex = 0
|
|
}
|
|
}
|
|
- detailData.currentTime = res?.data.data
|
|
|
|
|
|
+ detailData.currentTime = res?.data?.content?.currentTime
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
// 监听评测曲谱音频播放进度,返回
|
|
// 监听评测曲谱音频播放进度,返回
|
|
const progress = (res: any) => {
|
|
const progress = (res: any) => {
|
|
|
|
+ console.log('app播放进度',res)
|
|
const currentTime = res?.currentTime || res?.content?.currentTime;
|
|
const currentTime = res?.currentTime || res?.content?.currentTime;
|
|
if (currentTime) {
|
|
if (currentTime) {
|
|
if (currentTime < detailData.currentTime) {
|
|
if (currentTime < detailData.currentTime) {
|
|
@@ -65,6 +67,7 @@ export default defineComponent({
|
|
};
|
|
};
|
|
|
|
|
|
const simplePlay = () => {
|
|
const simplePlay = () => {
|
|
|
|
+ console.log('app开始播放')
|
|
state.playState = 'play';
|
|
state.playState = 'play';
|
|
setStep();
|
|
setStep();
|
|
}
|
|
}
|
|
@@ -74,8 +77,6 @@ export default defineComponent({
|
|
await getMusicDetail(id, 'open');
|
|
await getMusicDetail(id, 'open');
|
|
detailData.isLoading = false;
|
|
detailData.isLoading = false;
|
|
state.isSingleLine = true;
|
|
state.isSingleLine = true;
|
|
- simple_playProgress(progress);
|
|
|
|
- simple_play(simplePlay);
|
|
|
|
window.addEventListener("message", communicateCb);
|
|
window.addEventListener("message", communicateCb);
|
|
});
|
|
});
|
|
|
|
|