xugenyuan

ref |> 处理直播上墙、回复消息、封禁、解封、预显控制、弹幕开关、结束直播、显示垫片控制

@@ -46,6 +46,14 @@ export interface LiveRoomItemBean { @@ -46,6 +46,14 @@ export interface LiveRoomItemBean {
46 senderUserId?: string 46 senderUserId?: string
47 // 未登录的设备id 47 // 未登录的设备id
48 deviceId?: string 48 deviceId?: string
  49 + // data字段,评论预显开关
  50 + data?: string
  51 + // receiver
  52 + receiverText?: string
  53 + receiverTime?: string
  54 + receiverUserId?: string
  55 + receiverUserName?: string
  56 + receiverAvatarUrl?: string
49 57
50 // 自定义字段 58 // 自定义字段
51 customFormIM?: boolean // 默认来自网络接口 59 customFormIM?: boolean // 默认来自网络接口
@@ -73,7 +73,7 @@ export struct LiveOperRowListView { @@ -73,7 +73,7 @@ export struct LiveOperRowListView {
73 private isLlive = false 73 private isLlive = false
74 /// comment 74 /// comment
75 @State showCommentInput: boolean = false 75 @State showCommentInput: boolean = false
76 - private banComment: boolean = true // 是否已禁言 76 + @Consume banComment: boolean // 上层可以直播IM控制
77 private commentInputDialogController?: CustomDialogController 77 private commentInputDialogController?: CustomDialogController
78 @State publishCommentModel: publishCommentModel = new publishCommentModel() 78 @State publishCommentModel: publishCommentModel = new publishCommentModel()
79 79
@@ -13,6 +13,7 @@ import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/I @@ -13,6 +13,7 @@ import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/I
13 import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg'; 13 import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg';
14 import { LiveDetailChatRoomController } from '../im/LiveDetailChatRoomController'; 14 import { LiveDetailChatRoomController } from '../im/LiveDetailChatRoomController';
15 import { LiveMessageOptType, LiveMessageRoomType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'; 15 import { LiveMessageOptType, LiveMessageRoomType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean';
  16 +import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
16 17
17 let TAG: string = 'DetailPlayLivePage'; 18 let TAG: string = 'DetailPlayLivePage';
18 19
@@ -41,9 +42,13 @@ export struct DetailPlayLivePage { @@ -41,9 +42,13 @@ export struct DetailPlayLivePage {
41 // 尽量不要动属性。用来作为输入了评论之后,值传递 42 // 尽量不要动属性。用来作为输入了评论之后,值传递
42 @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 43 @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
43 @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 44 @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
  45 + @State lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息
44 // 顶部状态栏高度 46 // 顶部状态栏高度
45 @Consume topSafeHeight: number 47 @Consume topSafeHeight: number
46 chatRoomController: LiveDetailChatRoomController = new LiveDetailChatRoomController() 48 chatRoomController: LiveDetailChatRoomController = new LiveDetailChatRoomController()
  49 + @Provide banComment: boolean = true
  50 + @State isEnd: boolean = false
  51 + @Consume liveDetailPageLogic: LiveDetailPageLogic
47 52
48 @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" 53 @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
49 dialogToast: CustomDialogController = new CustomDialogController({ 54 dialogToast: CustomDialogController = new CustomDialogController({
@@ -106,8 +111,49 @@ export struct DetailPlayLivePage { @@ -106,8 +111,49 @@ export struct DetailPlayLivePage {
106 } 111 }
107 } 112 }
108 this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => { 113 this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => {
109 - if (liveRoomItemBean.optionType == LiveMessageOptType.ZH_ROOM_NUMBER_MSG) {  
110 - this.liveRoomDataBean.pv = Number(liveRoomItemBean.pv) 114 + switch (liveRoomItemBean.optionType) {
  115 + case LiveMessageOptType.ZH_ROOM_NUMBER_MSG: {
  116 + this.liveRoomDataBean.pv = Number(liveRoomItemBean.pv)
  117 + } break
  118 + case LiveMessageOptType.ZH_BARRAGE_SWITCH_MSG: {
  119 + const openComment = liveRoomItemBean.data == "1"
  120 + this.contentDetailData.liveInfo.openComment = openComment ? 1 : 0
  121 + } break
  122 + case LiveMessageOptType.ZH_PRE_DISPLAY_CHANGE: {
  123 + const preCommentFlag = liveRoomItemBean.data == "1"
  124 + this.contentDetailData.liveInfo.preCommentFlag = preCommentFlag ? 1 : 0
  125 + } break
  126 + case LiveMessageOptType.ZH_BARRAGE_BAN_MESSAGE:
  127 + case LiveMessageOptType.ZH_BARRAGE_UNBAN_MESSAGE: {
  128 + const banComment = liveRoomItemBean.data == "1"
  129 + this.banComment = banComment
  130 + } break
  131 + case LiveMessageOptType.ZH_STOP_LIVE:
  132 + case LiveMessageOptType.ZH_START_LIVE:
  133 + case LiveMessageOptType.ZH_CHANGE_PAD: { // 直播垫片控制
  134 + this.lastLiveControl = liveRoomItemBean
  135 + } break
  136 + case LiveMessageOptType.ZH_REPLY_MSG: {
  137 + this.lastInputedChatComment = liveRoomItemBean
  138 + } break
  139 + case LiveMessageOptType.ZH_UPDATE_MSG: {
  140 + this.lastInputedLiveComment = liveRoomItemBean
  141 + } break
  142 + case LiveMessageOptType.ZH_DELETE_MSG: {
  143 + this.lastInputedLiveComment = liveRoomItemBean
  144 + } break
  145 + case LiveMessageOptType.ZH_TOP_MSG: {
  146 + this.lastInputedLiveComment = liveRoomItemBean
  147 + } break
  148 + case LiveMessageOptType.ZH_UN_TOP_MSG: {
  149 + this.lastInputedLiveComment = liveRoomItemBean
  150 + } break
  151 + case LiveMessageOptType.ZH_WALL_MSG: {
  152 + this.lastInputedLiveComment = liveRoomItemBean
  153 + } break
  154 + default: {
  155 + Logger.warn(TAG, "暂未处理类型:" + liveRoomItemBean.optionType)
  156 + } break
111 } 157 }
112 } 158 }
113 this.chatRoomController.configDetail(this.contentDetailData) 159 this.chatRoomController.configDetail(this.contentDetailData)
@@ -115,7 +161,7 @@ export struct DetailPlayLivePage { @@ -115,7 +161,7 @@ export struct DetailPlayLivePage {
115 161
116 build() { 162 build() {
117 Column() { 163 Column() {
118 - TopPlayComponent({ playerController: this.playerController }) 164 + TopPlayComponent({ playerController: this.playerController, isEnd: this.isEnd, lastLiveControl: this.lastLiveControl })
119 .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') 165 .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
120 .margin({ 166 .margin({
121 top: this.displayDirection == DisplayDirection.VERTICAL ? px2vp(this.topSafeHeight) : 0 167 top: this.displayDirection == DisplayDirection.VERTICAL ? px2vp(this.topSafeHeight) : 0
1 import { ContentDetailDTO, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index'; 1 import { ContentDetailDTO, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index';
2 import { LiveViewModel } from '../viewModel/LiveViewModel'; 2 import { LiveViewModel } from '../viewModel/LiveViewModel';
3 -import { CustomToast, WindowModel } from 'wdKit/Index'; 3 +import { CustomToast, Logger, WindowModel } from 'wdKit/Index';
4 import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; 4 import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
5 import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; 5 import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent';
6 import { WDAliPlayerController } from 'wdPlayer/Index'; 6 import { WDAliPlayerController } from 'wdPlayer/Index';
@@ -13,6 +13,7 @@ import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg'; @@ -13,6 +13,7 @@ import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg';
13 import { StringUtils } from 'wdKit'; 13 import { StringUtils } from 'wdKit';
14 import { LiveDetailChatRoomController } from '../im/LiveDetailChatRoomController'; 14 import { LiveDetailChatRoomController } from '../im/LiveDetailChatRoomController';
15 import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'; 15 import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean';
  16 +import { JSON } from '@kit.ArkTS';
16 17
17 const storage = LocalStorage.getShared(); 18 const storage = LocalStorage.getShared();
18 const TAG = 'DetailPlayVLivePage' 19 const TAG = 'DetailPlayVLivePage'
@@ -47,6 +48,7 @@ export struct DetailPlayVLivePage { @@ -47,6 +48,7 @@ export struct DetailPlayVLivePage {
47 @State isCanplay: boolean = false 48 @State isCanplay: boolean = false
48 @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" 49 @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗"
49 chatRoomController: LiveDetailChatRoomController = new LiveDetailChatRoomController() 50 chatRoomController: LiveDetailChatRoomController = new LiveDetailChatRoomController()
  51 + @Provide banComment: boolean = true
50 52
51 dialogToast: CustomDialogController = new CustomDialogController({ 53 dialogToast: CustomDialogController = new CustomDialogController({
52 builder: CustomToast({ 54 builder: CustomToast({
@@ -103,8 +105,35 @@ export struct DetailPlayVLivePage { @@ -103,8 +105,35 @@ export struct DetailPlayVLivePage {
103 this.lastInputedComment = liveRoomItemBean 105 this.lastInputedComment = liveRoomItemBean
104 } 106 }
105 this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => { 107 this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => {
106 - if (liveRoomItemBean.optionType == LiveMessageOptType.ZH_ROOM_NUMBER_MSG) {  
107 - this.liveRoomDataBean.pv = Number(liveRoomItemBean.pv) 108 + switch (liveRoomItemBean.optionType) {
  109 + case LiveMessageOptType.ZH_ROOM_NUMBER_MSG: {
  110 + this.liveRoomDataBean.pv = Number(liveRoomItemBean.pv)
  111 + } break
  112 + case LiveMessageOptType.ZH_BARRAGE_SWITCH_MSG: {
  113 + const openComment = liveRoomItemBean.data == "1"
  114 + this.contentDetailData.liveInfo.openComment = openComment ? 1 : 0
  115 + } break
  116 + case LiveMessageOptType.ZH_PRE_DISPLAY_CHANGE: {
  117 + const preCommentFlag = liveRoomItemBean.data == "1"
  118 + this.contentDetailData.liveInfo.preCommentFlag = preCommentFlag ? 1 : 0
  119 + } break
  120 + case LiveMessageOptType.ZH_BARRAGE_BAN_MESSAGE:
  121 + case LiveMessageOptType.ZH_BARRAGE_UNBAN_MESSAGE: {
  122 + const banComment = liveRoomItemBean.data == "1"
  123 + this.banComment = banComment
  124 + } break
  125 + case LiveMessageOptType.ZH_STOP_LIVE: {
  126 + this.liveState = "end"
  127 + this.contentDetailData.liveInfo.liveState = "end"
  128 + } break
  129 + case LiveMessageOptType.ZH_CHANGE_PAD: {
  130 + const padObj = JSON.parse(liveRoomItemBean.data ?? "") as Record<string, string | number | boolean>
  131 + const showPad = padObj["showPad"] == "1"
  132 + this.liveDetailPageLogic.showPad = showPad
  133 + } break
  134 + default: {
  135 + Logger.warn(TAG, "暂未处理类型:" + liveRoomItemBean.optionType)
  136 + } break
108 } 137 }
109 } 138 }
110 this.chatRoomController.configDetail(this.contentDetailData) 139 this.chatRoomController.configDetail(this.contentDetailData)
@@ -135,7 +164,7 @@ export struct DetailPlayVLivePage { @@ -135,7 +164,7 @@ export struct DetailPlayVLivePage {
135 // 有垫片 164 // 有垫片
136 if (this.liveDetailPageLogic.padImageUri.length > 0) { 165 if (this.liveDetailPageLogic.padImageUri.length > 0) {
137 // 配置了垫片资源 166 // 配置了垫片资源
138 - Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%') 167 + Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Contain).width('100%').height('100%')
139 168
140 } else { 169 } else {
141 // 没有配置垫片资源 170 // 没有配置垫片资源
@@ -220,4 +220,15 @@ export class LiveViewModel { @@ -220,4 +220,15 @@ export class LiveViewModel {
220 return false 220 return false
221 } 221 }
222 222
  223 + isMySelfComment(comment: LiveRoomItemBean) {
  224 + let mySelf = false
  225 + const userId = HttpUtils.getUserId()
  226 + const deviceId = HttpUtils.getDeviceId()
  227 + if (comment.senderUserId && comment.senderUserId == userId) {
  228 + mySelf = true
  229 + } else if (comment.deviceId && comment.deviceId == deviceId) {
  230 + mySelf = true
  231 + }
  232 + return mySelf
  233 + }
223 } 234 }
@@ -3,7 +3,7 @@ import { Logger, StringUtils } from 'wdKit/Index' @@ -3,7 +3,7 @@ import { Logger, StringUtils } from 'wdKit/Index'
3 // import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index' 3 // import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
4 import { WDRouterRule } from 'wdRouter' 4 import { WDRouterRule } from 'wdRouter'
5 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 5 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
6 -import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean' 6 +import { LiveMessageOptType, LiveMessageRole } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
7 7
8 const TAG = "TabChatItemComponent" 8 const TAG = "TabChatItemComponent"
9 9
@@ -23,20 +23,7 @@ export struct TabChatItemComponent { @@ -23,20 +23,7 @@ export struct TabChatItemComponent {
23 .width(24) 23 .width(24)
24 .height(24) 24 .height(24)
25 Column() { 25 Column() {
26 - Row() {  
27 - Text() {  
28 - Span((this.item.senderUserName ?? "游客") + ': ')  
29 - .fontColor('#666666')  
30 - Span(this.item.text)  
31 - .fontColor('#222222')  
32 - }  
33 - .margin({ left: 8 })  
34 - .lineHeight(20)  
35 - .layoutWeight(1)  
36 - .fontSize('14fp')  
37 - .fontWeight(400)  
38 - }  
39 - .alignItems(VerticalAlign.Top) 26 + this.messageContentText()
40 27
41 if (this.item.pictureUrls && this.item.pictureUrls.length > 0) { 28 if (this.item.pictureUrls && this.item.pictureUrls.length > 0) {
42 Image(this.item.pictureUrls[0]) 29 Image(this.item.pictureUrls[0])
@@ -68,6 +55,47 @@ export struct TabChatItemComponent { @@ -68,6 +55,47 @@ export struct TabChatItemComponent {
68 55
69 } 56 }
70 57
  58 + @Builder messageContentText() {
  59 + Row() {
  60 + Text() {
  61 +
  62 + if (this.item.receiverUserName && this.item.receiverUserName.length > 0) {
  63 + /// 回复的消息处理
  64 +
  65 + Span((this.item.senderUserName ?? "游客") + " ").fontColor('#2696FF')
  66 + if (this.item.role == LiveMessageRole.host) {
  67 + Span(' 主持人 ')
  68 + .fontSize(11)
  69 + .lineHeight(20)
  70 + .textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
  71 + Span(' ')
  72 + }
  73 + if (this.item.role == LiveMessageRole.guest) {
  74 + Span(' 嘉宾 ')
  75 + .fontSize(11)
  76 + .lineHeight(20)
  77 + .textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
  78 + Span(' ')
  79 + }
  80 + Span("回复了 ").fontColor('#222222')
  81 + Span((this.item.receiverUserName ?? "游客") + ': ').fontColor('#666666')
  82 + Span(this.item.text).fontColor('#222222')
  83 +
  84 + } else {
  85 + // 普通消息
  86 + Span((this.item.senderUserName ?? "游客") + ': ').fontColor('#666666')
  87 + Span(this.item.text).fontColor('#222222')
  88 + }
  89 + }
  90 + .margin({ left: 8 })
  91 + .lineHeight(20)
  92 + .layoutWeight(1)
  93 + .fontSize('14fp')
  94 + .fontWeight(400)
  95 + }
  96 + .alignItems(VerticalAlign.Top)
  97 + }
  98 +
71 /** 99 /**
72 * 大图列表页 100 * 大图列表页
73 * @param content 101 * @param content
@@ -35,6 +35,24 @@ export struct TabLiveComponent { @@ -35,6 +35,24 @@ export struct TabLiveComponent {
35 35
36 lastInputedCommentChanged(info: string) { 36 lastInputedCommentChanged(info: string) {
37 Logger.debug(TAG, "1显示评论》》》: " + JSON.stringify(this.lastInputedComment)) 37 Logger.debug(TAG, "1显示评论》》》: " + JSON.stringify(this.lastInputedComment))
  38 + switch (this.lastInputedComment.optionType) {
  39 + case LiveMessageOptType.ZH_UPDATE_MSG: {
  40 +
  41 + } break
  42 + case LiveMessageOptType.ZH_DELETE_MSG: {
  43 +
  44 + } break
  45 + case LiveMessageOptType.ZH_TOP_MSG: {
  46 +
  47 + } break
  48 + case LiveMessageOptType.ZH_UN_TOP_MSG: {
  49 +
  50 + } break
  51 + case LiveMessageOptType.ZH_WALL_MSG: {
  52 +
  53 + } break
  54 + }
  55 +
38 if (this.liveList.totalCount() === 0) { 56 if (this.liveList.totalCount() === 0) {
39 this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment)) 57 this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment))
40 } else { 58 } else {
1 import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index' 1 import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
3 -import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean' 3 +import { LiveMessageOptType, LiveMessageRole } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
4 import { AudioRowComponent } from 'wdComponent/Index' 4 import { AudioRowComponent } from 'wdComponent/Index'
5 import { DateTimeUtils, StringUtils } from 'wdKit/Index' 5 import { DateTimeUtils, StringUtils } from 'wdKit/Index'
6 import { WDRouterRule } from 'wdRouter/Index' 6 import { WDRouterRule } from 'wdRouter/Index'
@@ -155,6 +155,11 @@ export struct TabLiveItemComponent { @@ -155,6 +155,11 @@ export struct TabLiveItemComponent {
155 this.gotoVideoPlayPage() 155 this.gotoVideoPlayPage()
156 }) 156 })
157 } 157 }
  158 +
  159 + // 上墙或回复消息
  160 + else if (this.item.receiverUserName && this.item.receiverUserName.length > 0) {
  161 + this.wallOrReplySubMessage()
  162 + }
158 } 163 }
159 .margin({ 164 .margin({
160 left: 8, 165 left: 8,
@@ -234,4 +239,64 @@ export struct TabLiveItemComponent { @@ -234,4 +239,64 @@ export struct TabLiveItemComponent {
234 } 239 }
235 return 1 240 return 1
236 } 241 }
  242 +
  243 + // 上墙子消息
  244 + @Builder wallOrReplySubMessage() {
  245 + Row() {
  246 + Image(StringUtils.isEmpty(this.item.receiverAvatarUrl) ? $r('app.media.default_head') : this.item.receiverAvatarUrl)
  247 + .borderRadius(90)
  248 + .width(24)
  249 + .height(24)
  250 + Column() {
  251 + Row() {
  252 + Text() {
  253 + Span((this.item.receiverUserName ?? "游客") + ': ').fontColor('#666666')
  254 + }.lineHeight(20).fontSize('14fp').fontWeight(400)
  255 +
  256 + if (this.item.isWall == 1) {
  257 + Blank().layoutWeight(1)
  258 +
  259 + Text() {
  260 + Span(' 上墙 ')
  261 + .foregroundColor("#CB0000")
  262 + .fontSize(11)
  263 + .lineHeight(20)
  264 + .textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
  265 + }.lineHeight(20).fontSize('14fp').fontWeight(400)
  266 + }
  267 + }
  268 + .alignItems(VerticalAlign.Top)
  269 +
  270 + Text() {
  271 + Span(this.item.receiverText ?? "").fontColor('#222222')
  272 + }
  273 + .margin({top: 8})
  274 + .lineHeight(20)
  275 + .fontSize('14fp')
  276 + .fontWeight(400)
  277 +
  278 + if (this.item.pictureUrls && this.item.pictureUrls.length > 0) {
  279 + Image(this.item.pictureUrls[0])
  280 + .width(this.item.customizeExpression === 1 ? 72 : `100%`)
  281 + .objectFit(ImageFit.Contain)
  282 + .borderRadius(4)
  283 + .margin({
  284 + top: 10, bottom: 4
  285 + })
  286 + .onClick(() => {
  287 + this.gotoMultipleListImagePage(0)
  288 + })
  289 + }
  290 +
  291 + }
  292 + .margin({
  293 + left: 8,
  294 + right: 8
  295 + })
  296 + .layoutWeight(1)
  297 + .alignItems(HorizontalAlign.Start)
  298 + }
  299 + .alignItems(VerticalAlign.Top)
  300 + .padding({ top: 15 })
  301 + }
237 } 302 }
1 -import { ContentDetailDTO } from 'wdBean/Index'; 1 +import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index';
2 import { Logger, StringUtils } from 'wdKit/Index'; 2 import { Logger, StringUtils } from 'wdKit/Index';
3 import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; 3 import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
4 import { PlayUIComponent } from './PlayUIComponent'; 4 import { PlayUIComponent } from './PlayUIComponent';
@@ -6,6 +6,7 @@ import { PictureLoading } from '../../vertical/PictureLoading'; @@ -6,6 +6,7 @@ import { PictureLoading } from '../../vertical/PictureLoading';
6 import { TrackConstants } from 'wdTracking/Index'; 6 import { TrackConstants } from 'wdTracking/Index';
7 import { LiveDetailPageLogic } from '../../../viewModel/LiveDetailPageLogic'; 7 import { LiveDetailPageLogic } from '../../../viewModel/LiveDetailPageLogic';
8 import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; 8 import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
  9 +import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean';
9 10
10 const TAG: string = 'TopPlayComponent' 11 const TAG: string = 'TopPlayComponent'
11 12
@@ -23,7 +24,7 @@ export struct TopPlayComponent { @@ -23,7 +24,7 @@ export struct TopPlayComponent {
23 //未开始 24 //未开始
24 @State isWait: boolean = false 25 @State isWait: boolean = false
25 //已结束直播 26 //已结束直播
26 - @State isEnd: boolean = false 27 + @Link isEnd: boolean
27 //播放错误 28 //播放错误
28 @State isPlayerError: boolean = false 29 @State isPlayerError: boolean = false
29 // loading 控制字段 30 // loading 控制字段
@@ -38,6 +39,7 @@ export struct TopPlayComponent { @@ -38,6 +39,7 @@ export struct TopPlayComponent {
38 @Consume @Watch('pageShowChange') pageShow: number 39 @Consume @Watch('pageShowChange') pageShow: number
39 @Consume @Watch('pageHideChange') pageHide: number 40 @Consume @Watch('pageHideChange') pageHide: number
40 init: boolean = false 41 init: boolean = false
  42 + @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息
41 43
42 pageShowChange() { 44 pageShowChange() {
43 this.playerController?.play() 45 this.playerController?.play()
@@ -166,6 +168,27 @@ export struct TopPlayComponent { @@ -166,6 +168,27 @@ export struct TopPlayComponent {
166 // `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd + ' -->' + this.isVideoSource) 168 // `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd + ' -->' + this.isVideoSource)
167 } 169 }
168 170
  171 + liveIMControlMessageChange() {
  172 + switch (this.lastLiveControl.optionType) {
  173 + case LiveMessageOptType.ZH_STOP_LIVE: {
  174 + this.liveDetailPageLogic.showPad = false
  175 + this.contentDetailData.liveInfo.liveState = "end"
  176 + this.isEnd = true
  177 + }
  178 + break
  179 + case LiveMessageOptType.ZH_START_LIVE: {
  180 + // TODO:
  181 + }
  182 + break
  183 + case LiveMessageOptType.ZH_CHANGE_PAD: { // 直播垫片控制
  184 + const padObj = JSON.parse(this.lastLiveControl.data ?? "") as Record<string, string | number | boolean>
  185 + const showPad = padObj["showPad"] == "1"
  186 + this.liveDetailPageLogic.showPad = showPad
  187 + }
  188 + break
  189 + }
  190 + }
  191 +
169 tryToPlay() { 192 tryToPlay() {
170 193
171 if (!this.xComponentIsLoaded) { 194 if (!this.xComponentIsLoaded) {