|
@@ -146,14 +146,8 @@ export const toggleMutePlayAudio = (source: IPlayState, muted: boolean) => {
|
|
|
|
|
|
/** 切换节拍器音源 */
|
|
|
export const changeSongSourceByBate = (isDisBate:boolean) => {
|
|
|
+ const currentTime = getAudioCurrentTime()
|
|
|
// isDisBate 为true 切换到不带节拍的,为false 切换到带节拍的
|
|
|
- let currentTime
|
|
|
- if(state.playSource === "mingSong"){
|
|
|
- currentTime = audioData.mingSongEle?.currentTime
|
|
|
- }else{
|
|
|
- currentTime = audioData.songEle?.currentTime || audioData.backgroundEle?.currentTime
|
|
|
- }
|
|
|
- currentTime || (currentTime = audioData.progress || 0)
|
|
|
if (isDisBate) {
|
|
|
if(state.playType === "play"){
|
|
|
audioData.songEle = audioData.songCollection.songEle
|
|
@@ -174,12 +168,8 @@ export const changeSongSourceByBate = (isDisBate:boolean) => {
|
|
|
audioData.mingSongEle = audioData.songCollection.betaMingSongEle || audioData.songCollection.mingSongEle
|
|
|
}
|
|
|
}
|
|
|
- audioData.songEle && (audioData.songEle.currentTime = currentTime)
|
|
|
- audioData.backgroundEle && (audioData.backgroundEle.currentTime = currentTime)
|
|
|
- // 当前是唱名才设置时间
|
|
|
- if(state.playSource === "mingSong") {
|
|
|
- audioData.mingSongEle && (audioData.mingSongEle.currentTime = currentTime)
|
|
|
- }
|
|
|
+ // 设置进度
|
|
|
+ setAudioCurrentTime(currentTime)
|
|
|
// 设置静音与取消静音
|
|
|
if (state.playSource === "music") {
|
|
|
audioData.songEle && (audioData.songEle.muted = false);
|