|
@@ -9,7 +9,7 @@ import { handleStartTick } from "./view/tick";
|
|
|
import { audioListStart, getAudioCurrentTime, getAudioDuration, setAudioCurrentTime, setAudioPlaybackRate, audioData } from "./view/audio-list";
|
|
|
import { toggleFollow } from "./view/follow-practice";
|
|
|
import { browser, setStorageSpeed, setGlobalData } from "./utils";
|
|
|
-import { api_cloudGetMediaStatus, api_createMusicPlayer, api_cloudChangeSpeed } from "./helpers/communication";
|
|
|
+import { api_cloudGetMediaStatus, api_createMusicPlayer, api_cloudChangeSpeed, api_cloudSuspend, api_cloudSetCurrentTime } from "./helpers/communication";
|
|
|
import { verifyCanRepeat, getDuration } from "./helpers/formateMusic";
|
|
|
import { getMusicSheetDetail } from "./utils/baseApi"
|
|
|
import { getQuery } from "/src/utils/queryString";
|
|
@@ -576,7 +576,7 @@ const handlePlaying = () => {
|
|
|
metronomeData.metro?.sound(currentTime);
|
|
|
};
|
|
|
/** 跳转到指定音符开始播放 */
|
|
|
-export const skipNotePlay = (itemIndex: number, isStart = false) => {
|
|
|
+export const skipNotePlay = async (itemIndex: number, isStart = false) => {
|
|
|
const item = state.times[itemIndex];
|
|
|
let itemTime = item.time;
|
|
|
if (isStart) {
|
|
@@ -587,6 +587,10 @@ export const skipNotePlay = (itemIndex: number, isStart = false) => {
|
|
|
gotoNext(item);
|
|
|
metronomeData.metro?.sound(itemTime);
|
|
|
if (state.isAppPlay) {
|
|
|
+ await api_cloudSetCurrentTime({
|
|
|
+ currentTime: itemTime * 1000,
|
|
|
+ songID: state.examSongId,
|
|
|
+ })
|
|
|
audioData.progress = itemTime
|
|
|
}
|
|
|
}
|
|
@@ -599,7 +603,13 @@ export const skipNotePlay = (itemIndex: number, isStart = false) => {
|
|
|
export const togglePlay = async (playState?: "play" | "paused") => {
|
|
|
// midi播放
|
|
|
if (state.isAppPlay) {
|
|
|
- if( playState === "paused" ) return
|
|
|
+ if( playState === "paused" ) {
|
|
|
+ await api_cloudSuspend({
|
|
|
+ songID: state.examSongId,
|
|
|
+ })
|
|
|
+ state.playState = 'paused'
|
|
|
+ return
|
|
|
+ }
|
|
|
await api_cloudChangeSpeed({
|
|
|
speed: state.modeType === "evaluating" ? state.originSpeed : state.speed,
|
|
|
originalSpeed: state.originSpeed,
|