|
|
@@ -454,13 +454,13 @@ export struct LocalMusic {
|
|
|
this.cover = this.currentSong.pixelMapPath;
|
|
|
}
|
|
|
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Restored playlist from UnifiedPlayerService - ${this.songList.length} songs, index ${this.curIndex}, current song: ${this.currentSong?.name || 'null'}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Restored playlist from UnifiedPlayerService - ${this.songList.length} songs, index ${this.curIndex}, current song: ${this.currentSong?.name || 'null'}`);
|
|
|
} else {
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: No playlist restored from UnifiedPlayerService, songList length = ' + this.songList.length);
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
// 如果LocalMusic有播放列表但UnifiedPlayerService没有,设置到服务中
|
|
|
this.unifiedPlayerService.setPlaylist(this.songList, this.curIndex);
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Set existing playlist to UnifiedPlayerService - ${this.songList.length} songs`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Set existing playlist to UnifiedPlayerService - ${this.songList.length} songs`);
|
|
|
}
|
|
|
}
|
|
|
// 不设置LocalMusic自己的AVSession监听器,完全依赖UnifiedPlayerService
|
|
|
@@ -472,9 +472,9 @@ export struct LocalMusic {
|
|
|
try {
|
|
|
const currentState = this.unifiedPlayerService.getCurrentState();
|
|
|
const actuallyPlaying = this.unifiedPlayerService.getActualPlayingState();
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Syncing current state - StateModel: ${currentState.isPlaying}, ActualPlayer: ${actuallyPlaying}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Syncing current state - StateModel: ${currentState.isPlaying}, ActualPlayer: ${actuallyPlaying}`);
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Failed to sync current state: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Failed to sync current state: ${error}`);
|
|
|
}
|
|
|
}, 200); // 短延迟,确保组件完全初始化
|
|
|
|
|
|
@@ -488,7 +488,7 @@ export struct LocalMusic {
|
|
|
// 初始化完成后,开始加载本地文件
|
|
|
this.loadLocalFilesAfterServiceInit();
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Failed to initialize UnifiedPlayerService: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Failed to initialize UnifiedPlayerService: ${error}`);
|
|
|
ToastUtil.showToast('播放器服务初始化失败');
|
|
|
|
|
|
// 即使服务初始化失败,也要加载本地文件
|
|
|
@@ -514,7 +514,7 @@ export struct LocalMusic {
|
|
|
this.songList = unifiedPlaylist;
|
|
|
this.curIndex = unifiedIndex;
|
|
|
this.currentSong = unifiedSong || undefined;
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Using playlist from UnifiedPlayerService - ${this.songList.length} songs, index ${this.curIndex}, current song: ${this.currentSong?.name || 'null'}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Using playlist from UnifiedPlayerService - ${this.songList.length} songs, index ${this.curIndex}, current song: ${this.currentSong?.name || 'null'}`);
|
|
|
} else {
|
|
|
// 回退到旧的存储方式
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: UnifiedPlayerService playlist empty, falling back to legacy storage');
|
|
|
@@ -522,13 +522,13 @@ export struct LocalMusic {
|
|
|
this.currentSong = PreferencesUtil.getSync('LastMusicInfo', undefined) as VideoItem
|
|
|
if (ArrayUtil.isEmpty(this.songList)) {
|
|
|
const currentFileList = this.getCurFileList();
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: No legacy playlist found, current directory has ${currentFileList.length} songs`);
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Current path: ${this.currentPath}, Root path: ${this.rootPath}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: No legacy playlist found, current directory has ${currentFileList.length} songs`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Current path: ${this.currentPath}, Root path: ${this.rootPath}`);
|
|
|
this.songList = currentFileList;
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Using current file list as fallback - ${this.songList.length} songs`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Using current file list as fallback - ${this.songList.length} songs`);
|
|
|
} else {
|
|
|
this.curIndex = Utility.getIndexFromList(this.songList, this.currentSong.filePath)
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Using legacy playlist storage - ${this.songList.length} songs, index ${this.curIndex}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Using legacy playlist storage - ${this.songList.length} songs, index ${this.curIndex}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -555,7 +555,7 @@ export struct LocalMusic {
|
|
|
*/
|
|
|
public onPlayerStateChanged(state: PlayerState): void {
|
|
|
try {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Received state change from UnifiedPlayerService - isPlaying: ${state.isPlaying}, isPaused: ${state.isPaused}, currentIndex: ${state.currentIndex}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Received state change from UnifiedPlayerService - isPlaying: ${state.isPlaying}, isPaused: ${state.isPaused}, currentIndex: ${state.currentIndex}, speed: ${state.speed}`);
|
|
|
|
|
|
// 同步播放状态到UI
|
|
|
if (state.isPlaying !== undefined) {
|
|
|
@@ -584,7 +584,7 @@ export struct LocalMusic {
|
|
|
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: UI state synchronized with UnifiedPlayerService');
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Error handling state change: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Error handling state change: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -594,7 +594,7 @@ export struct LocalMusic {
|
|
|
*/
|
|
|
public onPlayerSongChanged(song: VideoItem): void {
|
|
|
try {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Received song change from UnifiedPlayerService - ${song.name}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Received song change from UnifiedPlayerService - ${song.name}`);
|
|
|
|
|
|
// 同步当前歌曲信息到UI
|
|
|
this.currentSong = song;
|
|
|
@@ -618,7 +618,7 @@ export struct LocalMusic {
|
|
|
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: UI song info synchronized with UnifiedPlayerService');
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Error handling song change: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Error handling song change: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -628,7 +628,7 @@ export struct LocalMusic {
|
|
|
*/
|
|
|
public onPlayerError(error: PlayerError): void {
|
|
|
try {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Received error from UnifiedPlayerService - ${error.type}: ${error.message}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Received error from UnifiedPlayerService - ${error.type}: ${error.message}`);
|
|
|
|
|
|
// 根据错误类型显示不同的提示
|
|
|
switch (error.type) {
|
|
|
@@ -648,7 +648,7 @@ export struct LocalMusic {
|
|
|
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: Error handled and user notified');
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Error handling player error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Error handling player error: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -677,10 +677,10 @@ export struct LocalMusic {
|
|
|
// 刷新UnifiedPlayerService的收藏状态,这会自动更新AVSession
|
|
|
// await this.unifiedPlayerService.refreshFavoriteStatus();
|
|
|
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: 收藏状态已同步 - ${this.currentSong.name}: ${isFavorite ? '已收藏' : '未收藏'}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: 收藏状态已同步 - ${this.currentSong.name}: ${isFavorite ? '已收藏' : '未收藏'}`);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: 同步收藏状态失败: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: 同步收藏状态失败: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1105,7 +1105,7 @@ export struct LocalMusic {
|
|
|
} else if (this.currentSong === undefined && this.curIndex >= 0 && this.curIndex < this.songList.length) {
|
|
|
// 如果有有效索引但没有当前歌曲,从索引恢复
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: mkDownLoadDir - Restored current song from index ${this.curIndex}: ${this.currentSong.name}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: mkDownLoadDir - Restored current song from index ${this.curIndex}: ${this.currentSong.name}`);
|
|
|
}
|
|
|
|
|
|
if (this.currentSong) {
|
|
|
@@ -1115,7 +1115,7 @@ export struct LocalMusic {
|
|
|
AppStorage.setOrCreate('currentSong',this.currentSong);
|
|
|
}
|
|
|
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: mkDownLoadDir - UI updated with existing playlist: ${this.songList.length} songs, current index: ${this.curIndex}, current song: ${this.currentSong?.name || 'none'}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: mkDownLoadDir - UI updated with existing playlist: ${this.songList.length} songs, current index: ${this.curIndex}, current song: ${this.currentSong?.name || 'none'}`);
|
|
|
} else {
|
|
|
this.name = '空空如也'
|
|
|
LogUtils.getInstance().LOGI('LocalMusic: mkDownLoadDir - No playlist available, showing empty state');
|
|
|
@@ -1533,18 +1533,18 @@ export struct LocalMusic {
|
|
|
// 更新播放列表中的封面信息
|
|
|
this.songList[index].pixelMapPath = matchedSong.pixelMapPath;
|
|
|
hasUpdates = true;
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Updated cover for ${song.name}: ${matchedSong.pixelMapPath}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Updated cover for ${song.name}: ${matchedSong.pixelMapPath}`);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 如果有更新,刷新UI数据源
|
|
|
if (hasUpdates) {
|
|
|
this.sonDataSource.pushArrayData(this.songList);
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Refreshed covers for playlist with ${this.songList.length} songs`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Refreshed covers for playlist with ${this.songList.length} songs`);
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Error refreshing playlist covers: ${error.message}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Error refreshing playlist covers: ${error.message}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -7795,11 +7795,11 @@ export struct LocalMusic {
|
|
|
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(`Heanup LocalMusic: playChange - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}, isPlaying: ${isPlaying}, globalIsPlaying: ${this.isPlaying}`);
|
|
|
|
|
|
// 强制触发UI刷新 - 这对于@State变量应该是自动的,但我们确保一下
|
|
|
setTimeout(() => {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: UI refresh triggered - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: UI refresh triggered - CONTROL_PlayStatus: ${this.CONTROL_PlayStatus}`);
|
|
|
}, 50);
|
|
|
}
|
|
|
|
|
|
@@ -10845,7 +10845,7 @@ export struct LocalMusic {
|
|
|
|
|
|
LogUtils.getInstance().LOGI("LocalMusic: startPlayOrResumePlay completed via UnifiedPlayerService");
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic startPlayOrResumePlay error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic startPlayOrResumePlay error: ${error}`);
|
|
|
ToastUtil.showToast(`播放失败: ${error}`);
|
|
|
|
|
|
// 错误处理:回退到原有逻辑
|
|
|
@@ -10896,7 +10896,7 @@ export struct LocalMusic {
|
|
|
|
|
|
LogUtils.getInstance().LOGI("LocalMusic: playSpecificSong completed via UnifiedPlayerService");
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic playSpecificSong error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic playSpecificSong error: ${error}`);
|
|
|
ToastUtil.showToast(`播放失败: ${error}`);
|
|
|
this.handlePlaybackError();
|
|
|
}
|
|
|
@@ -10908,9 +10908,9 @@ export struct LocalMusic {
|
|
|
this.unifiedPlayerService.setVolume(volume);
|
|
|
this.volume = volume;
|
|
|
PreferencesUtil.putSync('DefalutVolume', volume);
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Volume set to ${volume} via UnifiedPlayerService`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Volume set to ${volume} via UnifiedPlayerService`);
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic setVolume error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic setVolume error: ${error}`);
|
|
|
ToastUtil.showToast(`设置音量失败: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
@@ -10920,9 +10920,9 @@ export struct LocalMusic {
|
|
|
try {
|
|
|
this.unifiedPlayerService.setPlaybackSpeed(speed);
|
|
|
this.playSpeed = speed;
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Playback speed set to ${speed} via UnifiedPlayerService`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Playback speed set to ${speed} via UnifiedPlayerService`);
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic setPlaybackSpeed error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic setPlaybackSpeed error: ${error}`);
|
|
|
ToastUtil.showToast(`设置播放速度失败: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
@@ -10933,9 +10933,9 @@ export struct LocalMusic {
|
|
|
this.unifiedPlayerService.setPlayMode(mode);
|
|
|
this.playType = mode;
|
|
|
PreferencesUtil.putSync('musicPlayType', mode);
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: Play mode set to ${mode} via UnifiedPlayerService`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: Play mode set to ${mode} via UnifiedPlayerService`);
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic setPlayMode error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic setPlayMode error: ${error}`);
|
|
|
// 回退到原有逻辑
|
|
|
this.playType = mode;
|
|
|
PreferencesUtil.putSync('musicPlayType', mode);
|
|
|
@@ -10981,7 +10981,7 @@ export struct LocalMusic {
|
|
|
// 直接调用统一服务的方法
|
|
|
this.unifiedPlayerService.syncPlaylistToService(this.songList, this.curIndex, this.playType);
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic syncPlaylistToService (deprecated) error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic syncPlaylistToService (deprecated) error: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -11200,7 +11200,7 @@ export struct LocalMusic {
|
|
|
// // 节流广播进度更新到卡片
|
|
|
// this.broadcastProgressIfNeeded();
|
|
|
// } catch (error) {
|
|
|
- // LogUtils.getInstance().LOGI(`LocalMusic setProgress error: ${error}`);
|
|
|
+ // LogUtils.getInstance().LOGI(`Heanup LocalMusic setProgress error: ${error}`);
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
@@ -12109,7 +12109,7 @@ export struct LocalMusic {
|
|
|
//
|
|
|
// LogUtils.getInstance().LOGI("LocalMusic: pause completed via UnifiedPlayerService");
|
|
|
// } catch (error) {
|
|
|
- // LogUtils.getInstance().LOGI(`LocalMusic pause error: ${error}`);
|
|
|
+ // LogUtils.getInstance().LOGI(`Heanup LocalMusic pause error: ${error}`);
|
|
|
// ToastUtil.showToast(`暂停失败: ${error}`);
|
|
|
// }
|
|
|
}
|
|
|
@@ -12130,7 +12130,7 @@ export struct LocalMusic {
|
|
|
|
|
|
LogUtils.getInstance().LOGI("LocalMusic: stop completed - all states cleared to INIT");
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic stop error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic stop error: ${error}`);
|
|
|
ToastUtil.showToast(`停止播放失败: ${error}`);
|
|
|
}
|
|
|
}
|
|
|
@@ -12160,9 +12160,9 @@ export struct LocalMusic {
|
|
|
// 保持原有的UI更新逻辑
|
|
|
this.setProgress()
|
|
|
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic: seekTo ${value} completed via UnifiedPlayerService`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic: seekTo ${value} completed via UnifiedPlayerService`);
|
|
|
} catch (error) {
|
|
|
- LogUtils.getInstance().LOGI(`LocalMusic seekTo error: ${error}`);
|
|
|
+ LogUtils.getInstance().LOGI(`Heanup LocalMusic seekTo error: ${error}`);
|
|
|
|
|
|
// 如果是WMA格式错误,显示特定提示
|
|
|
if (error.toString().includes('WMA format')) {
|