|
@@ -12718,7 +12718,10 @@ export struct LocalMusic {
|
|
|
that.stop();
|
|
that.stop();
|
|
|
// ToastUtil.showToast('开始重新播放')
|
|
// ToastUtil.showToast('开始重新播放')
|
|
|
} else if (this.playType == 3) { //3:随机播放
|
|
} else if (this.playType == 3) { //3:随机播放
|
|
|
- this.randomPlay()
|
|
|
|
|
|
|
+ // 异步调用randomPlay
|
|
|
|
|
+ this.randomPlay().catch(() => {
|
|
|
|
|
+ Logger.error('heanup OnCompletionListener randomPlay', `随机播放失败`);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -13463,7 +13466,7 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (this.playType == 3) { //3:随机播放
|
|
if (this.playType == 3) { //3:随机播放
|
|
|
- this.randomPlay()
|
|
|
|
|
|
|
+ await this.randomPlay()
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
@@ -13475,18 +13478,9 @@ export struct LocalMusic {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
this.stop();
|
|
this.stop();
|
|
|
|
|
|
|
|
- // 参考歌单详情页的方式,从数据库重新查询完整的歌曲信息
|
|
|
|
|
- const songFilePath = this.songList[this.curIndex].filePath;
|
|
|
|
|
- const freshSong = await this.table.queryVideoByFilePath(songFilePath);
|
|
|
|
|
-
|
|
|
|
|
- if (freshSong) {
|
|
|
|
|
- this.currentSong = freshSong;
|
|
|
|
|
- Logger.info('heanup playNext', `重新查询歌曲信息: ${freshSong.name}, type: ${freshSong.type}`);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果查询失败,使用原有的对象
|
|
|
|
|
- this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
- Logger.warn('heanup playNext', `重新查询歌曲失败,使用原有对象: ${songFilePath}`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 直接使用歌曲列表中的歌曲信息,songList中的数据已经是完整的
|
|
|
|
|
+ this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
+ Logger.info('heanup playNext', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过VideoItem本身的数据构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过VideoItem本身的数据构建完整URL
|
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
@@ -13552,7 +13546,7 @@ export struct LocalMusic {
|
|
|
private playedIndices: Set<number> = new Set();
|
|
private playedIndices: Set<number> = new Set();
|
|
|
|
|
|
|
|
//随机播放
|
|
//随机播放
|
|
|
- private randomPlay() {
|
|
|
|
|
|
|
+ private async randomPlay() {
|
|
|
// if (!this.debounce()) {
|
|
// if (!this.debounce()) {
|
|
|
// return;
|
|
// return;
|
|
|
// }
|
|
// }
|
|
@@ -13593,8 +13587,21 @@ export struct LocalMusic {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
this.stop();
|
|
this.stop();
|
|
|
this.currentSong = this.songList[this.curIndex];
|
|
this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
+
|
|
|
|
|
+ // 设置videoUrl,WebDAV歌曲需要构建完整的URL
|
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
|
- this.videoUrl = this.currentSong.filePath.replace(/ /g, '%20');
|
|
|
|
|
|
|
+ if (this.currentSong.webdav_account_id) {
|
|
|
|
|
+ // 如果有webdav_account_id,优先使用remote_rel_path,否则使用filePath
|
|
|
|
|
+ const relativePath = this.currentSong.remote_rel_path || this.currentSong.filePath;
|
|
|
|
|
+ this.videoUrl = await WebDavUrlUtil.buildFullUrlByAccountId(
|
|
|
|
|
+ this.currentSong.webdav_account_id,
|
|
|
|
|
+ relativePath
|
|
|
|
|
+ );
|
|
|
|
|
+ Logger.info('heanup randomPlay', `构建WebDAV URL: ${this.videoUrl}`);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Logger.warn('heanup randomPlay', `缺少webdav_account_id,使用filePath`);
|
|
|
|
|
+ this.videoUrl = this.currentSong.filePath.replace(/ /g, '%20');
|
|
|
|
|
+ }
|
|
|
}else{
|
|
}else{
|
|
|
this.videoUrl = this.currentSong.filePath
|
|
this.videoUrl = this.currentSong.filePath
|
|
|
}
|
|
}
|
|
@@ -13646,18 +13653,9 @@ export struct LocalMusic {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
this.stop();
|
|
this.stop();
|
|
|
|
|
|
|
|
- // 参考歌单详情页的方式,从数据库重新查询完整的歌曲信息
|
|
|
|
|
- const songFilePath = this.songList[this.curIndex].filePath;
|
|
|
|
|
- const freshSong = await this.table.queryVideoByFilePath(songFilePath);
|
|
|
|
|
-
|
|
|
|
|
- if (freshSong) {
|
|
|
|
|
- this.currentSong = freshSong;
|
|
|
|
|
- Logger.info('heanup playPrevious', `重新查询歌曲信息: ${freshSong.name}, type: ${freshSong.type}`);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果查询失败,使用原有的对象
|
|
|
|
|
- this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
- Logger.warn('heanup playPrevious', `重新查询歌曲失败,使用原有对象: ${songFilePath}`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 直接使用歌曲列表中的歌曲信息,songList中的数据已经是完整的
|
|
|
|
|
+ this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
+ Logger.info('heanup playPrevious', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl,WebDAV歌曲会通过VideoItem本身的数据构建完整URL
|
|
// 设置videoUrl,WebDAV歌曲会通过VideoItem本身的数据构建完整URL
|
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
@@ -13690,18 +13688,9 @@ export struct LocalMusic {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
this.stop();
|
|
this.stop();
|
|
|
|
|
|
|
|
- // 参考歌单详情页的方式,从数据库重新查询完整的歌曲信息
|
|
|
|
|
- const songFilePath = prevSong.filePath;
|
|
|
|
|
- const freshSong = await this.table.queryVideoByFilePath(songFilePath);
|
|
|
|
|
-
|
|
|
|
|
- if (freshSong) {
|
|
|
|
|
- this.currentSong = freshSong;
|
|
|
|
|
- Logger.info('heanup randomModePlayFromHistory', `重新查询歌曲信息: ${freshSong.name}, type: ${freshSong.type}`);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果查询失败,使用原有的对象
|
|
|
|
|
- this.currentSong = prevSong;
|
|
|
|
|
- Logger.warn('heanup randomModePlayFromHistory', `重新查询歌曲失败,使用原有对象: ${songFilePath}`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 直接使用历史记录中的歌曲信息,历史记录中的数据应该是完整的
|
|
|
|
|
+ this.currentSong = prevSong;
|
|
|
|
|
+ Logger.info('heanup randomModePlayFromHistory', `直接使用历史歌曲信息: ${prevSong.name}, type: ${prevSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl
|
|
// 设置videoUrl
|
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
@@ -13735,18 +13724,9 @@ export struct LocalMusic {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
this.stop();
|
|
this.stop();
|
|
|
|
|
|
|
|
- // 参考歌单详情页的方式,从数据库重新查询完整的歌曲信息
|
|
|
|
|
- const songFilePath = this.songList[this.curIndex].filePath;
|
|
|
|
|
- const freshSong = await this.table.queryVideoByFilePath(songFilePath);
|
|
|
|
|
-
|
|
|
|
|
- if (freshSong) {
|
|
|
|
|
- this.currentSong = freshSong;
|
|
|
|
|
- Logger.info('heanup randomModePlayFromHistory', `重新查询歌曲信息: ${freshSong.name}, type: ${freshSong.type}`);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果查询失败,使用原有的对象
|
|
|
|
|
- this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
- Logger.warn('heanup randomModePlayFromHistory', `重新查询歌曲失败,使用原有对象: ${songFilePath}`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 直接使用歌曲列表中的歌曲信息,songList中的数据已经是完整的
|
|
|
|
|
+ this.currentSong = this.songList[this.curIndex];
|
|
|
|
|
+ Logger.info('heanup randomModePlayFromHistory', `直接使用歌曲列表中的信息: ${this.currentSong.name}, type: ${this.currentSong.type}`);
|
|
|
|
|
|
|
|
// 设置videoUrl
|
|
// 设置videoUrl
|
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|
|
if(this.currentSong.type==CommonConstants.TYPE_WEBDAV){
|