wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  ref |> 播控中心处理contentId为空情况
  fix: 【UAT】【缺省图】视频稿件进入详情后,没有获取到播放数据时,没有展示缺省图
  fix: uat进入app宁夏地方频道下点击配置回看类的直播节目“迷魂台”,鸿蒙版无进度条,无法暂停和快进快退
  ref |> 调整播控中心进度条显示拖拽问题
... ... @@ -60,9 +60,9 @@ export struct PlayerTitleComponent {
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(2,1);
}
if(this.playerController.onVideoSizePlayerUIComponentMethod){
this.playerController.onVideoSizePlayerUIComponentMethod(2,1);
}
// if(this.playerController.onVideoSizePlayerUIComponentMethod){
// this.playerController.onVideoSizePlayerUIComponentMethod(2,1);
// }
}
})
Text(this.contentDetailData.newsTitle || '')
... ...
import { WindowModel } from 'wdKit';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { PlayerCommentComponent } from './PlayerCommentComponent';
import { PlayerTitleComponent } from './PlayerTitleComponent';
import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
import { window } from '@kit.ArkUI';
import { DisplayDirection } from 'wdConstant';
/**
* 沉浸直播 --- 横滑展示组件
... ... @@ -9,20 +12,56 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
@Component
export struct PlayerUIComponent {
private playerController?: WDAliPlayerController
@State isSmall:boolean = false
@Provide isSmall:boolean = false
@Consume isShowControl: boolean
@Consume displayDirection: DisplayDirection
aboutToAppear() {
if (!this.playerController) {
return
}
this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => {
if(width>height){
if (width > height){
this.isSmall = true
}else{
} else {
this.isSmall = false
}
}
}
@Builder
fullScreen() {
//全屏按钮
Image($r('app.media.icon_live_player_full_screen'))
.height(32)
.width(32)
.padding(5)
.borderRadius($r('app.float.vp_16'))
.border({width:0.5})
.borderColor(0x4DFFFFFF)
.backgroundColor(0x4D222222)
.margin({right:10})
.onClick(() => {
WindowModel.shared.setSpecificSystemBarEnabled(false)
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
WindowModel.shared.setPreferredOrientation(
window.Orientation.LANDSCAPE_INVERTED)
if(this.playerController){
// if(this.playerController.onVideoSizePlayerUIComponentMethod){
// this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
// }
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(1,2)
}
if(this.playerController.onVideoSizePlayerTitleComponentBack){
this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
}
}
})
.visibility(this.isSmall ? Visibility.Visible : Visibility.Hidden)
.margin({ top: 301}) // 195 + 211 - 105
.position({ x: '96.8%' })
.markAnchor({ x: '96.8%' })
}
build() {
Stack() {
// 标题
... ... @@ -35,11 +74,12 @@ export struct PlayerUIComponent {
.markAnchor({ y: '100%' })
PlayerVideoControlComponent({ playerController: this.playerController })
.visibility(this.isShowControl ? Visibility.Visible : this.isSmall? Visibility.Visible:Visibility.Hidden)
.visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden)
.animation({ duration: 500 })
.position({ y: '100%' })
.markAnchor({ y: '100%' })
.margin({ top: this.isSmall ? 195 + 211 - 105 : 0})
this.fullScreen()
}
.height('100%')
.width('100%')
... ...
... ... @@ -16,6 +16,7 @@ export struct PlayerVideoControlComponent {
@State isPlayStatus: boolean = true
@Consume displayDirection: DisplayDirection
@Consume contentDetailData: ContentDetailDTO
@Consume isSmall:boolean
aboutToAppear(): void {
if (this.playerController) {
... ... @@ -60,33 +61,35 @@ export struct PlayerVideoControlComponent {
})
}
//全屏按钮
Image($r('app.media.icon_live_player_full_screen'))
.height(32)
.width(32)
.padding(5)
.borderRadius($r('app.float.vp_16'))
.border({width:0.5})
.borderColor(0x4DFFFFFF)
.backgroundColor(0x4D222222)
.margin({right:10})
.onClick(() => {
WindowModel.shared.setSpecificSystemBarEnabled(false)
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
WindowModel.shared.setPreferredOrientation(
window.Orientation.LANDSCAPE_INVERTED)
if(this.playerController){
if(this.playerController.onVideoSizePlayerUIComponentMethod){
this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
}
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(1,2)
}
if(!this.isSmall) {
Image($r('app.media.icon_live_player_full_screen'))
.height(32)
.width(32)
.padding(5)
.borderRadius($r('app.float.vp_16'))
.border({width:0.5})
.borderColor(0x4DFFFFFF)
.backgroundColor(0x4D222222)
.margin({right:10})
.onClick(() => {
WindowModel.shared.setSpecificSystemBarEnabled(false)
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
WindowModel.shared.setPreferredOrientation(
window.Orientation.LANDSCAPE_INVERTED)
if(this.playerController){
// if(this.playerController.onVideoSizePlayerUIComponentMethod){
// this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
// }
if(this.playerController.onVideoSizePlayerComponentBack){
this.playerController.onVideoSizePlayerComponentBack(1,2)
}
if(this.playerController.onVideoSizePlayerTitleComponentBack){
this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
if(this.playerController.onVideoSizePlayerTitleComponentBack){
this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
}
}
}
})
})
}
}
.alignItems(VerticalAlign.Center)
// .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
... ...
... ... @@ -231,7 +231,18 @@ export struct DetailVideoListPage {
build() {
Stack({ alignContent: Alignment.Center }) {
if (this.netStatus !== undefined || this.isOffLine) {
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
this.getContentDetail(this.contentId, this.relId, this.relType)
}
})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
} else if (this.isOffLine) {
EmptyComponent({
emptyType: 15, emptyButton: true, retry: () => {
this.getContentDetail(this.contentId, this.relId, this.relType)
... ...
... ... @@ -69,14 +69,14 @@ export class BackgroundAudioController {
//设置播放元数据
async setSessionMetaData(assetId: string, title: string, mediaImage: Resource, artist: string) {
this.lastItemAssetId = assetId
this.lastItemTitle = title
this.lastItemAssetId = assetId.length > 0 ? assetId : ""
this.lastItemTitle = title || ""
this.lastItemMediaImage = mediaImage
this.lastItemArtist = artist
this.lastItemArtist = artist || ""
}
async setSessionMetaDataWithDuration(assetId: string, title: string, mediaImage: Resource, artist: string, duration: number) {
Logger.debug(TAG, `SetAVMetadata assetId: ${assetId}}, title: ${title}, mediaImage: ${mediaImage}, artist: ${artist}, duration: ${duration}`);
Logger.debug(TAG, `SetAVMetadata assetId: ${assetId}, title: ${title}, mediaImage: ${mediaImage}, artist: ${artist}, duration: ${duration}`);
if (!this.gotContextFunc) { return }
let pixelMapImage:image.PixelMap | null = null
... ... @@ -95,7 +95,7 @@ export class BackgroundAudioController {
let metadata: AVSessionManager.AVMetadata = {
assetId: assetId.length > 0 ? assetId : "fake-asset-id",
title: title.length > 0 ? title : " ",
mediaImage: pixelMapImage ?? ("file://" + mediaImage.id),
mediaImage: "https://cdnjdphoto.aikan.pdnews.cn/WapApi/800/launcher_icon.png" ,//pixelMapImage ?? ("file://" + mediaImage.id),
artist: artist.length > 0 ? artist : "人日日报",
duration: duration
};
... ... @@ -155,17 +155,20 @@ export class BackgroundAudioController {
//设置进度,单位ms
async setSessionPlayProgress(progressDuration: number, totalDuration: number) {
this.setSessionPlayProgressForce(progressDuration, totalDuration, false)
}
async setSessionPlayProgressForce(progressDuration: number, totalDuration: number, force: boolean) {
if (totalDuration <= 0) {
return
}
let newProgress = progressDuration / totalDuration
if (Math.abs(newProgress - this.lastProgress) < 0.01) {
if (force == false && Math.abs(newProgress - this.lastProgress) < 0.01) {
return
}
// Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration);
this.lastProgress = newProgress
if (this.lastItemAssetId) {
if (this.lastItemAssetId != undefined) {
this.lastItemTotalDuration = totalDuration
await this.setSessionMetaDataWithDuration(
this.lastItemAssetId ?? "",
... ... @@ -177,7 +180,7 @@ export class BackgroundAudioController {
this.lastItemAssetId = undefined
}
if (this.hasSetupProgress) {
if (force == false && this.hasSetupProgress) {
return
}
this.hasSetupProgress = true
... ... @@ -255,9 +258,9 @@ export class BackgroundAudioController {
} else {
Logger.debug(TAG, `SetAVPlaybackState seek buffering`);
}
// 应用响应seek命令,使用应用内播放器完成seek实现
this.avplayerController?.setSeekMicroSecondsTime(position)
this.setSessionPlayProgressForce(position, this.lastItemTotalDuration, true)
setTimeout(() => {
this.hasSetupProgress = false
}, 1000)
... ...
... ... @@ -342,6 +342,10 @@ export class WDPlayerController {
return;
}
this.avPlayer?.seek(value);
if (this.status == PlayerConstants.STATUS_PAUSE) {
this.avPlayer?.play()
}
}
setBright() {
... ...