xugenyuan

ref |> 直播IM动态接收消息和显示。目前是横屏直播已处理

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -19,11 +19,11 @@ export interface LiveRoomItemBean { @@ -19,11 +19,11 @@ export interface LiveRoomItemBean {
19 //guest :嘉宾,host:主持人 19 //guest :嘉宾,host:主持人
20 role: string 20 role: string
21 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 21 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
22 - dataType: string 22 + dataType: LiveMessageOptType
23 //管理直播间的消息类型 ZH_BARRAGE_SWITCH_MSG:弹幕开关 ZH_TOP_MSG:置顶,ZH_UN_TOP_MSG:取消置顶 ZH_STOP_LIVE: 直播结束,ZH_CHANGE_PAD直播垫片等 23 //管理直播间的消息类型 ZH_BARRAGE_SWITCH_MSG:弹幕开关 ZH_TOP_MSG:置顶,ZH_UN_TOP_MSG:取消置顶 ZH_STOP_LIVE: 直播结束,ZH_CHANGE_PAD直播垫片等
24 - optionType: string 24 + optionType: LiveMessageOptType
25 ///房间类型,标识这个消息属于大家聊还是直播间,ZH_VIDEO:直播间 ZH_CHAT:大家聊 25 ///房间类型,标识这个消息属于大家聊还是直播间,ZH_VIDEO:直播间 ZH_CHAT:大家聊
26 - messageRoom: string 26 + messageRoom: LiveMessageRoomType
27 //视频封面图 27 //视频封面图
28 transcodeImageUrl: string 28 transcodeImageUrl: string
29 //视频地址 29 //视频地址
@@ -38,5 +38,37 @@ export interface LiveRoomItemBean { @@ -38,5 +38,37 @@ export interface LiveRoomItemBean {
38 fullColumnImgUrlDto: FullColumnImgUrlDTO 38 fullColumnImgUrlDto: FullColumnImgUrlDTO
39 //观看人次 39 //观看人次
40 pv: string 40 pv: string
  41 + // 自义定表情 - from im
  42 + customizeExpression: number
41 43
  44 + // 自定义字段
  45 + customFormIM?: boolean // 默认来自网络接口
  46 +}
  47 +
  48 +export enum LiveMessageOptType {
  49 + ZH_BARRAGE_SWITCH_MSG = "ZH_BARRAGE_SWITCH_MSG",
  50 + ZH_UPDATE_MSG = "ZH_UPDATE_MSG",
  51 + ZH_DELETE_MSG = "ZH_DELETE_MSG",
  52 + ZH_TOP_MSG = "ZH_TOP_MSG",
  53 + ZH_UN_TOP_MSG = "ZH_UN_TOP_MSG",
  54 + ZH_STOP_LIVE = "ZH_STOP_LIVE",
  55 + ZH_CHANGE_PAD = "ZH_CHANGE_PAD",
  56 + ZH_PRE_DISPLAY_CHANGE = "ZH_PRE_DISPLAY_CHANGE",
  57 + ZH_TEXT_MSG = "ZH_TEXT_MSG",
  58 + ZH_IMAGE_MSG = "ZH_IMAGE_MSG",
  59 + ZH_TEXT_AND_IMAGE_MSG = "ZH_TEXT_AND_IMAGE_MSG",
  60 + ZH_WALL_MSG = "ZH_WALL_MSG",
  61 + ZH_AUDIO_MSG = "ZH_AUDIO_MSG",
  62 + ZH_VIDEO_MSG = "ZH_VIDEO_MSG",
  63 + ZH_REPLY_MSG = "ZH_REPLY_MSG",
  64 + ZH_ROOM_NUMBER_MSG = "ZH_ROOM_NUMBER_MSG",
  65 + ZH_BARRAGE_BAN_MESSAGE = "ZH_BARRAGE_BAN_MESSAGE",
  66 + ZH_BARRAGE_UNBAN_MESSAGE = "ZH_BARRAGE_UNBAN_MESSAGE",
  67 + ZH_VOTE_MESSAGE = "ZH_VOTE_MESSAGE",
  68 + ZH_START_LIVE = "ZH_START_LIVE",
  69 +}
  70 +
  71 +export enum LiveMessageRoomType {
  72 + living = "ZH_VIDEO", // 直播间
  73 + chat = "ZH_CHAT", // 大家聊
42 } 74 }
1 import { DateTimeUtils, Logger } from 'wdKit/Index'; 1 import { DateTimeUtils, Logger } from 'wdKit/Index';
2 -import { WDPlayerController } from 'wdPlayer/Index'; 2 +import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index';
3 3
4 let TAG: string = 'AudioRowComponent' 4 let TAG: string = 'AudioRowComponent'
5 5
@@ -12,6 +12,16 @@ export struct AudioRowComponent { @@ -12,6 +12,16 @@ export struct AudioRowComponent {
12 @State isPlaying: boolean = false 12 @State isPlaying: boolean = false
13 13
14 aboutToAppear(): void { 14 aboutToAppear(): void {
  15 + this.playerController.onCanplay = () => {
  16 + this.playerController.play()
  17 + }
  18 + this.playerController.onStatusChange = (status: number) => {
  19 + if (status == PlayerConstants.STATUS_START) {
  20 + this.isPlaying = true
  21 + } else {
  22 + this.isPlaying = false
  23 + }
  24 + }
15 this.playerController.firstPlay(this.audioUrl) 25 this.playerController.firstPlay(this.audioUrl)
16 // this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) => { 26 // this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) => {
17 // console.log('现在时间', nowSeconds) 27 // console.log('现在时间', nowSeconds)
@@ -30,7 +40,7 @@ export struct AudioRowComponent { @@ -30,7 +40,7 @@ export struct AudioRowComponent {
30 left: 8, 40 left: 8,
31 right: 6 41 right: 6
32 }) 42 })
33 - .visibility(this.isPlaying ? Visibility.Visible : Visibility.Hidden) 43 + .visibility(this.isPlaying ? Visibility.Hidden : Visibility.Visible)
34 Text(`${DateTimeUtils.getFormattedDuration(this.duration)}`) 44 Text(`${DateTimeUtils.getFormattedDuration(this.duration)}`)
35 .fontColor('#666666') 45 .fontColor('#666666')
36 .fontWeight(400) 46 .fontWeight(400)
@@ -10,6 +10,8 @@ import { LiveRoomItemBean } from 'wdBean/Index'; @@ -10,6 +10,8 @@ import { LiveRoomItemBean } from 'wdBean/Index';
10 import { LiveRoomBaseInfo } from './LiveRoomBaseInfo' 10 import { LiveRoomBaseInfo } from './LiveRoomBaseInfo'
11 11
12 import { JSON } from '@kit.ArkTS'; 12 import { JSON } from '@kit.ArkTS';
  13 +import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean';
  14 +
13 const TAG = "LiveRoomManager" 15 const TAG = "LiveRoomManager"
14 16
15 export class LiveRoom extends ChatroomStatusListener { 17 export class LiveRoom extends ChatroomStatusListener {
@@ -32,7 +34,7 @@ export class LiveRoom extends ChatroomStatusListener { @@ -32,7 +34,7 @@ export class LiveRoom extends ChatroomStatusListener {
32 34
33 enterRoom() { 35 enterRoom() {
34 let roomId = this.connectRoomBaseInfo?.roomID 36 let roomId = this.connectRoomBaseInfo?.roomID
35 - let msgCount = 10; 37 + let msgCount = 0;
36 38
37 Logger.debug(TAG, `will enterRoom roomId: ${roomId}`); 39 Logger.debug(TAG, `will enterRoom roomId: ${roomId}`);
38 IMEngine.getInstance().joinExistingChatroom(roomId, msgCount).then(result => { 40 IMEngine.getInstance().joinExistingChatroom(roomId, msgCount).then(result => {
@@ -108,6 +110,7 @@ export class LiveRoom extends ChatroomStatusListener { @@ -108,6 +110,7 @@ export class LiveRoom extends ChatroomStatusListener {
108 let optionType = liveRoomItemBean.optionType != undefined ? liveRoomItemBean.optionType : liveRoomItemBean.dataType 110 let optionType = liveRoomItemBean.optionType != undefined ? liveRoomItemBean.optionType : liveRoomItemBean.dataType
109 111
110 if (this.isHistoryMessage(optionType)) { 112 if (this.isHistoryMessage(optionType)) {
  113 + liveRoomItemBean.customFormIM = true
111 if (this.onHistoryMessage) { 114 if (this.onHistoryMessage) {
112 this.onHistoryMessage(liveRoomItemBean) 115 this.onHistoryMessage(liveRoomItemBean)
113 } 116 }
@@ -124,11 +127,11 @@ export class LiveRoom extends ChatroomStatusListener { @@ -124,11 +127,11 @@ export class LiveRoom extends ChatroomStatusListener {
124 isHistoryMessage(optionType: string): boolean { 127 isHistoryMessage(optionType: string): boolean {
125 let isHistoryMessage = false 128 let isHistoryMessage = false
126 switch (optionType) { 129 switch (optionType) {
127 - case "ZH_TEXT_MSG":  
128 - case "ZH_IMAGE_MSG":  
129 - case "ZH_TEXT_AND_IMAGE_MSG":  
130 - case "ZH_AUDIO_MSG":  
131 - case "ZH_VIDEO_MSG": { 130 + case LiveMessageOptType.ZH_TEXT_MSG:
  131 + case LiveMessageOptType.ZH_IMAGE_MSG:
  132 + case LiveMessageOptType.ZH_TEXT_AND_IMAGE_MSG:
  133 + case LiveMessageOptType.ZH_AUDIO_MSG:
  134 + case LiveMessageOptType.ZH_VIDEO_MSG: {
132 isHistoryMessage = true 135 isHistoryMessage = true
133 } break; 136 } break;
134 default: 137 default:
@@ -12,6 +12,7 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment @@ -12,6 +12,7 @@ import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment
12 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; 12 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
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 16
16 let TAG: string = 'DetailPlayLivePage'; 17 let TAG: string = 'DetailPlayLivePage';
17 18
@@ -83,27 +84,31 @@ export struct DetailPlayLivePage { @@ -83,27 +84,31 @@ export struct DetailPlayLivePage {
83 if(!await onlyWifiLoadVideo()){ 84 if(!await onlyWifiLoadVideo()){
84 this.showToastTip(this.toastText) 85 this.showToastTip(this.toastText)
85 } 86 }
  87 + this.configChatRoom()
  88 + }
  89 +
  90 + async aboutToDisappear() {
  91 + Logger.info(TAG, `wyj-aboutToDisappear`)
  92 + await this.playerController?.stop()
  93 + await this.playerController?.release()
  94 + }
  95 +
  96 + configChatRoom() {
86 this.chatRoomController.onHistoryMessage = (liveRoomItemBean: LiveRoomItemBean) => { 97 this.chatRoomController.onHistoryMessage = (liveRoomItemBean: LiveRoomItemBean) => {
87 - if (liveRoomItemBean.messageRoom == "ZH_VIDEO") { 98 + if (liveRoomItemBean.messageRoom == LiveMessageRoomType.living) {
88 this.lastInputedLiveComment = liveRoomItemBean 99 this.lastInputedLiveComment = liveRoomItemBean
89 - } else if (liveRoomItemBean.messageRoom == "ZH_CHAT") { 100 + } else if (liveRoomItemBean.messageRoom == LiveMessageRoomType.chat) {
90 this.lastInputedChatComment = liveRoomItemBean 101 this.lastInputedChatComment = liveRoomItemBean
91 } 102 }
92 } 103 }
93 this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => { 104 this.chatRoomController.onLiveMessage = (liveRoomItemBean: LiveRoomItemBean) => {
94 - if (liveRoomItemBean.optionType == "ZH_ROOM_NUMBER_MSG") { 105 + if (liveRoomItemBean.optionType == LiveMessageOptType.ZH_ROOM_NUMBER_MSG) {
95 this.liveRoomDataBean.pv = Number(liveRoomItemBean.pv) 106 this.liveRoomDataBean.pv = Number(liveRoomItemBean.pv)
96 } 107 }
97 } 108 }
98 this.chatRoomController.configDetail(this.contentDetailData) 109 this.chatRoomController.configDetail(this.contentDetailData)
99 } 110 }
100 111
101 - async aboutToDisappear() {  
102 - Logger.info(TAG, `wyj-aboutToDisappear`)  
103 - await this.playerController?.stop()  
104 - await this.playerController?.release()  
105 - }  
106 -  
107 build() { 112 build() {
108 Column() { 113 Column() {
109 TopPlayComponent({ playerController: this.playerController }) 114 TopPlayComponent({ playerController: this.playerController })
1 -import { HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork'; 1 +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork';
2 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 2 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
3 import { Logger, ToastUtils, EmitterEventId, EmitterUtils, SPHelper } from 'wdKit'; 3 import { Logger, ToastUtils, EmitterEventId, EmitterUtils, SPHelper } from 'wdKit';
4 import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, 4 import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean,
@@ -6,6 +6,7 @@ import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, @@ -6,6 +6,7 @@ import { ContentDetailDTO, LiveDetailsBean, LiveRoomBean, LiveRoomDataBean,
6 ReserveItemBean, ValueType } from 'wdBean/Index'; 6 ReserveItemBean, ValueType } from 'wdBean/Index';
7 import { ContentDetailRequest } from 'wdDetailPlayApi/Index'; 7 import { ContentDetailRequest } from 'wdDetailPlayApi/Index';
8 import { SpConstants } from 'wdConstant/Index'; 8 import { SpConstants } from 'wdConstant/Index';
  9 +import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean';
9 10
10 const TAG = 'LiveModel' 11 const TAG = 'LiveModel'
11 12
@@ -113,7 +114,7 @@ export class LiveModel { @@ -113,7 +114,7 @@ export class LiveModel {
113 params['liveId'] = liveId 114 params['liveId'] = liveId
114 params['pageSize'] = pageSize + '' 115 params['pageSize'] = pageSize + ''
115 return new Promise<LiveRoomBean>((success, fail) => { 116 return new Promise<LiveRoomBean>((success, fail) => {
116 - HttpRequest.post<ResponseDTO<LiveRoomBean>>( 117 + HttpBizUtil.post<ResponseDTO<LiveRoomBean>>(
117 HttpUrlUtils.getLiveChatListUrl(), 118 HttpUrlUtils.getLiveChatListUrl(),
118 params, 119 params,
119 ).then((data: ResponseDTO<LiveRoomBean>) => { 120 ).then((data: ResponseDTO<LiveRoomBean>) => {
@@ -321,7 +322,7 @@ export class LiveModel { @@ -321,7 +322,7 @@ export class LiveModel {
321 let commentItem: LiveRoomItemBean = {} as LiveRoomItemBean 322 let commentItem: LiveRoomItemBean = {} as LiveRoomItemBean
322 commentItem.text = comment 323 commentItem.text = comment
323 commentItem.isWall = 0 324 commentItem.isWall = 0
324 - commentItem.dataType = "ZH_TEXT_MSG" 325 + commentItem.dataType = LiveMessageOptType.ZH_TEXT_MSG
325 326
326 let params: Record<string, string | number> = {}; 327 let params: Record<string, string | number> = {};
327 params["liveId"] = liveId 328 params["liveId"] = liveId
@@ -3,6 +3,7 @@ import { Logger, StringUtils } from 'wdKit/Index' @@ -3,6 +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 7
7 const TAG = "TabChatItemComponent" 8 const TAG = "TabChatItemComponent"
8 9
@@ -22,36 +23,9 @@ export struct TabChatItemComponent { @@ -22,36 +23,9 @@ export struct TabChatItemComponent {
22 .width(24) 23 .width(24)
23 .height(24) 24 .height(24)
24 Column() { 25 Column() {
25 - if (this.item.dataType == 'ZH_IMAGE_MSG') {  
26 Row() { 26 Row() {
27 Text() { 27 Text() {
28 - Span(this.item.senderUserName + ': ')  
29 - .fontColor('#666666')  
30 - }  
31 - .margin({ left: 8 })  
32 - .lineHeight(20)  
33 - .layoutWeight(1)  
34 - .fontSize('14fp')  
35 - .fontWeight(400)  
36 - }  
37 - .alignItems(VerticalAlign.Top)  
38 -  
39 - if (this.item.pictureUrls && this.item.pictureUrls.length > 0) {  
40 - Image(this.item.pictureUrls[0])  
41 - .width(`100%`)  
42 - .objectFit(ImageFit.Contain)  
43 - .borderRadius(4)  
44 - .margin({  
45 - top: 10  
46 - })  
47 - .onClick(() => {  
48 - this.gotoMultipleListImagePage(this.item.pictureUrls[0])  
49 - })  
50 - }  
51 - } else {  
52 - Row() {  
53 - Text() {  
54 - Span(this.item.senderUserName + ': ') 28 + Span((this.item.senderUserName ?? "游客") + ': ')
55 .fontColor('#666666') 29 .fontColor('#666666')
56 Span(this.item.text) 30 Span(this.item.text)
57 .fontColor('#222222') 31 .fontColor('#222222')
@@ -64,20 +38,18 @@ export struct TabChatItemComponent { @@ -64,20 +38,18 @@ export struct TabChatItemComponent {
64 } 38 }
65 .alignItems(VerticalAlign.Top) 39 .alignItems(VerticalAlign.Top)
66 40
67 - if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls &&  
68 - this.item.pictureUrls.length > 0) { 41 + if (this.item.pictureUrls && this.item.pictureUrls.length > 0) {
69 Image(this.item.pictureUrls[0]) 42 Image(this.item.pictureUrls[0])
70 - .width(`100%`) 43 + .width(this.item.customizeExpression === 1 ? 72 : `100%`)
71 .objectFit(ImageFit.Contain) 44 .objectFit(ImageFit.Contain)
72 .borderRadius(4) 45 .borderRadius(4)
73 .margin({ 46 .margin({
74 - top: 10 47 + top: 10, bottom: 4
75 }) 48 })
76 .onClick(() => { 49 .onClick(() => {
77 this.gotoMultipleListImagePage(this.item.pictureUrls[0]) 50 this.gotoMultipleListImagePage(this.item.pictureUrls[0])
78 }) 51 })
79 } 52 }
80 - }  
81 53
82 } 54 }
83 .margin({ 55 .margin({
@@ -10,6 +10,7 @@ import { LiveViewModel } from '../../viewModel/LiveViewModel' @@ -10,6 +10,7 @@ import { LiveViewModel } from '../../viewModel/LiveViewModel'
10 import { Logger } from 'wdKit' 10 import { Logger } from 'wdKit'
11 import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' 11 import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
12 import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData' 12 import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData'
  13 +import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
13 14
14 const TAG: string = 'TabLiveComponent'; 15 const TAG: string = 'TabLiveComponent';
15 16
@@ -34,7 +35,11 @@ export struct TabLiveComponent { @@ -34,7 +35,11 @@ export struct TabLiveComponent {
34 35
35 lastInputedCommentChanged(info: string) { 36 lastInputedCommentChanged(info: string) {
36 Logger.debug(TAG, "1显示评论》》》: " + JSON.stringify(this.lastInputedComment)) 37 Logger.debug(TAG, "1显示评论》》》: " + JSON.stringify(this.lastInputedComment))
  38 + if (this.liveList.totalCount() === 0) {
37 this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment)) 39 this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment))
  40 + } else {
  41 + this.liveList.addFirstItem(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment))
  42 + }
38 this.pageModel.viewType = ViewType.LOADED; 43 this.pageModel.viewType = ViewType.LOADED;
39 } 44 }
40 45
@@ -190,7 +195,7 @@ export struct TabLiveComponent { @@ -190,7 +195,7 @@ export struct TabLiveComponent {
190 liveRoomItemBeanTemp.senderUserName = '人民日报主持人' 195 liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
191 liveRoomItemBeanTemp.pictureUrls = [] 196 liveRoomItemBeanTemp.pictureUrls = []
192 liveRoomItemBeanTemp.pictureUrls.push(this.contentDetailData?.fullColumnImgUrls[0]?.url) 197 liveRoomItemBeanTemp.pictureUrls.push(this.contentDetailData?.fullColumnImgUrls[0]?.url)
193 - liveRoomItemBeanTemp.dataType = 'ZH_TEXT_AND_IMAGE_MSG' 198 + liveRoomItemBeanTemp.dataType = LiveMessageOptType.ZH_TEXT_AND_IMAGE_MSG
194 let temp = this.contentDetailData?.fullColumnImgUrls[0] 199 let temp = this.contentDetailData?.fullColumnImgUrls[0]
195 if (temp) { 200 if (temp) {
196 liveRoomItemBeanTemp.pictureResolutions = [] 201 liveRoomItemBeanTemp.pictureResolutions = []
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 { AudioRowComponent } from 'wdComponent/Index' 4 import { AudioRowComponent } from 'wdComponent/Index'
4 import { DateTimeUtils, StringUtils } from 'wdKit/Index' 5 import { DateTimeUtils, StringUtils } from 'wdKit/Index'
5 import { WDRouterRule } from 'wdRouter/Index' 6 import { WDRouterRule } from 'wdRouter/Index'
@@ -83,7 +84,7 @@ export struct TabLiveItemComponent { @@ -83,7 +84,7 @@ export struct TabLiveItemComponent {
83 .textAlign(TextAlign.Start) 84 .textAlign(TextAlign.Start)
84 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频 85 //ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
85 //图文 86 //图文
86 - if (this.item.dataType === 'ZH_TEXT_AND_IMAGE_MSG') { 87 + if (this.item.dataType === LiveMessageOptType.ZH_TEXT_AND_IMAGE_MSG) {
87 List({ space: this.item.pictureUrls.length == 1 ? 0 : 5 }) { 88 List({ space: this.item.pictureUrls.length == 1 ? 0 : 5 }) {
88 ForEach(this.item.pictureUrls, (itemSub: string, index: number) => { 89 ForEach(this.item.pictureUrls, (itemSub: string, index: number) => {
89 ListItem() { 90 ListItem() {
@@ -112,14 +113,14 @@ export struct TabLiveItemComponent { @@ -112,14 +113,14 @@ export struct TabLiveItemComponent {
112 }) 113 })
113 } 114 }
114 //音频 115 //音频
115 - else if (this.item.dataType === 'ZH_AUDIO_MSG') { 116 + else if (this.item.dataType === LiveMessageOptType.ZH_AUDIO_MSG) {
116 AudioRowComponent({ 117 AudioRowComponent({
117 audioUrl: this.item.audioUrl, 118 audioUrl: this.item.audioUrl,
118 duration: this.item.duration 119 duration: this.item.duration
119 }) 120 })
120 } 121 }
121 //视频 122 //视频
122 - else if (this.item.dataType === 'ZH_VIDEO_MSG') { 123 + else if (this.item.dataType === LiveMessageOptType.ZH_VIDEO_MSG) {
123 RelativeContainer() { 124 RelativeContainer() {
124 Image(this.item.transcodeImageUrl) 125 Image(this.item.transcodeImageUrl)
125 .width('100%') 126 .width('100%')
@@ -60,10 +60,10 @@ export class WDPlayerController { @@ -60,10 +60,10 @@ export class WDPlayerController {
60 */ 60 */
61 private createAVPlayer(): Promise<void> { 61 private createAVPlayer(): Promise<void> {
62 return new Promise((resolve, reject) => { 62 return new Promise((resolve, reject) => {
63 - Logger.error("开始创建") 63 + Logger.debug(TAG, "开始创建")
64 media.createAVPlayer().then((avPlayer) => { 64 media.createAVPlayer().then((avPlayer) => {
65 if (avPlayer) { 65 if (avPlayer) {
66 - Logger.error(TAG, "创建完成1") 66 + Logger.debug(TAG, "创建完成1")
67 this.avPlayer = avPlayer; 67 this.avPlayer = avPlayer;
68 this.bindState(); 68 this.bindState();
69 resolve(); 69 resolve();