|
|
@@ -5107,11 +5107,8 @@ export struct LocalMusic {
|
|
|
return
|
|
|
break;
|
|
|
case CommonConstants.TYPE_LOCAL:
|
|
|
- if (this.CONTROL_PlayStatus !== PlayStatus.INIT) {
|
|
|
- this.stop();
|
|
|
- }
|
|
|
if(item&&item.filePath.toLowerCase().endsWith('.cue')){
|
|
|
- const cueinfo:CueInfo = await parseCueFile(item.filePath,Number(item.duration))
|
|
|
+ const cueinfo:CueInfo = await parseCueFile(item.filePath,Number(item.duration))
|
|
|
const cueTracks:CueTrack[] = cueinfo.tracks
|
|
|
console.log('onecold cue cueTracks =', JSON.stringify(cueTracks));
|
|
|
if(ArrayUtil.isNotEmpty(cueTracks)){
|
|
|
@@ -5120,6 +5117,9 @@ export struct LocalMusic {
|
|
|
// this.showCueSheet = !this.showCueSheet
|
|
|
return
|
|
|
}
|
|
|
+ if (this.CONTROL_PlayStatus !== PlayStatus.INIT) {
|
|
|
+ this.stop();
|
|
|
+ }
|
|
|
|
|
|
if (isOpen) {
|
|
|
this.currentSong = item
|
|
|
@@ -5193,7 +5193,28 @@ export struct LocalMusic {
|
|
|
onCancel:()=>{
|
|
|
this.getUIContext().getPromptAction().closeCustomDialog(this.cueComponentId)
|
|
|
},
|
|
|
- onDeleteResult:(result: boolean)=>{
|
|
|
+ onDoItemClick:(item: CueTrack, index: number)=>{
|
|
|
+ //获取cueinfo对应的filePath
|
|
|
+ let globalVideoList = Utility.getGlobalList(this.videoLocalList, CommonConstants.TYPE_LOCAL) as VideoItem[];
|
|
|
+ this.curIndex = Utility.getCurIndexFromGlobalList(globalVideoList, cueinfo.filePath)
|
|
|
+ this.currentSong = Utility.getItemByFilePath(globalVideoList, cueinfo.filePath)
|
|
|
+ console.info('onecold cueinfo.filePath=', cueinfo.filePath)
|
|
|
+ console.info('onecold this.currentSong =', JSON.stringify(this.currentSong))
|
|
|
+ if (this.currentSong){
|
|
|
+ if (this.CONTROL_PlayStatus !== PlayStatus.INIT) {
|
|
|
+ this.stop();//播放之前先停止之前播放。
|
|
|
+ }
|
|
|
+ this.songList = globalVideoList
|
|
|
+ this.sonDataSource.pushArrayData(this.songList)
|
|
|
+ this.videoUrl = this.currentSong.filePath
|
|
|
+ this.name = item.title||this.currentSong.name
|
|
|
+ this.cover = this.currentSong.pixelMapPath
|
|
|
+ this.artist = item.performer||this.currentSong.artist
|
|
|
+ this.currentSong.name = this.name
|
|
|
+ this.currentSong.artist = this.artist
|
|
|
+ AppStorage.setOrCreate('currentSong',this.currentSong) ;
|
|
|
+ this.startPlayOrResumePlay(item.startOffset)//从cue的某个位置开始播放
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -11058,7 +11079,8 @@ export struct LocalMusic {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private startPlayOrResumePlay() {
|
|
|
+ //startOffset 从cue分轨时间开始播
|
|
|
+ private startPlayOrResumePlay(startOffset?:number) {
|
|
|
//针对dsf文件高采样率sampleRate>441000,统一转wav播放
|
|
|
const sampleRate = this.currentSong?.sampleRate||0
|
|
|
if(this.videoUrl.toLowerCase().endsWith('.dsf')&&sampleRate>=441000){
|
|
|
@@ -11069,23 +11091,23 @@ export struct LocalMusic {
|
|
|
const task = new taskpool.Task(convertDsfToWav,this.videoUrl,newDsfPath);
|
|
|
taskpool.execute(task, taskpool.Priority.HIGH).then((data)=>{
|
|
|
this.videoUrl = newDsfPath
|
|
|
- this.startPlay()
|
|
|
+ this.startPlay(startOffset)
|
|
|
}).catch((e:object)=>{
|
|
|
console.info("task1 catch e: " + e);
|
|
|
})
|
|
|
}else{
|
|
|
this.videoUrl = newDsfPath
|
|
|
- this.startPlay()
|
|
|
+ this.startPlay(startOffset)
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
- this.startPlay()
|
|
|
+ this.startPlay(startOffset)
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- startPlay() {
|
|
|
+ startPlay(startOffset?:number) {
|
|
|
this.startPipLyric()
|
|
|
this.mDestroyPage = false;
|
|
|
this.animationState = AnimationStatus.Running
|
|
|
@@ -11093,7 +11115,7 @@ export struct LocalMusic {
|
|
|
if (this.CONTROL_PlayStatus == PlayStatus.INIT) {
|
|
|
this.stopProgressTask();
|
|
|
this.startProgressTask();
|
|
|
- this.play(this.videoUrl.toString());
|
|
|
+ this.play(this.videoUrl.toString(),startOffset);
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -11254,7 +11276,7 @@ export struct LocalMusic {
|
|
|
this.replayVisible = Visibility.Visible;
|
|
|
}
|
|
|
|
|
|
- private async play(url: string) {
|
|
|
+ private async play(url: string,startOffset?:number) {
|
|
|
let that = this;
|
|
|
that.showLoadIng();
|
|
|
this.isOpenAB = false
|
|
|
@@ -11397,8 +11419,13 @@ export struct LocalMusic {
|
|
|
this.updateSessionPlayState(true)
|
|
|
this.setCurrentPlayMode()
|
|
|
}, 500)
|
|
|
- //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
|
|
|
|
|
|
+ if(startOffset&&startOffset>0){//cue分轨播放
|
|
|
+ this.seekTo(startOffset + "");
|
|
|
+ this.saveLastPlayList()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //rmvb和flac格式马上记忆播放会报错,会延迟1s在读取记忆播放。
|
|
|
let timeoutPlay = 0
|
|
|
if (StrUtil.isNotEmpty(this.videoUrl) &&
|
|
|
(this.videoUrl.toLowerCase().endsWith('.rmvb') || this.videoUrl.toLowerCase().endsWith('.flac'))) {
|