|
@@ -274,7 +274,6 @@ export struct LocalMusic {
|
|
|
@State favList: Array<VideoItem> = []
|
|
@State favList: Array<VideoItem> = []
|
|
|
@Consume isFavMusic: boolean
|
|
@Consume isFavMusic: boolean
|
|
|
@State isClickedPLayAll: boolean = false;
|
|
@State isClickedPLayAll: boolean = false;
|
|
|
- private scrollerForlist: ListScroller = new ListScroller();
|
|
|
|
|
private knockController: KnockController | undefined = undefined;
|
|
private knockController: KnockController | undefined = undefined;
|
|
|
imagesF: ImageFrameInfo[] = [
|
|
imagesF: ImageFrameInfo[] = [
|
|
|
{ src: $r("app.media.app_loading0") },
|
|
{ src: $r("app.media.app_loading0") },
|
|
@@ -337,11 +336,6 @@ export struct LocalMusic {
|
|
|
this.saveCacheToStorage()
|
|
this.saveCacheToStorage()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 删除字符串缓存
|
|
|
|
|
- private deleteStringCache(key: string) {
|
|
|
|
|
- this.stringCache.delete(key);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 多选机制
|
|
// 多选机制
|
|
|
@State selectedFiles: Array<VideoItem> = [];
|
|
@State selectedFiles: Array<VideoItem> = [];
|
|
|
@State isMultiSelect: boolean = false;
|
|
@State isMultiSelect: boolean = false;
|
|
@@ -549,72 +543,83 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onSongChanged(song: VideoItem): void {
|
|
onSongChanged(song: VideoItem): void {
|
|
|
|
|
+ console.log(`Heanup onSongChanged - 开始处理歌曲切换: ${song.name}`);
|
|
|
|
|
+ console.log(`Heanup onSongChanged - 切换前 oldSeconds: ${this.localMusic.oldSeconds}, currentTime: ${this.localMusic.currentTime}`);
|
|
|
|
|
+
|
|
|
|
|
+ // 立即重置时间显示状态,防止新歌曲时间显示被上一首歌曲的时间"卡住"
|
|
|
|
|
+ this.localMusic.oldSeconds = 0;
|
|
|
|
|
+ this.localMusic.currentTime = "00:00";
|
|
|
|
|
+ this.localMusic.lastSongPath = song.filePath; // 更新当前歌曲路径
|
|
|
|
|
+
|
|
|
|
|
+ console.log(`Heanup onSongChanged - 重置后 oldSeconds: ${this.localMusic.oldSeconds}, currentTime: ${this.localMusic.currentTime}`);
|
|
|
|
|
+
|
|
|
// 同步当前歌曲信息
|
|
// 同步当前歌曲信息
|
|
|
this.localMusic.currentSong = song;
|
|
this.localMusic.currentSong = song;
|
|
|
this.localMusic.videoUrl = song.filePath;
|
|
this.localMusic.videoUrl = song.filePath;
|
|
|
this.localMusic.name = song.name;
|
|
this.localMusic.name = song.name;
|
|
|
this.localMusic.artist = song.artist;
|
|
this.localMusic.artist = song.artist;
|
|
|
this.localMusic.cover = song.pixelMapPath;
|
|
this.localMusic.cover = song.pixelMapPath;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新当前索引
|
|
// 更新当前索引
|
|
|
const currentIndex: number = this.localMusic.unifiedPlayerService.getCurrentIndex();
|
|
const currentIndex: number = this.localMusic.unifiedPlayerService.getCurrentIndex();
|
|
|
this.localMusic.curIndex = currentIndex;
|
|
this.localMusic.curIndex = currentIndex;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步到AppStorage,确保卡片能获取到最新状态
|
|
// 同步到AppStorage,确保卡片能获取到最新状态
|
|
|
AppStorage.setOrCreate('currentSong', song);
|
|
AppStorage.setOrCreate('currentSong', song);
|
|
|
AppStorage.setOrCreate('currIndex', currentIndex);
|
|
AppStorage.setOrCreate('currIndex', currentIndex);
|
|
|
AppStorage.setOrCreate('songList', this.localMusic.songList);
|
|
AppStorage.setOrCreate('songList', this.localMusic.songList);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新最近播放时间
|
|
// 更新最近播放时间
|
|
|
this.localMusic.updateLastPlayTimeStr(song.filePath);
|
|
this.localMusic.updateLastPlayTimeStr(song.filePath);
|
|
|
-
|
|
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Song synchronized - ${song.name} at index ${currentIndex}`);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ console.log(`Heanup onSongChanged - 歌曲切换完成: ${song.name} at index ${currentIndex}`);
|
|
|
|
|
+ LogUtils.getInstance().LOGI(`LocalMusic: Song synchronized - ${song.name} at index ${currentIndex} - oldSeconds=${this.localMusic.oldSeconds},currentTime=${this.localMusic.currentTime}`);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
onProgressChanged(progress: PlayProgress): void {
|
|
onProgressChanged(progress: PlayProgress): void {
|
|
|
// 同步进度更新到UI
|
|
// 同步进度更新到UI
|
|
|
this.localMusic.syncProgressFromService(progress);
|
|
this.localMusic.syncProgressFromService(progress);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 广播进度更新到卡片
|
|
// 广播进度更新到卡片
|
|
|
this.localMusic.broadcastProgressIfNeeded();
|
|
this.localMusic.broadcastProgressIfNeeded();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
onError(error: PlayerError): void {
|
|
onError(error: PlayerError): void {
|
|
|
LogUtils.getInstance().LOGI(`UnifiedPlayerService error in LocalMusic: ${error.message}`);
|
|
LogUtils.getInstance().LOGI(`UnifiedPlayerService error in LocalMusic: ${error.message}`);
|
|
|
ToastUtil.showToast(`播放错误: ${error.message}`);
|
|
ToastUtil.showToast(`播放错误: ${error.message}`);
|
|
|
this.localMusic.handlePlaybackError();
|
|
this.localMusic.handlePlaybackError();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const stateListener = new LocalMusicStateListener(this);
|
|
const stateListener = new LocalMusicStateListener(this);
|
|
|
this.unifiedPlayerService.addStateListener(stateListener);
|
|
this.unifiedPlayerService.addStateListener(stateListener);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 不设置LocalMusic自己的AVSession监听器,完全依赖UnifiedPlayerService
|
|
// 不设置LocalMusic自己的AVSession监听器,完全依赖UnifiedPlayerService
|
|
|
// UnifiedPlayerService已经设置了AVSession监听器,状态变化会通过StateListener传播到LocalMusic
|
|
// UnifiedPlayerService已经设置了AVSession监听器,状态变化会通过StateListener传播到LocalMusic
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: Relying on UnifiedPlayerService for AVSession handling');
|
|
LogUtils.getInstance().LOGI('LocalMusic: Relying on UnifiedPlayerService for AVSession handling');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 初始化完成后,立即同步当前状态到UI
|
|
// 初始化完成后,立即同步当前状态到UI
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
try {
|
|
try {
|
|
|
const currentState = this.unifiedPlayerService.getCurrentState();
|
|
const currentState = this.unifiedPlayerService.getCurrentState();
|
|
|
const actuallyPlaying = this.unifiedPlayerService.getActualPlayingState();
|
|
const actuallyPlaying = this.unifiedPlayerService.getActualPlayingState();
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Syncing current state - StateModel: ${currentState.isPlaying}, ActualPlayer: ${actuallyPlaying}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Syncing current state - StateModel: ${currentState.isPlaying}, ActualPlayer: ${actuallyPlaying}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 手动触发状态同步,确保UI显示正确(使用实际播放器状态)
|
|
// 手动触发状态同步,确保UI显示正确(使用实际播放器状态)
|
|
|
stateListener.onStateChanged(currentState);
|
|
stateListener.onStateChanged(currentState);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Failed to sync current state: ${error}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Failed to sync current state: ${error}`);
|
|
|
}
|
|
}
|
|
|
}, 200); // 短延迟,确保组件完全初始化
|
|
}, 200); // 短延迟,确保组件完全初始化
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: UnifiedPlayerService initialized successfully');
|
|
LogUtils.getInstance().LOGI('LocalMusic: UnifiedPlayerService initialized successfully');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 初始化完成后,开始加载本地文件
|
|
// 初始化完成后,开始加载本地文件
|
|
|
this.loadLocalFilesAfterServiceInit();
|
|
this.loadLocalFilesAfterServiceInit();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Failed to initialize UnifiedPlayerService: ${error}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Failed to initialize UnifiedPlayerService: ${error}`);
|
|
|
ToastUtil.showToast('播放器服务初始化失败');
|
|
ToastUtil.showToast('播放器服务初始化失败');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 即使服务初始化失败,也要加载本地文件
|
|
// 即使服务初始化失败,也要加载本地文件
|
|
|
this.loadLocalFilesAfterServiceInit();
|
|
this.loadLocalFilesAfterServiceInit();
|
|
|
}
|
|
}
|
|
@@ -624,15 +629,15 @@ export struct LocalMusic {
|
|
|
// 加载本地文件,然后恢复播放列表
|
|
// 加载本地文件,然后恢复播放列表
|
|
|
this.getSortedFiles(this.rootPath).then(async () => {
|
|
this.getSortedFiles(this.rootPath).then(async () => {
|
|
|
this.isFavMusic = false;
|
|
this.isFavMusic = false;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 数据恢复已在initUnifiedPlayerService中完成,直接获取播放列表
|
|
// 数据恢复已在initUnifiedPlayerService中完成,直接获取播放列表
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: Getting playlist from UnifiedPlayerService after file loading');
|
|
LogUtils.getInstance().LOGI('LocalMusic: Getting playlist from UnifiedPlayerService after file loading');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 尝试从UnifiedPlayerService恢复播放列表
|
|
// 尝试从UnifiedPlayerService恢复播放列表
|
|
|
const unifiedPlaylist = this.unifiedPlayerService.getPlaylist();
|
|
const unifiedPlaylist = this.unifiedPlayerService.getPlaylist();
|
|
|
const unifiedIndex = this.unifiedPlayerService.getCurrentIndex();
|
|
const unifiedIndex = this.unifiedPlayerService.getCurrentIndex();
|
|
|
const unifiedSong = this.unifiedPlayerService.getCurrentSong();
|
|
const unifiedSong = this.unifiedPlayerService.getCurrentSong();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (ArrayUtil.isNotEmpty(unifiedPlaylist)) {
|
|
if (ArrayUtil.isNotEmpty(unifiedPlaylist)) {
|
|
|
// 使用UnifiedPlayerService的数据
|
|
// 使用UnifiedPlayerService的数据
|
|
|
this.songList = unifiedPlaylist;
|
|
this.songList = unifiedPlaylist;
|
|
@@ -655,11 +660,11 @@ export struct LocalMusic {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Using legacy playlist storage - ${this.songList.length} songs, index ${this.curIndex}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Using legacy playlist storage - ${this.songList.length} songs, index ${this.curIndex}`);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步播放列表和当前索引到AppStorage,确保卡片能访问
|
|
// 同步播放列表和当前索引到AppStorage,确保卡片能访问
|
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
this.isFirstStartPlay = true
|
|
this.isFirstStartPlay = true
|
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
@@ -671,10 +676,10 @@ export struct LocalMusic {
|
|
|
this.name = this.currentSong.name
|
|
this.name = this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
this.cover = this.currentSong.pixelMapPath
|
|
|
this.artist = this.currentSong.artist
|
|
this.artist = this.currentSong.artist
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步当前歌曲到AppStorage
|
|
// 同步当前歌曲到AppStorage
|
|
|
AppStorage.setOrCreate('currentSong', this.currentSong);
|
|
AppStorage.setOrCreate('currentSong', this.currentSong);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Playlist restored - ${this.songList.length} songs, current: ${this.currentSong.name}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Playlist restored - ${this.songList.length} songs, current: ${this.currentSong.name}`);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -1053,7 +1058,7 @@ export struct LocalMusic {
|
|
|
// this.loadBannerAd(CSJUtil.getBannerID())
|
|
// this.loadBannerAd(CSJUtil.getBannerID())
|
|
|
|
|
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: mkDownLoadDir - Files loaded, skipping playlist restoration (already done in initUnifiedPlayerService)');
|
|
LogUtils.getInstance().LOGI('LocalMusic: mkDownLoadDir - Files loaded, skipping playlist restoration (already done in initUnifiedPlayerService)');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 播放列表恢复逻辑已经在 initUnifiedPlayerService 中完成,这里不需要重复
|
|
// 播放列表恢复逻辑已经在 initUnifiedPlayerService 中完成,这里不需要重复
|
|
|
// 只需要确保UI状态是最新的
|
|
// 只需要确保UI状态是最新的
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
@@ -1069,7 +1074,7 @@ export struct LocalMusic {
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
this.cover = this.currentSong.pixelMapPath
|
|
|
AppStorage.setOrCreate('currentSong',this.currentSong);
|
|
AppStorage.setOrCreate('currentSong',this.currentSong);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: mkDownLoadDir - UI updated with existing playlist: ${this.songList.length} songs`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: mkDownLoadDir - UI updated with existing playlist: ${this.songList.length} songs`);
|
|
|
} else {
|
|
} else {
|
|
|
this.name = '空空如也'
|
|
this.name = '空空如也'
|
|
@@ -1355,27 +1360,27 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
this.dataSource.pushArrayData(this.videoLocalList)
|
|
this.dataSource.pushArrayData(this.videoLocalList)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果当前有播放列表,检查是否需要更新播放列表到统一播放器服务
|
|
// 如果当前有播放列表,检查是否需要更新播放列表到统一播放器服务
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
const globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
const globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 只有在没有现有播放列表时,才使用当前目录的文件列表
|
|
// 只有在没有现有播放列表时,才使用当前目录的文件列表
|
|
|
// 避免在文件列表更新时破坏用户的播放列表
|
|
// 避免在文件列表更新时破坏用户的播放列表
|
|
|
if (ArrayUtil.isEmpty(this.songList) && ArrayUtil.isNotEmpty(globalVideoList)) {
|
|
if (ArrayUtil.isEmpty(this.songList) && ArrayUtil.isNotEmpty(globalVideoList)) {
|
|
|
this.songList = globalVideoList;
|
|
this.songList = globalVideoList;
|
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步到统一播放器服务进行持久化
|
|
// 同步到统一播放器服务进行持久化
|
|
|
this.syncPlaylistToService();
|
|
this.syncPlaylistToService();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: updateListData - Created initial playlist with ${this.songList.length} songs`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: updateListData - Created initial playlist with ${this.songList.length} songs`);
|
|
|
} else {
|
|
} else {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: updateListData - Preserving existing playlist with ${this.songList.length} songs, current directory has ${globalVideoList.length} songs`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: updateListData - Preserving existing playlist with ${this.songList.length} songs, current directory has ${globalVideoList.length} songs`);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
animateTo({ duration: 888 }, () => {
|
|
animateTo({ duration: 888 }, () => {
|
|
|
this.opacityItem = 1;
|
|
this.opacityItem = 1;
|
|
|
});
|
|
});
|
|
@@ -4780,10 +4785,10 @@ export struct LocalMusic {
|
|
|
// 点击文件列表中的歌曲,需要判断是否要创建新的播放列表
|
|
// 点击文件列表中的歌曲,需要判断是否要创建新的播放列表
|
|
|
let globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
let globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
|
this.curIndex = Utility.getCurIndexFromGlobalList(globalVideoList, item.filePath)
|
|
this.curIndex = Utility.getCurIndexFromGlobalList(globalVideoList, item.filePath)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 检查当前播放列表是否包含这首歌
|
|
// 检查当前播放列表是否包含这首歌
|
|
|
const currentSongIndex = this.songList.findIndex(song => song.filePath === item.filePath);
|
|
const currentSongIndex = this.songList.findIndex(song => song.filePath === item.filePath);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (currentSongIndex >= 0 && ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (currentSongIndex >= 0 && ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
// 如果当前播放列表已经包含这首歌,使用现有播放列表
|
|
// 如果当前播放列表已经包含这首歌,使用现有播放列表
|
|
|
this.curIndex = currentSongIndex;
|
|
this.curIndex = currentSongIndex;
|
|
@@ -4801,7 +4806,7 @@ export struct LocalMusic {
|
|
|
AppStorage.setOrCreate('currentSong',this.currentSong) ;
|
|
AppStorage.setOrCreate('currentSong',this.currentSong) ;
|
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.videoUrl = this.currentSong.filePath
|
|
this.videoUrl = this.currentSong.filePath
|
|
|
this.name = this.currentSong.name
|
|
this.name = this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
this.cover = this.currentSong.pixelMapPath
|
|
@@ -4809,7 +4814,7 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
// 同步播放列表到UnifiedPlayerService
|
|
// 同步播放列表到UnifiedPlayerService
|
|
|
this.syncPlaylistToService();
|
|
this.syncPlaylistToService();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtil.info('this.currentSong.duration =' + this.currentSong.duration)
|
|
LogUtil.info('this.currentSong.duration =' + this.currentSong.duration)
|
|
|
LogUtil.info('this.currentSong.sampleRate =' + this.currentSong.sampleRate)
|
|
LogUtil.info('this.currentSong.sampleRate =' + this.currentSong.sampleRate)
|
|
|
LogUtil.info('this.currentSongmimeType =' + this.currentSong.mimeType)
|
|
LogUtil.info('this.currentSongmimeType =' + this.currentSong.mimeType)
|
|
@@ -5921,30 +5926,30 @@ export struct LocalMusic {
|
|
|
if (newIndex < 0 || newIndex >= this.songList.length) {
|
|
if (newIndex < 0 || newIndex >= this.songList.length) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
// 使用UnifiedPlayerService进行播放列表重排序
|
|
// 使用UnifiedPlayerService进行播放列表重排序
|
|
|
const removedSong = this.unifiedPlayerService.removeFromPlaylist(index);
|
|
const removedSong = this.unifiedPlayerService.removeFromPlaylist(index);
|
|
|
if (removedSong) {
|
|
if (removedSong) {
|
|
|
this.unifiedPlayerService.addToPlaylist(removedSong, newIndex);
|
|
this.unifiedPlayerService.addToPlaylist(removedSong, newIndex);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新本地播放列表
|
|
// 更新本地播放列表
|
|
|
let tmp = this.songList.splice(index, 1);
|
|
let tmp = this.songList.splice(index, 1);
|
|
|
this.songList.splice(newIndex, 0, tmp[0]);
|
|
this.songList.splice(newIndex, 0, tmp[0]);
|
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新当前索引
|
|
// 更新当前索引
|
|
|
this.curIndex = Utility.getIndexFromList(this.songList, this.videoUrl);
|
|
this.curIndex = Utility.getIndexFromList(this.songList, this.videoUrl);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步到AppStorage
|
|
// 同步到AppStorage
|
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Moved song from ${index} to ${newIndex} via UnifiedPlayerService`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Moved song from ${index} to ${newIndex} via UnifiedPlayerService`);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic itemMoveSon error: ${error}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic itemMoveSon error: ${error}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 错误处理:回退到原有逻辑
|
|
// 错误处理:回退到原有逻辑
|
|
|
let tmp = this.songList.splice(index, 1);
|
|
let tmp = this.songList.splice(index, 1);
|
|
|
this.songList.splice(newIndex, 0, tmp[0]);
|
|
this.songList.splice(newIndex, 0, tmp[0]);
|
|
@@ -6206,13 +6211,13 @@ export struct LocalMusic {
|
|
|
// 使用更低的阈值和滑动速度判断
|
|
// 使用更低的阈值和滑动速度判断
|
|
|
const minDistance = 100; // 最小滑动距离 100vp
|
|
const minDistance = 100; // 最小滑动距离 100vp
|
|
|
const minVelocity = 500; // 最小滑动速度
|
|
const minVelocity = 500; // 最小滑动速度
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 获取滑动速度(如果可用)
|
|
// 获取滑动速度(如果可用)
|
|
|
const velocity = event?.velocityY || 0;
|
|
const velocity = event?.velocityY || 0;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 判断是否应该关闭:距离足够 或者 速度足够快
|
|
// 判断是否应该关闭:距离足够 或者 速度足够快
|
|
|
const shouldClose = this.translateY > minDistance || velocity > minVelocity;
|
|
const shouldClose = this.translateY > minDistance || velocity > minVelocity;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (shouldClose) {
|
|
if (shouldClose) {
|
|
|
// 添加关闭动画
|
|
// 添加关闭动画
|
|
|
this.getUIContext().animateTo({
|
|
this.getUIContext().animateTo({
|
|
@@ -6580,6 +6585,7 @@ export struct LocalMusic {
|
|
|
@State oldSeconds: number = 0;
|
|
@State oldSeconds: number = 0;
|
|
|
@State isSeekTo: boolean = false;
|
|
@State isSeekTo: boolean = false;
|
|
|
@State isCurrentTime: boolean = false;
|
|
@State isCurrentTime: boolean = false;
|
|
|
|
|
+ @State lastSongPath: string = ""; // 用于检测歌曲切换
|
|
|
@State videoWidth: string = '100%';
|
|
@State videoWidth: string = '100%';
|
|
|
@State videoHeight: string = '100%';
|
|
@State videoHeight: string = '100%';
|
|
|
@State initAspectRatio: number = 1;
|
|
@State initAspectRatio: number = 1;
|
|
@@ -6599,14 +6605,6 @@ export struct LocalMusic {
|
|
|
@State playType: number = 0; //0:连续播放 1:单片重复播放 2:正常播放 3:随机播放
|
|
@State playType: number = 0; //0:连续播放 1:单片重复播放 2:正常播放 3:随机播放
|
|
|
@State multiple: string = '1.0X';
|
|
@State multiple: string = '1.0X';
|
|
|
xcomponentController: XComponentController = new XComponentController()
|
|
xcomponentController: XComponentController = new XComponentController()
|
|
|
- private panOptionBright: PanGestureOptions =
|
|
|
|
|
- new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down });
|
|
|
|
|
- private panOptionVolume: PanGestureOptions =
|
|
|
|
|
- new PanGestureOptions({ direction: PanDirection.Vertical | PanDirection.Up | PanDirection.Down });
|
|
|
|
|
- private panOptionSeekTo: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Horizontal });
|
|
|
|
|
- //手势的音量控制和亮度控制
|
|
|
|
|
- private positionX: number = PlayConstants.POSITION_X;
|
|
|
|
|
- private positionY: number = PlayConstants.POSITION_Y;
|
|
|
|
|
private windowClass: window.Window = globalThis.windowClass
|
|
private windowClass: window.Window = globalThis.windowClass
|
|
|
@State volume: number = 0.3;
|
|
@State volume: number = 0.3;
|
|
|
@State volumeShow: boolean = PlayConstants.VOLUME_SHOW;
|
|
@State volumeShow: boolean = PlayConstants.VOLUME_SHOW;
|
|
@@ -7161,14 +7159,14 @@ export struct LocalMusic {
|
|
|
// return
|
|
// return
|
|
|
// }
|
|
// }
|
|
|
const isPlaying = this.CONTROL_PlayStatus === PlayStatus.PLAY;
|
|
const isPlaying = this.CONTROL_PlayStatus === PlayStatus.PLAY;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步所有播放状态
|
|
// 同步所有播放状态
|
|
|
this.setIsPlaying(isPlaying);
|
|
this.setIsPlaying(isPlaying);
|
|
|
this.animationState = isPlaying ? AnimationStatus.Running : AnimationStatus.Paused;
|
|
this.animationState = isPlaying ? AnimationStatus.Running : AnimationStatus.Paused;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 记录状态变化日志
|
|
// 记录状态变化日志
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: playChange - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}, isPlaying: ${isPlaying}, globalIsPlaying: ${this.isPlaying}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: playChange - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}, isPlaying: ${isPlaying}, globalIsPlaying: ${this.isPlaying}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 强制触发UI刷新 - 这对于@State变量应该是自动的,但我们确保一下
|
|
// 强制触发UI刷新 - 这对于@State变量应该是自动的,但我们确保一下
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: UI refresh triggered - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: UI refresh triggered - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}`);
|
|
@@ -7179,7 +7177,7 @@ export struct LocalMusic {
|
|
|
public forceSyncState(): void {
|
|
public forceSyncState(): void {
|
|
|
const currentState = this.unifiedPlayerService.getCurrentState();
|
|
const currentState = this.unifiedPlayerService.getCurrentState();
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Force sync - UnifiedPlayerService state: isPlaying=${currentState.isPlaying}, isPaused=${currentState.isPaused}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Force sync - UnifiedPlayerService state: isPlaying=${currentState.isPlaying}, isPaused=${currentState.isPaused}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 手动触发状态同步
|
|
// 手动触发状态同步
|
|
|
if (currentState.isPlaying) {
|
|
if (currentState.isPlaying) {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.PLAY;
|
|
this.CONTROL_PlayStatus = PlayStatus.PLAY;
|
|
@@ -7188,10 +7186,10 @@ export struct LocalMusic {
|
|
|
} else {
|
|
} else {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.setIsPlaying(currentState.isPlaying);
|
|
this.setIsPlaying(currentState.isPlaying);
|
|
|
this.playChange();
|
|
this.playChange();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Force sync completed - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Force sync completed - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}`);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -9743,36 +9741,36 @@ export struct LocalMusic {
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.animationState = AnimationStatus.Running
|
|
this.animationState = AnimationStatus.Running
|
|
|
LogUtils.getInstance().LOGI("startPlayOrResumePlay start this.CONTROL_PlayStatus:" + this.CONTROL_PlayStatus)
|
|
LogUtils.getInstance().LOGI("startPlayOrResumePlay start this.CONTROL_PlayStatus:" + this.CONTROL_PlayStatus)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 确保播放列表已同步到UnifiedPlayerService
|
|
// 确保播放列表已同步到UnifiedPlayerService
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 使用UnifiedPlayerService开始播放
|
|
// 使用UnifiedPlayerService开始播放
|
|
|
await this.unifiedPlayerService.startPlayOrResumePlay();
|
|
await this.unifiedPlayerService.startPlayOrResumePlay();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 保持原有的UI更新逻辑
|
|
// 保持原有的UI更新逻辑
|
|
|
this.stopProgressTask();
|
|
this.stopProgressTask();
|
|
|
this.startProgressTask();
|
|
this.startProgressTask();
|
|
|
this.watchStatus();
|
|
this.watchStatus();
|
|
|
this.updateLastPlayTimeStr(this.videoUrl)
|
|
this.updateLastPlayTimeStr(this.videoUrl)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新播放状态
|
|
// 更新播放状态
|
|
|
this.CONTROL_PlayStatus = PlayStatus.PLAY;
|
|
this.CONTROL_PlayStatus = PlayStatus.PLAY;
|
|
|
this.setIsPlaying(true);
|
|
this.setIsPlaying(true);
|
|
|
this.updateSessionPlayState(true);
|
|
this.updateSessionPlayState(true);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI("LocalMusic: startPlayOrResumePlay completed via UnifiedPlayerService");
|
|
LogUtils.getInstance().LOGI("LocalMusic: startPlayOrResumePlay completed via UnifiedPlayerService");
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic startPlayOrResumePlay error: ${error}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic startPlayOrResumePlay error: ${error}`);
|
|
|
ToastUtil.showToast(`播放失败: ${error}`);
|
|
ToastUtil.showToast(`播放失败: ${error}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 错误处理:回退到原有逻辑
|
|
// 错误处理:回退到原有逻辑
|
|
|
this.handlePlaybackError();
|
|
this.handlePlaybackError();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 播放错误处理
|
|
// 播放错误处理
|
|
|
private handlePlaybackError() {
|
|
private handlePlaybackError() {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
@@ -9826,14 +9824,14 @@ export struct LocalMusic {
|
|
|
try {
|
|
try {
|
|
|
// 确保播放列表已同步到UnifiedPlayerService
|
|
// 确保播放列表已同步到UnifiedPlayerService
|
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 使用UnifiedPlayerService播放指定索引的歌曲
|
|
// 使用UnifiedPlayerService播放指定索引的歌曲
|
|
|
await this.unifiedPlayerService.playSongAtIndex(index);
|
|
await this.unifiedPlayerService.playSongAtIndex(index);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新本地状态以保持UI同步
|
|
// 更新本地状态以保持UI同步
|
|
|
const currentIndex = this.unifiedPlayerService.getCurrentIndex();
|
|
const currentIndex = this.unifiedPlayerService.getCurrentIndex();
|
|
|
const currentSong = this.unifiedPlayerService.getCurrentSong();
|
|
const currentSong = this.unifiedPlayerService.getCurrentSong();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (currentSong) {
|
|
if (currentSong) {
|
|
|
this.curIndex = currentIndex;
|
|
this.curIndex = currentIndex;
|
|
|
this.currentSong = currentSong;
|
|
this.currentSong = currentSong;
|
|
@@ -9841,19 +9839,19 @@ export struct LocalMusic {
|
|
|
this.name = currentSong.name;
|
|
this.name = currentSong.name;
|
|
|
this.artist = currentSong.artist;
|
|
this.artist = currentSong.artist;
|
|
|
this.cover = currentSong.pixelMapPath;
|
|
this.cover = currentSong.pixelMapPath;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步到AppStorage
|
|
// 同步到AppStorage
|
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
|
AppStorage.setOrCreate('currentSong', currentSong);
|
|
AppStorage.setOrCreate('currentSong', currentSong);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: playSongAtIndex ${index} completed via UnifiedPlayerService`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: playSongAtIndex ${index} completed via UnifiedPlayerService`);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic playSongAtIndex error: ${error}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic playSongAtIndex error: ${error}`);
|
|
|
ToastUtil.showToast(`播放歌曲失败: ${error}`);
|
|
ToastUtil.showToast(`播放歌曲失败: ${error}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 错误处理:回退到原有逻辑
|
|
// 错误处理:回退到原有逻辑
|
|
|
this.playIndex(index);
|
|
this.playIndex(index);
|
|
|
}
|
|
}
|
|
@@ -9866,10 +9864,10 @@ export struct LocalMusic {
|
|
|
// 记录调用栈信息以便调试
|
|
// 记录调用栈信息以便调试
|
|
|
const stack = new Error().stack || 'No stack available';
|
|
const stack = new Error().stack || 'No stack available';
|
|
|
const caller = stack.split('\n')[2] || 'Unknown caller';
|
|
const caller = stack.split('\n')[2] || 'Unknown caller';
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Playlist synced to UnifiedPlayerService - ${this.songList.length} songs, caller: ${caller.trim()}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Playlist synced to UnifiedPlayerService - ${this.songList.length} songs, caller: ${caller.trim()}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果同步的是小播放列表,记录更多信息
|
|
// 如果同步的是小播放列表,记录更多信息
|
|
|
if (this.songList.length <= 20) {
|
|
if (this.songList.length <= 20) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Small playlist sync detected, current path: ${this.currentPath}, first few songs: ${this.songList.slice(0, 5).map(s => s.name).join(', ')}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Small playlist sync detected, current path: ${this.currentPath}, first few songs: ${this.songList.slice(0, 5).map(s => s.name).join(', ')}`);
|
|
@@ -9887,26 +9885,26 @@ export struct LocalMusic {
|
|
|
try {
|
|
try {
|
|
|
// 使用UnifiedPlayerService移除歌曲
|
|
// 使用UnifiedPlayerService移除歌曲
|
|
|
const removedSong = this.unifiedPlayerService.removeFromPlaylist(index);
|
|
const removedSong = this.unifiedPlayerService.removeFromPlaylist(index);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (removedSong) {
|
|
if (removedSong) {
|
|
|
// 更新本地播放列表
|
|
// 更新本地播放列表
|
|
|
this.songList.splice(index, 1);
|
|
this.songList.splice(index, 1);
|
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 更新当前索引
|
|
// 更新当前索引
|
|
|
this.curIndex = this.unifiedPlayerService.getCurrentIndex();
|
|
this.curIndex = this.unifiedPlayerService.getCurrentIndex();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 同步到AppStorage
|
|
// 同步到AppStorage
|
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
AppStorage.setOrCreate('songList', this.songList);
|
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
AppStorage.setOrCreate('currIndex', this.curIndex);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
ToastUtil.showToast(`已移除 ${removedSong.name}`);
|
|
ToastUtil.showToast(`已移除 ${removedSong.name}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Removed song at index ${index} via UnifiedPlayerService - ${removedSong.name}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic: Removed song at index ${index} via UnifiedPlayerService - ${removedSong.name}`);
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
LogUtils.getInstance().LOGI(`LocalMusic removeFromPlaylistViaService error: ${error}`);
|
|
LogUtils.getInstance().LOGI(`LocalMusic removeFromPlaylistViaService error: ${error}`);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 错误处理:回退到原有逻辑
|
|
// 错误处理:回退到原有逻辑
|
|
|
if (index >= 0 && index < this.songList.length) {
|
|
if (index >= 0 && index < this.songList.length) {
|
|
|
const removedSong = this.songList.splice(index, 1)[0];
|
|
const removedSong = this.songList.splice(index, 1)[0];
|
|
@@ -9919,6 +9917,16 @@ export struct LocalMusic {
|
|
|
// 同步进度更新到UI(从UnifiedPlayerService)
|
|
// 同步进度更新到UI(从UnifiedPlayerService)
|
|
|
private syncProgressFromService(progress: PlayProgress) {
|
|
private syncProgressFromService(progress: PlayProgress) {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ // 检测歌曲是否发生切换(额外保障机制)
|
|
|
|
|
+ const currentSongPath = this.currentSong?.filePath || "";
|
|
|
|
|
+ if (this.lastSongPath !== currentSongPath && currentSongPath !== "") {
|
|
|
|
|
+ console.log(`Heanup 在进度更新中检测到歌曲切换: ${this.lastSongPath} -> ${currentSongPath}`);
|
|
|
|
|
+ console.log(`Heanup 歌曲切换前 oldSeconds: ${this.oldSeconds}`);
|
|
|
|
|
+ this.oldSeconds = 0;
|
|
|
|
|
+ this.lastSongPath = currentSongPath;
|
|
|
|
|
+ console.log(`Heanup 歌曲切换后 oldSeconds: ${this.oldSeconds}`);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 更新进度条
|
|
// 更新进度条
|
|
|
if (progress.duration > 0) {
|
|
if (progress.duration > 0) {
|
|
|
this.slideEnable = true;
|
|
this.slideEnable = true;
|
|
@@ -9936,10 +9944,12 @@ export struct LocalMusic {
|
|
|
if (progress.currentPosition > progress.duration) {
|
|
if (progress.currentPosition > progress.duration) {
|
|
|
progress.currentPosition = progress.duration;
|
|
progress.currentPosition = progress.duration;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ console.log(`Heanup 当前时间 - ${progress.currentPosition} / ${progress.duration}`)
|
|
|
|
|
+ console.log(`Heanup 更新前 - oldSeconds: ${this.oldSeconds}, currentTime: ${this.currentTime}`)
|
|
|
this.isCurrentTime = true;
|
|
this.isCurrentTime = true;
|
|
|
this.currentTime = this.stringForTime(progress.currentPosition);
|
|
this.currentTime = this.stringForTime(progress.currentPosition);
|
|
|
this.isCurrentTime = false;
|
|
this.isCurrentTime = false;
|
|
|
|
|
+ console.log(`Heanup 更新后 - oldSeconds: ${this.oldSeconds}, currentTime: ${this.currentTime}`)
|
|
|
|
|
|
|
|
// 更新歌词位置
|
|
// 更新歌词位置
|
|
|
const lyricPosition = progress.currentPosition + this.timeOffset * 1000;
|
|
const lyricPosition = progress.currentPosition + this.timeOffset * 1000;
|
|
@@ -10856,13 +10866,12 @@ export struct LocalMusic {
|
|
|
}, () => {
|
|
}, () => {
|
|
|
this.opacityValueImage = 1;
|
|
this.opacityValueImage = 1;
|
|
|
this.scaleValueImage = 1 // 图标恢复到原始大小
|
|
this.scaleValueImage = 1 // 图标恢复到原始大小
|
|
|
- this.startPlayOrResumePlay()
|
|
|
|
|
|
|
+ // 注意:不再手动调用 startPlayOrResumePlay(),因为 UnifiedPlayerService 已经处理了播放逻辑
|
|
|
});
|
|
});
|
|
|
}, 500);
|
|
}, 500);
|
|
|
}else{
|
|
}else{
|
|
|
this.cover = this.songList[this.curIndex].pixelMapPath
|
|
this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
- this.startPlayOrResumePlay()
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 注意:不再手动调用 startPlayOrResumePlay(),因为 UnifiedPlayerService 已经处理了播放逻辑
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|