liyubing

feat:横屏直播详情页面添加垫片逻辑

@@ -7,9 +7,10 @@ import mediaquery from '@ohos.mediaquery'; @@ -7,9 +7,10 @@ import mediaquery from '@ohos.mediaquery';
7 import { Logger, WindowModel } from 'wdKit/Index'; 7 import { Logger, WindowModel } from 'wdKit/Index';
8 import { router, window } from '@kit.ArkUI'; 8 import { router, window } from '@kit.ArkUI';
9 import { WDAliPlayerController } from 'wdPlayer/Index'; 9 import { WDAliPlayerController } from 'wdPlayer/Index';
10 -import { LiveOperRowListView } from 'wdComponent'; 10 +import { LiveEmptyComponent, LiveOperRowListView } from 'wdComponent';
11 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; 11 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
12 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; 12 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
  13 +import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
13 14
14 let TAG: string = 'DetailPlayLivePage'; 15 let TAG: string = 'DetailPlayLivePage';
15 16
@@ -39,6 +40,8 @@ export struct DetailPlayLivePage { @@ -39,6 +40,8 @@ export struct DetailPlayLivePage {
39 @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 40 @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
40 @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 41 @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
41 42
  43 +
  44 +
42 aboutToAppear(): void { 45 aboutToAppear(): void {
43 Logger.info(TAG, `wyj-aboutToAppear`) 46 Logger.info(TAG, `wyj-aboutToAppear`)
44 47
@@ -69,6 +72,7 @@ export struct DetailPlayLivePage { @@ -69,6 +72,7 @@ export struct DetailPlayLivePage {
69 TopPlayComponent({ playerController: this.playerController }) 72 TopPlayComponent({ playerController: this.playerController })
70 .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') 73 .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
71 74
  75 +
72 TabComponent({ 76 TabComponent({
73 tabs: this.tabs, 77 tabs: this.tabs,
74 changeToTab: this.changeToTab, 78 changeToTab: this.changeToTab,
@@ -83,7 +83,6 @@ export struct DetailPlayVLivePage { @@ -83,7 +83,6 @@ export struct DetailPlayVLivePage {
83 83
84 if (this.liveDetailPageLogic.showPad) { 84 if (this.liveDetailPageLogic.showPad) {
85 // 有垫片 85 // 有垫片
86 -  
87 if(this.liveDetailPageLogic.padImageUri.length > 0){ 86 if(this.liveDetailPageLogic.padImageUri.length > 0){
88 // 配置了垫片资源 87 // 配置了垫片资源
89 Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%') 88 Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%')
@@ -4,6 +4,8 @@ import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from ' @@ -4,6 +4,8 @@ import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from '
4 import { PlayUIComponent } from './PlayUIComponent'; 4 import { PlayUIComponent } from './PlayUIComponent';
5 import { PictureLoading } from '../../vertical/PictureLoading'; 5 import { PictureLoading } from '../../vertical/PictureLoading';
6 import { TrackConstants } from 'wdTracking/Index'; 6 import { TrackConstants } from 'wdTracking/Index';
  7 +import { LiveDetailPageLogic } from '../../../viewModel/LiveDetailPageLogic';
  8 +import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
7 9
8 const TAG: string = 'TopPlayComponent' 10 const TAG: string = 'TopPlayComponent'
9 11
@@ -32,6 +34,7 @@ export struct TopPlayComponent { @@ -32,6 +34,7 @@ export struct TopPlayComponent {
32 @Provide playSourceState: number = 0 34 @Provide playSourceState: number = 0
33 private playUrl: string = "" 35 private playUrl: string = ""
34 private xComponentIsLoaded: boolean = false 36 private xComponentIsLoaded: boolean = false
  37 + @Consume liveDetailPageLogic: LiveDetailPageLogic
35 38
36 aboutToAppear(): void { 39 aboutToAppear(): void {
37 if (this.playerController) { 40 if (this.playerController) {
@@ -66,6 +69,15 @@ export struct TopPlayComponent { @@ -66,6 +69,15 @@ export struct TopPlayComponent {
66 * 更新直播播放数据 69 * 更新直播播放数据
67 */ 70 */
68 updateData() { 71 updateData() {
  72 +
  73 + // 检测垫片
  74 + if (this.liveDetailPageLogic.showPad){
  75 + this.isHideLoading = true
  76 + this.isWait = true
  77 + this.previewUrl = this.liveDetailPageLogic.imgUrl
  78 + return
  79 + }
  80 +
69 // 检测直播等待状态的直播预告是否视频资源 81 // 检测直播等待状态的直播预告是否视频资源
70 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 82 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1
71 && this.contentDetailData?.liveInfo?.liveState == 'wait' 83 && this.contentDetailData?.liveInfo?.liveState == 'wait'
@@ -140,7 +152,8 @@ export struct TopPlayComponent { @@ -140,7 +152,8 @@ export struct TopPlayComponent {
140 this.previewUrl = '' 152 this.previewUrl = ''
141 } 153 }
142 } 154 }
143 - // Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd+' -->'+this.isVideoSource) 155 + Logger.debug(TAG,
  156 + `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd + ' -->' + this.isVideoSource)
144 } 157 }
145 158
146 tryToPlay() { 159 tryToPlay() {
@@ -163,6 +176,11 @@ export struct TopPlayComponent { @@ -163,6 +176,11 @@ export struct TopPlayComponent {
163 176
164 build() { 177 build() {
165 Stack() { 178 Stack() {
  179 +
  180 + if (this.liveDetailPageLogic.showPad) {
  181 +
  182 +
  183 + } else {
166 // 视频资源播放 184 // 视频资源播放
167 WDPlayerRenderLiveView({ 185 WDPlayerRenderLiveView({
168 playerController: this.playerController, 186 playerController: this.playerController,
@@ -179,6 +197,8 @@ export struct TopPlayComponent { @@ -179,6 +197,8 @@ export struct TopPlayComponent {
179 .height('100%') 197 .height('100%')
180 .width('100%') 198 .width('100%')
181 .visibility(this.isWait ? Visibility.None : Visibility.Visible) 199 .visibility(this.isWait ? Visibility.None : Visibility.Visible)
  200 + }
  201 +
182 202
183 if (this.isVideoSource) { 203 if (this.isVideoSource) {
184 204
@@ -187,10 +207,25 @@ export struct TopPlayComponent { @@ -187,10 +207,25 @@ export struct TopPlayComponent {
187 Image(this.previewUrl) 207 Image(this.previewUrl)
188 .objectFit(ImageFit.Cover) 208 .objectFit(ImageFit.Cover)
189 .alt($r('app.media.live_room_image_fail')) 209 .alt($r('app.media.live_room_image_fail'))
190 - .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)  
191 - // .contrast(this.isEnd ? 0.4 : 1) 210 + .visibility(this.isWait || this.isEnd ? Visibility.Visible :
  211 + Visibility.None)// .contrast(this.isEnd ? 0.4 : 1)
192 .blur(this.isEnd ? 20 : 0) 212 .blur(this.isEnd ? 20 : 0)
193 .width('100%') 213 .width('100%')
  214 +
  215 + if (this.liveDetailPageLogic.showPad) {
  216 + // 有垫片
  217 + if (this.liveDetailPageLogic.padImageUri.length > 0) {
  218 + // 配置了垫片资源
  219 + Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%')
  220 +
  221 + } else {
  222 + // 没有配置垫片资源
  223 + LiveEmptyComponent({
  224 + emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
  225 + }).width('100%').height('100%')
  226 + }
  227 +
  228 + }
194 } 229 }
195 230
196 // loading 231 // loading