|
@@ -3976,7 +3976,7 @@ export struct LocalMusic {
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
LogUtils.getInstance().LOGI("slider-->seekValue start:" + value);
|
|
LogUtils.getInstance().LOGI("slider-->seekValue start:" + value);
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
LogUtils.getInstance().LOGI("slider-->seekValue end:" + seekValue);
|
|
LogUtils.getInstance().LOGI("slider-->seekValue end:" + seekValue);
|
|
|
this.isSeekTo = false;
|
|
this.isSeekTo = false;
|
|
@@ -4040,7 +4040,7 @@ export struct LocalMusic {
|
|
|
this.isSeekTo = true;
|
|
this.isSeekTo = true;
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
this.isSeekTo = false;
|
|
this.isSeekTo = false;
|
|
|
|
|
|
|
@@ -4102,7 +4102,7 @@ export struct LocalMusic {
|
|
|
this.isSeekTo = true;
|
|
this.isSeekTo = true;
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
this.isSeekTo = false;
|
|
this.isSeekTo = false;
|
|
|
|
|
|
|
@@ -4170,7 +4170,7 @@ export struct LocalMusic {
|
|
|
this.isSeekTo = true;
|
|
this.isSeekTo = true;
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
this.isSeekTo = false;
|
|
this.isSeekTo = false;
|
|
|
|
|
|
|
@@ -4232,7 +4232,7 @@ export struct LocalMusic {
|
|
|
this.isSeekTo = true;
|
|
this.isSeekTo = true;
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
this.isSeekTo = false;
|
|
this.isSeekTo = false;
|
|
|
|
|
|
|
@@ -4295,7 +4295,7 @@ export struct LocalMusic {
|
|
|
this.isSeekTo = true;
|
|
this.isSeekTo = true;
|
|
|
this.mDestroyPage = false;
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
this.isSeekTo = false;
|
|
this.isSeekTo = false;
|
|
|
|
|
|
|
@@ -10678,7 +10678,7 @@ export struct LocalMusic {
|
|
|
if (this.currentSong && isRemoteCloudType(this.currentSong.type)) {
|
|
if (this.currentSong && isRemoteCloudType(this.currentSong.type)) {
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
}
|
|
}
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
console.info("onecold this.currentSong.type:"+this.currentSong?.type)
|
|
console.info("onecold this.currentSong.type:"+this.currentSong?.type)
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
})
|
|
})
|
|
@@ -10958,7 +10958,7 @@ export struct LocalMusic {
|
|
|
console.info("onecold 开始转圈圈")
|
|
console.info("onecold 开始转圈圈")
|
|
|
this.showLoadIng();
|
|
this.showLoadIng();
|
|
|
}
|
|
}
|
|
|
- let seekValue = value * (this.mIjkMediaPlayer.getDuration() / 100);
|
|
|
|
|
|
|
+ let seekValue = value * (this.getActiveDuration() / 100);
|
|
|
this.seekTo(seekValue + "");
|
|
this.seekTo(seekValue + "");
|
|
|
})
|
|
})
|
|
|
Text(this.totalTime)
|
|
Text(this.totalTime)
|
|
@@ -13409,6 +13409,9 @@ export struct LocalMusic {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private setProgress() {
|
|
private setProgress() {
|
|
|
|
|
+ if (this.castControllerWrapper && this.isCastPlaying) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
let position = this.mIjkMediaPlayer.getCurrentPosition();
|
|
let position = this.mIjkMediaPlayer.getCurrentPosition();
|
|
|
let duration = this.mIjkMediaPlayer.getDuration();
|
|
let duration = this.mIjkMediaPlayer.getDuration();
|
|
|
if (duration <= 0 && this.duration > 0) {
|
|
if (duration <= 0 && this.duration > 0) {
|
|
@@ -14340,7 +14343,8 @@ export struct LocalMusic {
|
|
|
this.songList,
|
|
this.songList,
|
|
|
this.curIndex,
|
|
this.curIndex,
|
|
|
this.mIjkMediaPlayer.getCurrentPosition(),
|
|
this.mIjkMediaPlayer.getCurrentPosition(),
|
|
|
- this.videoUrl
|
|
|
|
|
|
|
+ this.videoUrl,
|
|
|
|
|
+ this.getActiveDuration()
|
|
|
);
|
|
);
|
|
|
Logger.info('heanup startCasting', '✅ initAVCast 调用完成');
|
|
Logger.info('heanup startCasting', '✅ initAVCast 调用完成');
|
|
|
|
|
|
|
@@ -14350,6 +14354,11 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
// 从 CastController 获取投播状态
|
|
// 从 CastController 获取投播状态
|
|
|
this.isCastPlaying = this.castControllerWrapper.getIsCastPlaying();
|
|
this.isCastPlaying = this.castControllerWrapper.getIsCastPlaying();
|
|
|
|
|
+ if (this.isCastPlaying) {
|
|
|
|
|
+ this.CONTROL_PlayStatus = PlayStatus.PLAY;
|
|
|
|
|
+ this.setIsPlaying(true);
|
|
|
|
|
+ this.updateSessionPlayState(true);
|
|
|
|
|
+ }
|
|
|
Logger.info('heanup startCasting', `✅ 投播初始化完成, isCastPlaying=${this.isCastPlaying}`);
|
|
Logger.info('heanup startCasting', `✅ 投播初始化完成, isCastPlaying=${this.isCastPlaying}`);
|
|
|
|
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -14467,11 +14476,13 @@ export struct LocalMusic {
|
|
|
private updateSessionPlayState(isPlay: boolean): void {
|
|
private updateSessionPlayState(isPlay: boolean): void {
|
|
|
// if(!this.isBgPlayOpen)
|
|
// if(!this.isBgPlayOpen)
|
|
|
// return
|
|
// return
|
|
|
|
|
+ const elapsedTime = (this.castControllerWrapper && this.isCastPlaying) ? this.currentTime2 * 1000
|
|
|
|
|
+ : this.mIjkMediaPlayer.getCurrentPosition();
|
|
|
Logger.info(TAG, `updateIsPlay isPlay: ${isPlay}`);
|
|
Logger.info(TAG, `updateIsPlay isPlay: ${isPlay}`);
|
|
|
this.setAVSessionPlayState({
|
|
this.setAVSessionPlayState({
|
|
|
state: isPlay ? avSession.PlaybackState.PLAYBACK_STATE_PLAY : avSession.PlaybackState.PLAYBACK_STATE_PAUSE,
|
|
state: isPlay ? avSession.PlaybackState.PLAYBACK_STATE_PLAY : avSession.PlaybackState.PLAYBACK_STATE_PAUSE,
|
|
|
position: {
|
|
position: {
|
|
|
- elapsedTime: this.mIjkMediaPlayer.getCurrentPosition(),
|
|
|
|
|
|
|
+ elapsedTime: elapsedTime,
|
|
|
updateTime: new Date().getTime()
|
|
updateTime: new Date().getTime()
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -14484,12 +14495,21 @@ export struct LocalMusic {
|
|
|
private positionChange(position: number) {
|
|
private positionChange(position: number) {
|
|
|
this.currentTime2 = position / 1000;
|
|
this.currentTime2 = position / 1000;
|
|
|
this.currentStringTime = secondToTime(Math.floor(position / 1000));
|
|
this.currentStringTime = secondToTime(Math.floor(position / 1000));
|
|
|
|
|
+ if (this.castControllerWrapper && this.isCastPlaying) {
|
|
|
|
|
+ this.updateCastProgress(position);
|
|
|
|
|
+ if (this.isSeekTo) {
|
|
|
|
|
+ this.isSeekTo = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private playDurationChange(duration: number) {
|
|
private playDurationChange(duration: number) {
|
|
|
this.duration = duration;
|
|
this.duration = duration;
|
|
|
this.durationTime = Math.floor(this.duration / 1000);
|
|
this.durationTime = Math.floor(this.duration / 1000);
|
|
|
this.durationStringTime = secondToTime((this.durationTime));
|
|
this.durationStringTime = secondToTime((this.durationTime));
|
|
|
|
|
+ if (this.castControllerWrapper && this.isCastPlaying) {
|
|
|
|
|
+ this.totalTime = this.stringForTime(this.duration);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// playbackStateChangeListener 方法已被删除,改用 setPlaybackStateChangeListener 中的内联函数
|
|
// playbackStateChangeListener 方法已被删除,改用 setPlaybackStateChangeListener 中的内联函数
|
|
|
private reloadCasting = async () => {
|
|
private reloadCasting = async () => {
|
|
@@ -14662,6 +14682,9 @@ export struct LocalMusic {
|
|
|
try {
|
|
try {
|
|
|
Logger.info('heanup playOrPause', '投播模式播放');
|
|
Logger.info('heanup playOrPause', '投播模式播放');
|
|
|
await this.castControllerWrapper.setPlaying();
|
|
await this.castControllerWrapper.setPlaying();
|
|
|
|
|
+ this.CONTROL_PlayStatus = PlayStatus.PLAY;
|
|
|
|
|
+ this.setIsPlaying(true);
|
|
|
|
|
+ this.updateSessionPlayState(true);
|
|
|
Logger.info('heanup playOrPause', '投播播放成功');
|
|
Logger.info('heanup playOrPause', '投播播放成功');
|
|
|
this.playChange();
|
|
this.playChange();
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -14715,6 +14738,43 @@ export struct LocalMusic {
|
|
|
this.setSeekToActionProgress(seeTime);
|
|
this.setSeekToActionProgress(seeTime);
|
|
|
await this.seekTo(seeTime + "");
|
|
await this.seekTo(seeTime + "");
|
|
|
};
|
|
};
|
|
|
|
|
+ private getActiveDuration(): number {
|
|
|
|
|
+ let duration = this.mIjkMediaPlayer.getDuration();
|
|
|
|
|
+ if (this.castControllerWrapper && this.isCastPlaying) {
|
|
|
|
|
+ return this.duration > 0 ? this.duration : duration;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (duration <= 0 && this.duration > 0) {
|
|
|
|
|
+ duration = this.duration;
|
|
|
|
|
+ }
|
|
|
|
|
+ return duration;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private updateCastProgress(position: number): void {
|
|
|
|
|
+ const duration = this.getActiveDuration();
|
|
|
|
|
+ if (duration <= 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.slideEnable = true;
|
|
|
|
|
+ let pos = (position / duration) * 100;
|
|
|
|
|
+ if (pos > this.PROGRESS_MAX_VALUE) {
|
|
|
|
|
+ this.progressValue = this.PROGRESS_MAX_VALUE;
|
|
|
|
|
+ } else if (pos < 0) {
|
|
|
|
|
+ this.progressValue = 0;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.progressValue = pos;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.totalTime = this.stringForTime(duration);
|
|
|
|
|
+ if (position > duration) {
|
|
|
|
|
+ position = duration;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isCurrentTime = true;
|
|
|
|
|
+ this.currentTime = this.stringForTime(position);
|
|
|
|
|
+ this.isCurrentTime = false;
|
|
|
|
|
+ this.lyricController.updatePosition(position + this.timeOffset * 1000);
|
|
|
|
|
+ this.lyricControllerXF.updatePosition(position + this.timeOffset * 1000);
|
|
|
|
|
+ this.lyricControllerSingle.updatePosition(position + this.timeOffset * 1000);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* Gesture method onActionUpdate.
|
|
* Gesture method onActionUpdate.
|
|
|
*
|
|
*
|
|
@@ -14722,7 +14782,7 @@ export struct LocalMusic {
|
|
|
*/
|
|
*/
|
|
|
private setSeekToActionProgress(position: number) {
|
|
private setSeekToActionProgress(position: number) {
|
|
|
// 投播模式使用this.duration,本地模式使用播放器获取
|
|
// 投播模式使用this.duration,本地模式使用播放器获取
|
|
|
- let duration = this.duration > 0 ? this.duration : this.mIjkMediaPlayer.getDuration();
|
|
|
|
|
|
|
+ let duration = this.getActiveDuration();
|
|
|
let pos = 0;
|
|
let pos = 0;
|
|
|
if (duration > 0) {
|
|
if (duration > 0) {
|
|
|
this.slideEnable = true;
|
|
this.slideEnable = true;
|
|
@@ -14794,6 +14854,9 @@ export struct LocalMusic {
|
|
|
try {
|
|
try {
|
|
|
Logger.info('heanup pause', '投播模式暂停');
|
|
Logger.info('heanup pause', '投播模式暂停');
|
|
|
await this.castControllerWrapper.setPause();
|
|
await this.castControllerWrapper.setPause();
|
|
|
|
|
+ this.CONTROL_PlayStatus = PlayStatus.PAUSE;
|
|
|
|
|
+ this.setIsPlaying(false);
|
|
|
|
|
+ this.updateSessionPlayState(false);
|
|
|
Logger.info('heanup pause', '投播暂停成功');
|
|
Logger.info('heanup pause', '投播暂停成功');
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
Logger.error('heanup pause', `投播暂停失败: ${error}`);
|
|
Logger.error('heanup pause', `投播暂停失败: ${error}`);
|
|
@@ -14860,6 +14923,7 @@ export struct LocalMusic {
|
|
|
if (this.castControllerWrapper && this.isCastPlaying) {
|
|
if (this.castControllerWrapper && this.isCastPlaying) {
|
|
|
try {
|
|
try {
|
|
|
let seekPos = Number.parseInt(value);
|
|
let seekPos = Number.parseInt(value);
|
|
|
|
|
+ this.isSeekTo = true;
|
|
|
Logger.info('heanup seekTo', `投播模式seek到: ${seekPos}ms, 当前时长: ${this.duration}ms`);
|
|
Logger.info('heanup seekTo', `投播模式seek到: ${seekPos}ms, 当前时长: ${this.duration}ms`);
|
|
|
|
|
|
|
|
// 检查是否接近末尾
|
|
// 检查是否接近末尾
|