|
@@ -38,10 +38,7 @@ export const useAudioStore = defineStore('audio', () => {
|
|
|
|
|
|
|
|
audioContext.onEnded(() => {
|
|
audioContext.onEnded(() => {
|
|
|
isPlaying.value = false;
|
|
isPlaying.value = false;
|
|
|
- // 自动播放下一首
|
|
|
|
|
- if (hasNext.value) {
|
|
|
|
|
- playNext();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 不自动播放下一首,让用户手动选择
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
audioContext.onTimeUpdate(() => {
|
|
audioContext.onTimeUpdate(() => {
|
|
@@ -156,10 +153,10 @@ export const useAudioStore = defineStore('audio', () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 设置播放列表
|
|
// 设置播放列表
|
|
|
- function setPlaylist(list: AudioItem[], index: number = 0) {
|
|
|
|
|
|
|
+ function setPlaylist(list: AudioItem[], index: number = 0, autoPlay: boolean = true) {
|
|
|
playlist.value = list;
|
|
playlist.value = list;
|
|
|
currentIndex.value = index;
|
|
currentIndex.value = index;
|
|
|
- if (list.length > 0) {
|
|
|
|
|
|
|
+ if (list.length > 0 && autoPlay) {
|
|
|
play(list[index]);
|
|
play(list[index]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|