liyubing

feat:直播详情 页面 ,正在直播的资源无需进度条

@@ -50,11 +50,6 @@ export struct DetailPlayLiveCommon { @@ -50,11 +50,6 @@ export struct DetailPlayLiveCommon {
50 50
51 } 51 }
52 52
53 - aboutToDisappear(): void {  
54 - console.error("XXXXZZZZ", '---aboutToDisappear------------')  
55 -  
56 - }  
57 -  
58 build() { 53 build() {
59 Column() { 54 Column() {
60 // 直播预约或横屏直播统一进横屏直播 55 // 直播预约或横屏直播统一进横屏直播
@@ -84,20 +79,16 @@ export struct DetailPlayLiveCommon { @@ -84,20 +79,16 @@ export struct DetailPlayLiveCommon {
84 if (data) { 79 if (data) {
85 let detailData = data[0] 80 let detailData = data[0]
86 //人民号类型单独获取直播地址 81 //人民号类型单独获取直播地址
87 - if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') {  
88 - 82 + if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') { //
89 let vliveId = detailData.liveInfo.vlive[0].vliveId as string 83 let vliveId = detailData.liveInfo.vlive[0].vliveId as string
90 - console.error(TAG, 'vliveId==' + vliveId)  
91 let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean 84 let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean
92 - console.error(TAG, 'vliveId==' + vliveId)  
93 if (pullStreamAddressData) { 85 if (pullStreamAddressData) {
94 - console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData)) 86 + // console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData))
95 let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url 87 let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
96 detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl 88 detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl
97 this.playUrl = m3u8uUrl 89 this.playUrl = m3u8uUrl
98 - console.log(TAG, ' GetPullAddressBean:', m3u8uUrl) 90 + // console.log(TAG, ' GetPullAddressBean:', m3u8uUrl)
99 } 91 }
100 -  
101 } 92 }
102 93
103 this.liveLandscape = 94 this.liveLandscape =
1 -import { ContentDetailDTO, 1 +import {
  2 + ContentDetailDTO,
2 GetPullAddressBean, 3 GetPullAddressBean,
3 - LiveDetailsBean, LiveRoomBean, LiveRoomDataBean, 4 + LiveDetailsBean,
  5 + LiveRoomBean,
  6 + LiveRoomDataBean,
4 LiveRoomItemBean, 7 LiveRoomItemBean,
5 - ValueType } from 'wdBean/Index' 8 + ValueType
  9 +} from 'wdBean/Index'
6 import { ContentDetailRequest } from 'wdDetailPlayApi/Index' 10 import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
7 import { Logger } from 'wdKit/Index' 11 import { Logger } from 'wdKit/Index'
8 import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils' 12 import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils'
@@ -25,26 +29,33 @@ export class LiveViewModel { @@ -25,26 +29,33 @@ export class LiveViewModel {
25 //console.error("XXXXZZZZ", '---getContentDetail---1------------') 29 //console.error("XXXXZZZZ", '---getContentDetail---1------------')
26 success(data) 30 success(data)
27 }).catch((message: string) => { 31 }).catch((message: string) => {
28 - // console.error("XXXXZZZZ", '----getContentDetail--2------------') 32 + // console.error("XXXXZZZZ", '----getContentDetail--2------------')
29 fail(message) 33 fail(message)
30 }) 34 })
31 }) 35 })
32 36
33 } 37 }
34 38
35 - async getLiveRoomPullAddress(vliveId:string) : Promise<GetPullAddressBean>{  
36 -  
37 - return new Promise<GetPullAddressBean>((success, fail) => {  
38 - ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {  
39 - console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))  
40 - if (resDTO.data) {  
41 - success(resDTO.data)  
42 - }else {  
43 - fail("数据为空")  
44 - }  
45 - }).catch(() => {  
46 - fail("数据为空")  
47 - }) 39 + /**
  40 + * 获取直播间的拉流地址
  41 + * @param vliveId
  42 + * @returns
  43 + */
  44 + async getLiveRoomPullAddress(vliveId: string): Promise<GetPullAddressBean | null> {
  45 +
  46 + return new Promise<GetPullAddressBean | null>((success, fail) => {
  47 + ContentDetailRequest.getLiveRoomPullStream(vliveId)
  48 + .then(async (resDTO: ResponseDTO<GetPullAddressBean>) => {
  49 + console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
  50 + if (resDTO.data) {
  51 + success(resDTO.data)
  52 + } else {
  53 + success(null)
  54 + }
  55 + })
  56 + .catch(() => {
  57 + success(null)
  58 + })
48 59
49 }) 60 })
50 61
@@ -104,6 +115,7 @@ export class LiveViewModel { @@ -104,6 +115,7 @@ export class LiveViewModel {
104 }) 115 })
105 }) 116 })
106 } 117 }
  118 +
107 // 直播详情-C端点赞接口 119 // 直播详情-C端点赞接口
108 getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) { 120 getLiveRoomNumberLike(liveId: string, number: number, deviceId: string | number) {
109 return new Promise<number>((success, fail) => { 121 return new Promise<number>((success, fail) => {
@@ -114,6 +126,7 @@ export class LiveViewModel { @@ -114,6 +126,7 @@ export class LiveViewModel {
114 }) 126 })
115 }) 127 })
116 } 128 }
  129 +
117 // 直播详情-查询是否点赞接口 130 // 直播详情-查询是否点赞接口
118 getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) { 131 getLiveLike(liveId: string, userId: ValueType, deviceId: string | number) {
119 return new Promise<boolean>((success, fail) => { 132 return new Promise<boolean>((success, fail) => {
@@ -279,10 +279,10 @@ export struct PlayUIComponent { @@ -279,10 +279,10 @@ export struct PlayUIComponent {
279 }) 279 })
280 } 280 }
281 281
  282 + // 进度条
282 if (this.contentDetailData.liveInfo?.liveState == 'running') { 283 if (this.contentDetailData.liveInfo?.liveState == 'running') {
283 Blank() 284 Blank()
284 } else { 285 } else {
285 - // 进度条  
286 this.playProgressView() 286 this.playProgressView()
287 } 287 }
288 288