Browse Source

feat: 切换音频的时候 设置音频时间

TIANYONG 1 week ago
parent
commit
1bdd9cdb67
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/view/audio-list/index.tsx

+ 5 - 0
src/view/audio-list/index.tsx

@@ -369,6 +369,7 @@ export const handleLoadBeatMusic = async () => {
 
 // 切换对应的声轨,并且配置当前的audio
 export async function changeCombineAudio (combineIndex: number){
+	const currentTime = getAudioCurrentTime()
 	// 重复点击的时候取消选中 原音
 	if(combineIndex === audioData.combineIndex){
 		audioData.combineIndex = -1
@@ -380,6 +381,8 @@ export async function changeCombineAudio (combineIndex: number){
 		if(!state.accompany) {
 			state.noMusicSource = true
 		}
+		//设置进度
+		setAudioCurrentTime(currentTime)
 		return
 	}
 	state.loadingText = "资源加载中,请稍后…";
@@ -432,6 +435,8 @@ export async function changeCombineAudio (combineIndex: number){
 	if(!state.accompany) {
 		state.noMusicSource = false
 	}
+	//设置进度
+	setAudioCurrentTime(currentTime)
 	showToast({
 		message:  "已开启原声",
 		position: "top",