|
@@ -2,6 +2,7 @@ import TitleBar from './TitleBar'
|
|
|
import { Animator,
|
|
import { Animator,
|
|
|
BuilderNode,
|
|
BuilderNode,
|
|
|
curves, display,
|
|
curves, display,
|
|
|
|
|
+ EditableLeftIconType,
|
|
|
NodeController,
|
|
NodeController,
|
|
|
PiPWindow,
|
|
PiPWindow,
|
|
|
PromptAction, promptAction, router, SymbolGlyphModifier, window } from '@kit.ArkUI';
|
|
PromptAction, promptAction, router, SymbolGlyphModifier, window } from '@kit.ArkUI';
|
|
@@ -180,6 +181,8 @@ export struct LocalMusic {
|
|
|
@State isGridMusic: boolean = false //是否网格布局
|
|
@State isGridMusic: boolean = false //是否网格布局
|
|
|
@State isScrollHide: boolean = false //是否滚动隐藏
|
|
@State isScrollHide: boolean = false //是否滚动隐藏
|
|
|
@State isSameTimePlay: boolean = false //是否和其他app同时播放
|
|
@State isSameTimePlay: boolean = false //是否和其他app同时播放
|
|
|
|
|
+ @State isStartAutoPlay: boolean = false //启动后自动播放
|
|
|
|
|
+ @State isMemoryLastPlay: boolean = false //是否启用应用退出记忆最后一首的播放进度
|
|
|
@State customizeBgPath: string | undefined = '';
|
|
@State customizeBgPath: string | undefined = '';
|
|
|
@State isDarkMode: boolean = false
|
|
@State isDarkMode: boolean = false
|
|
|
@State lyricTextWeight: number = 400
|
|
@State lyricTextWeight: number = 400
|
|
@@ -511,6 +514,8 @@ export struct LocalMusic {
|
|
|
this.isSavePlayMode = PreferencesUtil.getBooleanSync(SettingPage.iS_SAVE_PLAY_MODE, true)
|
|
this.isSavePlayMode = PreferencesUtil.getBooleanSync(SettingPage.iS_SAVE_PLAY_MODE, true)
|
|
|
this.blurValue = PreferencesUtil.getNumberSync(SettingPage.CUSTOMIZE_BG_BLUR, 0)
|
|
this.blurValue = PreferencesUtil.getNumberSync(SettingPage.CUSTOMIZE_BG_BLUR, 0)
|
|
|
this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
|
|
this.bgBrightness = PreferencesUtil.getNumberSync(SettingPage.BG_BRIGHTNESS, 0)
|
|
|
|
|
+ this.isStartAutoPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_START_AUTO_PLAY, false)
|
|
|
|
|
+ this.isMemoryLastPlay = PreferencesUtil.getBooleanSync(SettingPage.iS_MEMORY_LAST_PLAY, false)
|
|
|
if (this.isSavePlayMode) {
|
|
if (this.isSavePlayMode) {
|
|
|
this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
|
|
this.playType = PreferencesUtil.getNumberSync('musicPlayType', 0)
|
|
|
}
|
|
}
|
|
@@ -607,7 +612,7 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ @State isFirstStartPlay:boolean = false
|
|
|
//获取download_path
|
|
//获取download_path
|
|
|
async mkDownLoadDir() {
|
|
async mkDownLoadDir() {
|
|
|
|
|
|
|
@@ -645,14 +650,18 @@ export struct LocalMusic {
|
|
|
this.curIndex = Utility.getIndexFromList(this.songList, this.currentSong.filePath)
|
|
this.curIndex = Utility.getIndexFromList(this.songList, this.currentSong.filePath)
|
|
|
}
|
|
}
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
+ this.isFirstStartPlay = true
|
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
this.sonDataSource.pushArrayData(this.songList)
|
|
|
if (this.currentSong === undefined) {
|
|
if (this.currentSong === undefined) {
|
|
|
-
|
|
|
|
|
|
|
+ this.isFirstStartPlay = false
|
|
|
this.currentSong = this.songList[0]
|
|
this.currentSong = this.songList[0]
|
|
|
}
|
|
}
|
|
|
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
|
|
|
|
|
+ if(this.isStartAutoPlay){
|
|
|
|
|
+ this.startPlayOrResumePlay()
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
this.name = '空空如也'
|
|
this.name = '空空如也'
|
|
@@ -6812,7 +6821,7 @@ export struct LocalMusic {
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
|
//判断是不是赞助会员
|
|
//判断是不是赞助会员
|
|
|
- if(PreferencesUtil.getStringSync('COVER_API','')===''){
|
|
|
|
|
|
|
+ if(PreferencesUtil.getStringSync('LRC_API','')===''){
|
|
|
this.isLyricSetting = false
|
|
this.isLyricSetting = false
|
|
|
this.showTipsDialog()
|
|
this.showTipsDialog()
|
|
|
return
|
|
return
|
|
@@ -8115,16 +8124,27 @@ export struct LocalMusic {
|
|
|
} else {
|
|
} else {
|
|
|
this.jumpTopTime = 0
|
|
this.jumpTopTime = 0
|
|
|
this.jumpEndTime = 0
|
|
this.jumpEndTime = 0
|
|
|
- //记忆播放
|
|
|
|
|
|
|
+ console.error('onecold 最后一首: isFirstStartPlay = ' + this.isFirstStartPlay);
|
|
|
|
|
+ console.error('onecold 最后一首: isMemoryLastPlay = ' + this.isMemoryLastPlay);
|
|
|
|
|
+ console.error('onecold 最后一首: PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false) = ' + PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false));
|
|
|
|
|
+
|
|
|
|
|
+ //记忆播放(每一首都会记忆播放)
|
|
|
if (StrUtil.isNotEmpty(this.videoUrl) && !this.videoUrl.toLowerCase().endsWith('.ts')) {
|
|
if (StrUtil.isNotEmpty(this.videoUrl) && !this.videoUrl.toLowerCase().endsWith('.ts')) {
|
|
|
setTimeout(() => { //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
|
|
setTimeout(() => { //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
|
|
|
if (PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false)) {
|
|
if (PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_MEMORY_PLAY, false)) {
|
|
|
this.restorePlaybackPosition() //读取播放记忆功能
|
|
this.restorePlaybackPosition() //读取播放记忆功能
|
|
|
|
|
+ }else if(this.isMemoryLastPlay&&this.isFirstStartPlay){
|
|
|
|
|
+ console.error('onecold 最后一首:读取播放记忆功能 = ' + this.isFirstStartPlay);
|
|
|
|
|
+ this.restorePlaybackPosition() //读取播放记忆功能
|
|
|
}
|
|
}
|
|
|
|
|
+ this.isFirstStartPlay = false
|
|
|
|
|
|
|
|
}, timeoutPlay)
|
|
}, timeoutPlay)
|
|
|
|
|
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.isFirstStartPlay = false
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -8252,7 +8272,6 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
//保存最后播放的那首歌和已经对应的播放列表
|
|
//保存最后播放的那首歌和已经对应的播放列表
|
|
|
saveLastPlayList() {
|
|
saveLastPlayList() {
|
|
|
-
|
|
|
|
|
PreferencesUtil.putSync('LastMusicInfo', this.currentSong)
|
|
PreferencesUtil.putSync('LastMusicInfo', this.currentSong)
|
|
|
PreferencesUtil.putSync('LastMusicList', this.songList)
|
|
PreferencesUtil.putSync('LastMusicList', this.songList)
|
|
|
|
|
|