|
|
@@ -472,6 +472,12 @@ export struct LocalMusic {
|
|
|
|
|
|
});
|
|
|
|
|
|
+ this.eventHub.on('onStateChange', (fg: boolean) => {
|
|
|
+ if (fg && this.curState === 'STARTED') {
|
|
|
+ this.stopPip();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
startAutoHide(){
|
|
|
@@ -5237,7 +5243,7 @@ export struct LocalMusic {
|
|
|
this.lyricControllerXF.setTextWeight(this.lyricTextWeightPip)
|
|
|
|
|
|
this.pipBg = PreferencesUtil.getStringSync('BGColorPip', '#E8E8E8')
|
|
|
- this.nodeController.updateBgColor(this.pipBg)
|
|
|
+ this.nodeController.updateBgColor(this.pipBg,this.lyricControllerXF)
|
|
|
}
|
|
|
|
|
|
//根据item返回歌词内容
|
|
|
@@ -6117,7 +6123,7 @@ export struct LocalMusic {
|
|
|
.fontSize(14)
|
|
|
.fontColor(Color.White)
|
|
|
Text(this.pipBg)
|
|
|
- .fontSize(15)
|
|
|
+ .fontSize(14)
|
|
|
.fontColor(Color.White)
|
|
|
.margin({ left: 12, right: 12 })
|
|
|
Column(){}
|
|
|
@@ -6169,7 +6175,7 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
.width('76%')
|
|
|
- .margin({ top:10,bottom:10,right:45,left:20})
|
|
|
+ .margin({ bottom:5,right:45,left:20})
|
|
|
}
|
|
|
if(!isPip){
|
|
|
Row() {
|
|
|
@@ -6639,10 +6645,10 @@ export struct LocalMusic {
|
|
|
|
|
|
private changeLyricColor(color: string,isPip:boolean,isBG?:boolean) {
|
|
|
LogUtil.info('onecold isBG = '+isBG)
|
|
|
- if(isBG){
|
|
|
+ if(isBG){//如果是设置悬浮背景
|
|
|
this.pipBg = color
|
|
|
PreferencesUtil.putSync('BGColorPip', this.pipBg)
|
|
|
- this.nodeController.updateBgColor(this.pipBg)
|
|
|
+ this.nodeController.updateBgColor(this.pipBg,this.lyricControllerXF)
|
|
|
return
|
|
|
}
|
|
|
if(isPip){
|
|
|
@@ -7317,6 +7323,7 @@ export struct LocalMusic {
|
|
|
Logger.info(`[${TAG}] pipController is not exist`);
|
|
|
return;
|
|
|
}
|
|
|
+ this.isOpenPip = false
|
|
|
await this.pipController.stopPiP();
|
|
|
}
|
|
|
|
|
|
@@ -7326,8 +7333,10 @@ export struct LocalMusic {
|
|
|
componentController: this.xcomponentController,
|
|
|
navigationId: this.navigationId,
|
|
|
templateType: PiPWindow.PiPTemplateType.VIDEO_PLAY,
|
|
|
+ controlGroups: [PiPWindow.VideoPlayControlGroup.VIDEO_PREVIOUS_NEXT],
|
|
|
customUIController: this.nodeController,
|
|
|
});
|
|
|
+
|
|
|
this.pipLyWidth = PreferencesUtil.getNumberSync('pipLyWidth',330)
|
|
|
this.pipLyHeight = PreferencesUtil.getNumberSync('pipLyHeight',120)
|
|
|
this.pipController.updateContentSize(this.pipLyWidth, this.pipLyHeight);
|
|
|
@@ -7363,8 +7372,7 @@ export struct LocalMusic {
|
|
|
this.curError = $r('app.string.current_error_hint');
|
|
|
break;
|
|
|
case PiPWindow.PiPState.STOPPED:
|
|
|
- // this.updatePlayStatus(true);
|
|
|
- this.startPlayOrResumePlay()
|
|
|
+ this.isOpenPip = false
|
|
|
this.curState = 'STOPPED';
|
|
|
this.curError = $r('app.string.current_error_hint');
|
|
|
break;
|
|
|
@@ -7379,10 +7387,11 @@ export struct LocalMusic {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- Logger.info(`[${TAG}] onStateChange: ${this.curState}, reason: ${reason}`);
|
|
|
+ Logger.info(`[${TAG}] onecold onStateChange: ${this.curState}, reason: ${reason}`);
|
|
|
}
|
|
|
|
|
|
onActionEvent(event: PiPWindow.PiPActionEventType, status: number | undefined) {
|
|
|
+ LogUtil.info('onecold onActionEvent = '+ event + ' status='+status )
|
|
|
switch (event) {
|
|
|
case 'playbackStateChanged':
|
|
|
if (status === 0) {
|
|
|
@@ -7399,14 +7408,19 @@ export struct LocalMusic {
|
|
|
// 切换到上一个视频
|
|
|
this.playPrevious()
|
|
|
break;
|
|
|
- default:
|
|
|
+ case 'previousVideo':
|
|
|
+ // 切换到上一个视频
|
|
|
+ this.playPrevious()
|
|
|
+
|
|
|
break;
|
|
|
+ default:
|
|
|
+
|
|
|
}
|
|
|
this.buttonAction = event + `-status:${status}`;
|
|
|
Logger.info(`[${TAG}] onActionEvent: ${this.buttonAction} status:${status}}`);
|
|
|
}
|
|
|
/**
|
|
|
- * 画中画功能(悬浮歌词功能)
|
|
|
+ * 画中画功能(悬浮歌词功能)结束
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
@@ -7693,9 +7707,13 @@ export struct LocalMusic {
|
|
|
}
|
|
|
|
|
|
private startPlayOrResumePlay() {
|
|
|
+ if(this.pipController)
|
|
|
+ this.pipController.updatePiPControlStatus(PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE, PiPWindow.PiPControlStatus.PLAY);
|
|
|
this.isOpenPip = PreferencesUtil.getBooleanSync('isOpenPip',false)
|
|
|
if(this.isOpenPip){
|
|
|
this.startPip()
|
|
|
+ }else{
|
|
|
+ this.stopPip()
|
|
|
}
|
|
|
this.mDestroyPage = false;
|
|
|
this.animationState = AnimationStatus.Running
|
|
|
@@ -8665,7 +8683,8 @@ export struct LocalMusic {
|
|
|
this.CONTROL_PlayStatus = PlayStatus.PAUSE;
|
|
|
this.updateSessionPlayState(false)
|
|
|
this.playChange()
|
|
|
-
|
|
|
+ if(this.pipController)
|
|
|
+ this.pipController.updatePiPControlStatus(PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE, PiPWindow.PiPControlStatus.PAUSE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -9435,10 +9454,10 @@ class TextNodeController extends NodeController {
|
|
|
}
|
|
|
|
|
|
// 开发者可自定义该方法实现布局更新
|
|
|
- updateBgColor(color: string) {
|
|
|
- console.log(`update message: ${color}`);
|
|
|
+ updateBgColor(color: string,lyController:LyricController) {
|
|
|
+ console.log(`onecold update message: ${color}`);
|
|
|
if (this.textNode !== null) {
|
|
|
- this.textNode.update(new Params(color,this.lyController));
|
|
|
+ this.textNode.update(new Params(color,lyController));
|
|
|
}
|
|
|
}
|
|
|
}
|