liyubing

feat:竖屏直播,进入竖屏直播,未设置垫片-竖屏流直播详情页,后台点击切换到垫片,主播暂时离开,马上回来 缺省图没有显示,看图

@@ -7,7 +7,7 @@ import { DetailPlayVLivePage } from './DetailPlayVLivePage'; @@ -7,7 +7,7 @@ import { DetailPlayVLivePage } from './DetailPlayVLivePage';
7 import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index'; 7 import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index';
8 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; 8 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
9 import { PictureLoading } from '../widgets/vertical/PictureLoading'; 9 import { PictureLoading } from '../widgets/vertical/PictureLoading';
10 -import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'; 10 +import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
11 import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic'; 11 import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
12 12
13 const TAG = 'DetailPlayLiveCommon' 13 const TAG = 'DetailPlayLiveCommon'
@@ -36,8 +36,7 @@ export struct DetailPlayLiveCommon { @@ -36,8 +36,7 @@ export struct DetailPlayLiveCommon {
36 @Provide liveStyle: number = -1 36 @Provide liveStyle: number = -1
37 // 直播地址 37 // 直播地址
38 @Provide playUrl: string = '' 38 @Provide playUrl: string = ''
39 - // // 直播间背景图  
40 - // @Provide imgUrl: string = '' 39 +
41 // 全屏展示 40 // 全屏展示
42 @Provide pageShow: number = -1 41 @Provide pageShow: number = -1
43 // 关闭全屏 42 // 关闭全屏
@@ -45,7 +44,6 @@ export struct DetailPlayLiveCommon { @@ -45,7 +44,6 @@ export struct DetailPlayLiveCommon {
45 // 返回功能 44 // 返回功能
46 @Provide pageBackPress: number = -1 45 @Provide pageBackPress: number = -1
47 46
48 -  
49 @Provide liveDetailPageLogic :LiveDetailPageLogic = new LiveDetailPageLogic 47 @Provide liveDetailPageLogic :LiveDetailPageLogic = new LiveDetailPageLogic
50 // 直播详情内容 48 // 直播详情内容
51 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 49 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@@ -106,20 +104,22 @@ export struct DetailPlayLiveCommon { @@ -106,20 +104,22 @@ export struct DetailPlayLiveCommon {
106 let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url 104 let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
107 detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl 105 detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl
108 this.playUrl = m3u8uUrl 106 this.playUrl = m3u8uUrl
109 - // console.log(TAG, ' GetPullAddressBean:', m3u8uUrl)  
110 } 107 }
111 } 108 }
112 109
113 -  
114 -  
115 this.liveState = detailData.liveInfo?.liveState 110 this.liveState = detailData.liveInfo?.liveState
116 111
117 this.contentDetailData = data[0] 112 this.contentDetailData = data[0]
118 113
119 this.liveDetailPageLogic.contentDetailData = this.contentDetailData 114 this.liveDetailPageLogic.contentDetailData = this.contentDetailData
  115 +
120 this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape 116 this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape
  117 +
121 this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState 118 this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState
122 - this.liveDetailPageLogic.resolvingRoomBackgroundImgUrl() 119 +
  120 + this.liveDetailPageLogic.resolvingRoomImgSource()
  121 +
  122 + this.liveDetailPageLogic.resolvingRoomVliveData(0)
123 123
124 this.publishCommentModel.targetId = String(detailData?.newsId || '') 124 this.publishCommentModel.targetId = String(detailData?.newsId || '')
125 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '') 125 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')
@@ -131,13 +131,6 @@ export struct DetailPlayLiveCommon { @@ -131,13 +131,6 @@ export struct DetailPlayLiveCommon {
131 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '') 131 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '')
132 this.publishCommentModel.commentContent = '' 132 this.publishCommentModel.commentContent = ''
133 this.liveStyle = detailData.liveInfo?.liveStyle 133 this.liveStyle = detailData.liveInfo?.liveStyle
134 - //  
135 - // if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&  
136 - // this.contentDetailData.liveInfo.previewUrl.length > 0) {  
137 - // this.imgUrl = this.contentDetailData.liveInfo.previewUrl  
138 - // } else if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) {  
139 - // this.imgUrl = detailData.fullColumnImgUrls[0].url  
140 - // }  
141 134
142 if (detailData.liveInfo.liveState == 'end') { 135 if (detailData.liveInfo.liveState == 'end') {
143 this.playUrl = detailData.liveInfo.vlive[0].replayUri 136 this.playUrl = detailData.liveInfo.vlive[0].replayUri
@@ -30,13 +30,12 @@ export struct DetailPlayVLivePage { @@ -30,13 +30,12 @@ export struct DetailPlayVLivePage {
30 @Consume liveState: string 30 @Consume liveState: string
31 @Consume liveStyle: number 31 @Consume liveStyle: number
32 @Consume playUrl: string 32 @Consume playUrl: string
33 - // @Consume imgUrl: string 33 + // @Consume imgUrl: string
34 @Consume @Watch('openFullScreen') pageShow: number 34 @Consume @Watch('openFullScreen') pageShow: number
35 @Consume @Watch('closeFullScreen') pageHide: number 35 @Consume @Watch('closeFullScreen') pageHide: number
36 @Consume contentId: string 36 @Consume contentId: string
37 @State swiperIndex: number = 1 37 @State swiperIndex: number = 1
38 -  
39 - @Consume liveDetailPageLogic :LiveDetailPageLogic 38 + @Consume liveDetailPageLogic: LiveDetailPageLogic
40 39
41 aboutToAppear(): void { 40 aboutToAppear(): void {
42 this.openFullScreen() 41 this.openFullScreen()
@@ -62,7 +61,7 @@ export struct DetailPlayVLivePage { @@ -62,7 +61,7 @@ export struct DetailPlayVLivePage {
62 61
63 build() { 62 build() {
64 63
65 - Stack() { 64 + Stack({ alignContent: Alignment.Top }) {
66 // 直播背景图,模糊处理 65 // 直播背景图,模糊处理
67 Image(this.liveDetailPageLogic.imgUrl) 66 Image(this.liveDetailPageLogic.imgUrl)
68 .height('100%') 67 .height('100%')
@@ -79,13 +78,34 @@ export struct DetailPlayVLivePage { @@ -79,13 +78,34 @@ export struct DetailPlayVLivePage {
79 LiveEmptyComponent({ 78 LiveEmptyComponent({
80 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend 79 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
81 }) 80 })
82 - .height('60%') 81 + .height('30%').margin({top:this.topSafeHeight })
83 } else { 82 } else {
84 - PlayerComponent({  
85 - playerController: this.playerController  
86 - }) 83 +
  84 + if (this.liveDetailPageLogic.showPad) {
  85 + // 有垫片
  86 +
  87 + if(this.liveDetailPageLogic.padImageUri.length > 0){
  88 + // 配置了垫片资源
  89 + Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%')
  90 +
  91 + }else {
  92 + // 没有配置垫片资源
  93 + LiveEmptyComponent({
  94 + emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
  95 + })
  96 + .height('30%').margin({top:this.topSafeHeight })
  97 + }
  98 +
  99 +
  100 + } else {
  101 + // 播放器
  102 + PlayerComponent({
  103 + playerController: this.playerController
  104 + })
  105 + }
87 } 106 }
88 107
  108 + // 直播详情 左右滑动业务数据
89 PlayerInfoComponent({ 109 PlayerInfoComponent({
90 playerController: this.playerController, 110 playerController: this.playerController,
91 swiperController: this.swiperController, 111 swiperController: this.swiperController,
1 import { ContentDetailDTO } from 'wdBean/Index' 1 import { ContentDetailDTO } from 'wdBean/Index'
2 2
3 - 3 +const TAG = 'LiveDetailPageLogic'
4 /** 4 /**
5 * 直播信息对象逻辑加工处理的工具类 5 * 直播信息对象逻辑加工处理的工具类
6 */ 6 */
@@ -14,6 +14,10 @@ export class LiveDetailPageLogic { @@ -14,6 +14,10 @@ export class LiveDetailPageLogic {
14 // 预告片图片/视频url 14 // 预告片图片/视频url
15 imgUrl: string = '' 15 imgUrl: string = ''
16 16
  17 + // 垫片资源
  18 + padImageUri:string = ''
  19 + // 垫片是否开启
  20 + showPad:boolean = false
17 21
18 22
19 /** 23 /**
@@ -42,15 +46,42 @@ export class LiveDetailPageLogic { @@ -42,15 +46,42 @@ export class LiveDetailPageLogic {
42 46
43 47
44 /** 48 /**
45 - * 解析背景图片资源 49 + * 解析直播间的图片资源
46 */ 50 */
47 - resolvingRoomBackgroundImgUrl() { 51 + resolvingRoomImgSource() {
48 52
  53 + // 背景图资源
49 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && 54 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
50 this.contentDetailData.liveInfo.previewUrl.length > 0) { 55 this.contentDetailData.liveInfo.previewUrl.length > 0) {
51 this.imgUrl = this.contentDetailData.liveInfo.previewUrl 56 this.imgUrl = this.contentDetailData.liveInfo.previewUrl
52 } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { 57 } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
53 this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url 58 this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url
54 } 59 }
  60 +
  61 + // 垫图资源
  62 + if (this.contentDetailData.liveInfo){
  63 +
  64 + if(this.contentDetailData.liveInfo.padImageUri.length > 0){
  65 + this.padImageUri =this.contentDetailData.liveInfo.padImageUri
  66 + }
  67 + //this.padImageUri = 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240515/image/display/cdb84fe86b1440d58f3fc585841b928d.jpg'
  68 +
  69 + }
  70 +
  71 + console.log(TAG, ' this.imgUrl===>', this.imgUrl)
  72 + }
  73 +
  74 + /**
  75 + * 解析直播详情里面的 vlive资源
  76 + * @param index
  77 + */
  78 + resolvingRoomVliveData(index:number){
  79 +
  80 + // 只有直播中的才会有垫片
  81 + if(this.liveState === 'running'){
  82 +
  83 + this.showPad = this.contentDetailData.liveInfo.vlive[index].showPad
  84 + }
  85 +
55 } 86 }
56 } 87 }