Showing
2 changed files
with
14 additions
and
4 deletions
| @@ -180,6 +180,8 @@ export interface LiveInfo { | @@ -180,6 +180,8 @@ export interface LiveInfo { | ||
| 180 | liveStyle: number; | 180 | liveStyle: number; |
| 181 | vlive: Array<Vlive> | 181 | vlive: Array<Vlive> |
| 182 | mlive: MLive | 182 | mlive: MLive |
| 183 | + // 背景图片先取这个? | ||
| 184 | + previewUrl: string | ||
| 183 | } | 185 | } |
| 184 | 186 | ||
| 185 | export interface MLive { | 187 | export interface MLive { |
| @@ -4,9 +4,11 @@ import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | @@ -4,9 +4,11 @@ import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | ||
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | import { Logger } from 'wdKit/Index'; | 5 | import { Logger } from 'wdKit/Index'; |
| 6 | 6 | ||
| 7 | +const TAG: string = 'TopPlayComponent' | ||
| 8 | + | ||
| 9 | + | ||
| 7 | @Component | 10 | @Component |
| 8 | export struct TopPlayComponent { | 11 | export struct TopPlayComponent { |
| 9 | - TAG: string = 'TopPlayComponent' | ||
| 10 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | 12 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean |
| 11 | playerController?: WDPlayerController | 13 | playerController?: WDPlayerController |
| 12 | @State imgUrl: string = '' | 14 | @State imgUrl: string = '' |
| @@ -25,8 +27,13 @@ export struct TopPlayComponent { | @@ -25,8 +27,13 @@ export struct TopPlayComponent { | ||
| 25 | 27 | ||
| 26 | updateData() { | 28 | updateData() { |
| 27 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | 29 | //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 |
| 28 | - if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | 30 | + if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) { |
| 31 | + this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl | ||
| 32 | + Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) | ||
| 33 | + } | ||
| 34 | + else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | ||
| 29 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url | 35 | this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url |
| 36 | + Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) | ||
| 30 | } | 37 | } |
| 31 | this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' | 38 | this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' |
| 32 | this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' && | 39 | this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' && |
| @@ -40,7 +47,7 @@ export struct TopPlayComponent { | @@ -40,7 +47,7 @@ export struct TopPlayComponent { | ||
| 40 | } | 47 | } |
| 41 | // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); | 48 | // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); |
| 42 | if (StringUtils.isNotEmpty(playUrl)) { | 49 | if (StringUtils.isNotEmpty(playUrl)) { |
| 43 | - Logger.debug('TopPlayComponent', `${playUrl}`) | 50 | + Logger.debug(TAG, `${playUrl}`) |
| 44 | this.playerController?.firstPlay(playUrl); | 51 | this.playerController?.firstPlay(playUrl); |
| 45 | } | 52 | } |
| 46 | } | 53 | } |
| @@ -57,9 +64,10 @@ export struct TopPlayComponent { | @@ -57,9 +64,10 @@ export struct TopPlayComponent { | ||
| 57 | .width('100%') | 64 | .width('100%') |
| 58 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) | 65 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) |
| 59 | Image(this.imgUrl) | 66 | Image(this.imgUrl) |
| 60 | - .objectFit(ImageFit.Contain) | 67 | + .objectFit(ImageFit.Cover) |
| 61 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | 68 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) |
| 62 | .contrast(this.isEnd ? 0.2 : 1) | 69 | .contrast(this.isEnd ? 0.2 : 1) |
| 70 | + .width('100%') | ||
| 63 | PlayUIComponent({ playerController: this.playerController }) | 71 | PlayUIComponent({ playerController: this.playerController }) |
| 64 | Text('直播已结束') | 72 | Text('直播已结束') |
| 65 | .fontSize('20fp') | 73 | .fontSize('20fp') |
-
Please register or login to post a comment