PlayerBottomView.ets 1.58 KB
import { WDPlayerController } from 'wdPlayer/Index';
import { PlayerTitleView } from './PlayerTitleView'
import { PlayerProgressView } from './PlayerProgressView'
import { ContentDetailDTO } from 'wdBean/Index';
import { DisplayDirection } from 'wdConstant/Index';
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
@Component
export struct PlayerBottomView {
  private playerController?: WDPlayerController;
  @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
  @Consume showComment?: boolean
  @Consume isOpenDetail?: boolean
  @Consume isDragging?: boolean
  @Consume contentDetailData: ContentDetailDTO
  @Consume displayDirection: DisplayDirection
  @Prop index: number = 0
  @Prop currentIndex: number = 0
  @State isLayoutFullScreen: boolean = false

  aboutToAppear(): void {

    EmitterUtils.receiveEvent(EmitterEventId.FULL_SCREEN, (str?: string) => {
      // Logger.debug(TAG, 'receiveEvent FULL_SCREEN: ' + str)

      setTimeout(()=>{
        this.isLayoutFullScreen = str == '1' ? true : false
      },200)
    })
  }

  build() {
    Column() {
      PlayerTitleView()
      PlayerProgressView({
        playerController: this.playerController,
        index: this.index,
        currentIndex: this.currentIndex,
      })
    }
    .width('100%')
    .alignItems(HorizontalAlign.Start)
    .position({ x: 0, y: '100%' })
    .markAnchor({ y: '100%' })
    .linearGradient({
      colors: [
        ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.5)', 1.0]
      ]
    })
    .visibility(this.isLayoutFullScreen ? Visibility.None:Visibility.Visible)
  }
}