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 { @@ -60,9 +60,9 @@ export struct PlayerTitleComponent {
60 if(this.playerController.onVideoSizePlayerComponentBack){ 60 if(this.playerController.onVideoSizePlayerComponentBack){
61 this.playerController.onVideoSizePlayerComponentBack(2,1); 61 this.playerController.onVideoSizePlayerComponentBack(2,1);
62 } 62 }
63 - if(this.playerController.onVideoSizePlayerUIComponentMethod){  
64 - this.playerController.onVideoSizePlayerUIComponentMethod(2,1);  
65 - } 63 + // if(this.playerController.onVideoSizePlayerUIComponentMethod){
  64 + // this.playerController.onVideoSizePlayerUIComponentMethod(2,1);
  65 + // }
66 } 66 }
67 }) 67 })
68 Text(this.contentDetailData.newsTitle || '') 68 Text(this.contentDetailData.newsTitle || '')
  1 +import { WindowModel } from 'wdKit';
1 import { WDAliPlayerController } from 'wdPlayer/Index'; 2 import { WDAliPlayerController } from 'wdPlayer/Index';
2 import { PlayerCommentComponent } from './PlayerCommentComponent'; 3 import { PlayerCommentComponent } from './PlayerCommentComponent';
3 import { PlayerTitleComponent } from './PlayerTitleComponent'; 4 import { PlayerTitleComponent } from './PlayerTitleComponent';
4 import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; 5 import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
  6 +import { window } from '@kit.ArkUI';
  7 +import { DisplayDirection } from 'wdConstant';
5 8
6 /** 9 /**
7 * 沉浸直播 --- 横滑展示组件 10 * 沉浸直播 --- 横滑展示组件
@@ -9,20 +12,56 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; @@ -9,20 +12,56 @@ import { PlayerVideoControlComponent } from './PlayerVideoControlComponent';
9 @Component 12 @Component
10 export struct PlayerUIComponent { 13 export struct PlayerUIComponent {
11 private playerController?: WDAliPlayerController 14 private playerController?: WDAliPlayerController
12 - @State isSmall:boolean = false 15 + @Provide isSmall:boolean = false
13 @Consume isShowControl: boolean 16 @Consume isShowControl: boolean
  17 + @Consume displayDirection: DisplayDirection
14 aboutToAppear() { 18 aboutToAppear() {
15 if (!this.playerController) { 19 if (!this.playerController) {
16 return 20 return
17 } 21 }
18 this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => { 22 this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => {
19 - if(width>height){ 23 + if (width > height){
20 this.isSmall = true 24 this.isSmall = true
21 - }else{ 25 + } else {
22 this.isSmall = false 26 this.isSmall = false
23 } 27 }
24 } 28 }
25 } 29 }
  30 + @Builder
  31 + fullScreen() {
  32 + //全屏按钮
  33 + Image($r('app.media.icon_live_player_full_screen'))
  34 + .height(32)
  35 + .width(32)
  36 + .padding(5)
  37 + .borderRadius($r('app.float.vp_16'))
  38 + .border({width:0.5})
  39 + .borderColor(0x4DFFFFFF)
  40 + .backgroundColor(0x4D222222)
  41 + .margin({right:10})
  42 + .onClick(() => {
  43 + WindowModel.shared.setSpecificSystemBarEnabled(false)
  44 + this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
  45 + WindowModel.shared.setPreferredOrientation(
  46 + window.Orientation.LANDSCAPE_INVERTED)
  47 + if(this.playerController){
  48 + // if(this.playerController.onVideoSizePlayerUIComponentMethod){
  49 + // this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
  50 + // }
  51 + if(this.playerController.onVideoSizePlayerComponentBack){
  52 + this.playerController.onVideoSizePlayerComponentBack(1,2)
  53 + }
  54 +
  55 + if(this.playerController.onVideoSizePlayerTitleComponentBack){
  56 + this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
  57 + }
  58 + }
  59 + })
  60 + .visibility(this.isSmall ? Visibility.Visible : Visibility.Hidden)
  61 + .margin({ top: 301}) // 195 + 211 - 105
  62 + .position({ x: '96.8%' })
  63 + .markAnchor({ x: '96.8%' })
  64 + }
26 build() { 65 build() {
27 Stack() { 66 Stack() {
28 // 标题 67 // 标题
@@ -35,11 +74,12 @@ export struct PlayerUIComponent { @@ -35,11 +74,12 @@ export struct PlayerUIComponent {
35 .markAnchor({ y: '100%' }) 74 .markAnchor({ y: '100%' })
36 75
37 PlayerVideoControlComponent({ playerController: this.playerController }) 76 PlayerVideoControlComponent({ playerController: this.playerController })
38 - .visibility(this.isShowControl ? Visibility.Visible : this.isSmall? Visibility.Visible:Visibility.Hidden) 77 + .visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden)
39 .animation({ duration: 500 }) 78 .animation({ duration: 500 })
40 .position({ y: '100%' }) 79 .position({ y: '100%' })
41 .markAnchor({ y: '100%' }) 80 .markAnchor({ y: '100%' })
42 - .margin({ top: this.isSmall ? 195 + 211 - 105 : 0}) 81 +
  82 + this.fullScreen()
43 } 83 }
44 .height('100%') 84 .height('100%')
45 .width('100%') 85 .width('100%')
@@ -16,6 +16,7 @@ export struct PlayerVideoControlComponent { @@ -16,6 +16,7 @@ export struct PlayerVideoControlComponent {
16 @State isPlayStatus: boolean = true 16 @State isPlayStatus: boolean = true
17 @Consume displayDirection: DisplayDirection 17 @Consume displayDirection: DisplayDirection
18 @Consume contentDetailData: ContentDetailDTO 18 @Consume contentDetailData: ContentDetailDTO
  19 + @Consume isSmall:boolean
19 20
20 aboutToAppear(): void { 21 aboutToAppear(): void {
21 if (this.playerController) { 22 if (this.playerController) {
@@ -60,33 +61,35 @@ export struct PlayerVideoControlComponent { @@ -60,33 +61,35 @@ export struct PlayerVideoControlComponent {
60 }) 61 })
61 } 62 }
62 //全屏按钮 63 //全屏按钮
63 - Image($r('app.media.icon_live_player_full_screen'))  
64 - .height(32)  
65 - .width(32)  
66 - .padding(5)  
67 - .borderRadius($r('app.float.vp_16'))  
68 - .border({width:0.5})  
69 - .borderColor(0x4DFFFFFF)  
70 - .backgroundColor(0x4D222222)  
71 - .margin({right:10})  
72 - .onClick(() => {  
73 - WindowModel.shared.setSpecificSystemBarEnabled(false)  
74 - this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL  
75 - WindowModel.shared.setPreferredOrientation(  
76 - window.Orientation.LANDSCAPE_INVERTED)  
77 - if(this.playerController){  
78 - if(this.playerController.onVideoSizePlayerUIComponentMethod){  
79 - this.playerController.onVideoSizePlayerUIComponentMethod(1,2)  
80 - }  
81 - if(this.playerController.onVideoSizePlayerComponentBack){  
82 - this.playerController.onVideoSizePlayerComponentBack(1,2)  
83 - } 64 + if(!this.isSmall) {
  65 + Image($r('app.media.icon_live_player_full_screen'))
  66 + .height(32)
  67 + .width(32)
  68 + .padding(5)
  69 + .borderRadius($r('app.float.vp_16'))
  70 + .border({width:0.5})
  71 + .borderColor(0x4DFFFFFF)
  72 + .backgroundColor(0x4D222222)
  73 + .margin({right:10})
  74 + .onClick(() => {
  75 + WindowModel.shared.setSpecificSystemBarEnabled(false)
  76 + this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
  77 + WindowModel.shared.setPreferredOrientation(
  78 + window.Orientation.LANDSCAPE_INVERTED)
  79 + if(this.playerController){
  80 + // if(this.playerController.onVideoSizePlayerUIComponentMethod){
  81 + // this.playerController.onVideoSizePlayerUIComponentMethod(1,2)
  82 + // }
  83 + if(this.playerController.onVideoSizePlayerComponentBack){
  84 + this.playerController.onVideoSizePlayerComponentBack(1,2)
  85 + }
84 86
85 - if(this.playerController.onVideoSizePlayerTitleComponentBack){  
86 - this.playerController.onVideoSizePlayerTitleComponentBack(1,2) 87 + if(this.playerController.onVideoSizePlayerTitleComponentBack){
  88 + this.playerController.onVideoSizePlayerTitleComponentBack(1,2)
  89 + }
87 } 90 }
88 - }  
89 - }) 91 + })
  92 + }
90 } 93 }
91 .alignItems(VerticalAlign.Center) 94 .alignItems(VerticalAlign.Center)
92 // .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) 95 // .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
@@ -231,7 +231,18 @@ export struct DetailVideoListPage { @@ -231,7 +231,18 @@ export struct DetailVideoListPage {
231 231
232 build() { 232 build() {
233 Stack({ alignContent: Alignment.Center }) { 233 Stack({ alignContent: Alignment.Center }) {
234 - if (this.netStatus !== undefined || this.isOffLine) { 234 + if (this.netStatus !== undefined) {
  235 + EmptyComponent({
  236 + emptyType: 1, emptyButton: true, isBlack: true, retry: () => {
  237 + this.getContentDetail(this.contentId, this.relId, this.relType)
  238 + }
  239 + })
  240 + .id('e_empty_content')
  241 + .alignRules({
  242 + center: { anchor: "__container__", align: VerticalAlign.Center },
  243 + middle: { anchor: "__container__", align: HorizontalAlign.Center }
  244 + })
  245 + } else if (this.isOffLine) {
235 EmptyComponent({ 246 EmptyComponent({
236 emptyType: 15, emptyButton: true, retry: () => { 247 emptyType: 15, emptyButton: true, retry: () => {
237 this.getContentDetail(this.contentId, this.relId, this.relType) 248 this.getContentDetail(this.contentId, this.relId, this.relType)
@@ -69,14 +69,14 @@ export class BackgroundAudioController { @@ -69,14 +69,14 @@ export class BackgroundAudioController {
69 69
70 //设置播放元数据 70 //设置播放元数据
71 async setSessionMetaData(assetId: string, title: string, mediaImage: Resource, artist: string) { 71 async setSessionMetaData(assetId: string, title: string, mediaImage: Resource, artist: string) {
72 - this.lastItemAssetId = assetId  
73 - this.lastItemTitle = title 72 + this.lastItemAssetId = assetId.length > 0 ? assetId : ""
  73 + this.lastItemTitle = title || ""
74 this.lastItemMediaImage = mediaImage 74 this.lastItemMediaImage = mediaImage
75 - this.lastItemArtist = artist 75 + this.lastItemArtist = artist || ""
76 } 76 }
77 77
78 async setSessionMetaDataWithDuration(assetId: string, title: string, mediaImage: Resource, artist: string, duration: number) { 78 async setSessionMetaDataWithDuration(assetId: string, title: string, mediaImage: Resource, artist: string, duration: number) {
79 - Logger.debug(TAG, `SetAVMetadata assetId: ${assetId}}, title: ${title}, mediaImage: ${mediaImage}, artist: ${artist}, duration: ${duration}`); 79 + Logger.debug(TAG, `SetAVMetadata assetId: ${assetId}, title: ${title}, mediaImage: ${mediaImage}, artist: ${artist}, duration: ${duration}`);
80 80
81 if (!this.gotContextFunc) { return } 81 if (!this.gotContextFunc) { return }
82 let pixelMapImage:image.PixelMap | null = null 82 let pixelMapImage:image.PixelMap | null = null
@@ -95,7 +95,7 @@ export class BackgroundAudioController { @@ -95,7 +95,7 @@ export class BackgroundAudioController {
95 let metadata: AVSessionManager.AVMetadata = { 95 let metadata: AVSessionManager.AVMetadata = {
96 assetId: assetId.length > 0 ? assetId : "fake-asset-id", 96 assetId: assetId.length > 0 ? assetId : "fake-asset-id",
97 title: title.length > 0 ? title : " ", 97 title: title.length > 0 ? title : " ",
98 - mediaImage: pixelMapImage ?? ("file://" + mediaImage.id), 98 + mediaImage: "https://cdnjdphoto.aikan.pdnews.cn/WapApi/800/launcher_icon.png" ,//pixelMapImage ?? ("file://" + mediaImage.id),
99 artist: artist.length > 0 ? artist : "人日日报", 99 artist: artist.length > 0 ? artist : "人日日报",
100 duration: duration 100 duration: duration
101 }; 101 };
@@ -155,17 +155,20 @@ export class BackgroundAudioController { @@ -155,17 +155,20 @@ export class BackgroundAudioController {
155 155
156 //设置进度,单位ms 156 //设置进度,单位ms
157 async setSessionPlayProgress(progressDuration: number, totalDuration: number) { 157 async setSessionPlayProgress(progressDuration: number, totalDuration: number) {
  158 + this.setSessionPlayProgressForce(progressDuration, totalDuration, false)
  159 + }
  160 + async setSessionPlayProgressForce(progressDuration: number, totalDuration: number, force: boolean) {
158 if (totalDuration <= 0) { 161 if (totalDuration <= 0) {
159 return 162 return
160 } 163 }
161 let newProgress = progressDuration / totalDuration 164 let newProgress = progressDuration / totalDuration
162 - if (Math.abs(newProgress - this.lastProgress) < 0.01) { 165 + if (force == false && Math.abs(newProgress - this.lastProgress) < 0.01) {
163 return 166 return
164 } 167 }
165 // Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration); 168 // Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration);
166 this.lastProgress = newProgress 169 this.lastProgress = newProgress
167 170
168 - if (this.lastItemAssetId) { 171 + if (this.lastItemAssetId != undefined) {
169 this.lastItemTotalDuration = totalDuration 172 this.lastItemTotalDuration = totalDuration
170 await this.setSessionMetaDataWithDuration( 173 await this.setSessionMetaDataWithDuration(
171 this.lastItemAssetId ?? "", 174 this.lastItemAssetId ?? "",
@@ -177,7 +180,7 @@ export class BackgroundAudioController { @@ -177,7 +180,7 @@ export class BackgroundAudioController {
177 this.lastItemAssetId = undefined 180 this.lastItemAssetId = undefined
178 } 181 }
179 182
180 - if (this.hasSetupProgress) { 183 + if (force == false && this.hasSetupProgress) {
181 return 184 return
182 } 185 }
183 this.hasSetupProgress = true 186 this.hasSetupProgress = true
@@ -255,9 +258,9 @@ export class BackgroundAudioController { @@ -255,9 +258,9 @@ export class BackgroundAudioController {
255 } else { 258 } else {
256 Logger.debug(TAG, `SetAVPlaybackState seek buffering`); 259 Logger.debug(TAG, `SetAVPlaybackState seek buffering`);
257 } 260 }
258 -  
259 // 应用响应seek命令,使用应用内播放器完成seek实现 261 // 应用响应seek命令,使用应用内播放器完成seek实现
260 this.avplayerController?.setSeekMicroSecondsTime(position) 262 this.avplayerController?.setSeekMicroSecondsTime(position)
  263 + this.setSessionPlayProgressForce(position, this.lastItemTotalDuration, true)
261 setTimeout(() => { 264 setTimeout(() => {
262 this.hasSetupProgress = false 265 this.hasSetupProgress = false
263 }, 1000) 266 }, 1000)
@@ -342,6 +342,10 @@ export class WDPlayerController { @@ -342,6 +342,10 @@ export class WDPlayerController {
342 return; 342 return;
343 } 343 }
344 this.avPlayer?.seek(value); 344 this.avPlayer?.seek(value);
  345 +
  346 + if (this.status == PlayerConstants.STATUS_PAUSE) {
  347 + this.avPlayer?.play()
  348 + }
345 } 349 }
346 350
347 setBright() { 351 setBright() {