Showing
3 changed files
with
31 additions
and
20 deletions
| @@ -13,6 +13,7 @@ export struct PlayerComponent { | @@ -13,6 +13,7 @@ export struct PlayerComponent { | ||
| 13 | @State imgUrl: string = '' | 13 | @State imgUrl: string = '' |
| 14 | @State isWait: boolean = false | 14 | @State isWait: boolean = false |
| 15 | @State liveStreamType: number | null = -1 | 15 | @State liveStreamType: number | null = -1 |
| 16 | + @State playUrl: string = '' | ||
| 16 | 17 | ||
| 17 | aboutToAppear(): void { | 18 | aboutToAppear(): void { |
| 18 | if (this.playerController) { | 19 | if (this.playerController) { |
| @@ -48,8 +49,10 @@ export struct PlayerComponent { | @@ -48,8 +49,10 @@ export struct PlayerComponent { | ||
| 48 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri | 49 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri |
| 49 | liveStreamType = this.liveDetailsBean.liveInfo.vlive[0].liveStreamType | 50 | liveStreamType = this.liveDetailsBean.liveInfo.vlive[0].liveStreamType |
| 50 | } | 51 | } |
| 52 | + | ||
| 51 | this.liveStreamType = liveStreamType | 53 | this.liveStreamType = liveStreamType |
| 52 | - this.playerController?.firstPlay(playUrl); | 54 | + this.playUrl = playUrl |
| 55 | + | ||
| 53 | } | 56 | } |
| 54 | } | 57 | } |
| 55 | 58 | ||
| @@ -60,12 +63,14 @@ export struct PlayerComponent { | @@ -60,12 +63,14 @@ export struct PlayerComponent { | ||
| 60 | .height('100%') | 63 | .height('100%') |
| 61 | .width('100%') | 64 | .width('100%') |
| 62 | .blur(100) | 65 | .blur(100) |
| 66 | + .renderFit(RenderFit.RESIZE_COVER) | ||
| 63 | 67 | ||
| 64 | // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,liveStreamType=0横屏正常展示 | 68 | // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,liveStreamType=0横屏正常展示 |
| 65 | if (this.liveStreamType == null) { | 69 | if (this.liveStreamType == null) { |
| 66 | WDPlayerRenderVLiveView({ | 70 | WDPlayerRenderVLiveView({ |
| 67 | playerController: this.playerController, | 71 | playerController: this.playerController, |
| 68 | onLoad: () => { | 72 | onLoad: () => { |
| 73 | + this.playerController?.firstPlay(this.playUrl); | ||
| 69 | } | 74 | } |
| 70 | }).height('100%') | 75 | }).height('100%') |
| 71 | .width('100%') | 76 | .width('100%') |
| @@ -73,6 +78,7 @@ export struct PlayerComponent { | @@ -73,6 +78,7 @@ export struct PlayerComponent { | ||
| 73 | WDPlayerRenderView({ | 78 | WDPlayerRenderView({ |
| 74 | playerController: this.playerController, | 79 | playerController: this.playerController, |
| 75 | onLoad: () => { | 80 | onLoad: () => { |
| 81 | + this.playerController?.firstPlay(this.playUrl); | ||
| 76 | } | 82 | } |
| 77 | }).padding({ top: 195 }) | 83 | }).padding({ top: 195 }) |
| 78 | } | 84 | } |
| @@ -33,26 +33,29 @@ export struct PlayerTitleComponent { | @@ -33,26 +33,29 @@ export struct PlayerTitleComponent { | ||
| 33 | 33 | ||
| 34 | @Builder | 34 | @Builder |
| 35 | getLiveStatusView() { | 35 | getLiveStatusView() { |
| 36 | - Row() { | ||
| 37 | - Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') | ||
| 38 | - .width(24) | ||
| 39 | - .aspectRatio(1) | ||
| 40 | - .borderRadius('50%') | ||
| 41 | - .fillColor(Color.Transparent) | ||
| 42 | - Text(this.liveDetailsBean.rmhInfo?.rmhName || '') | ||
| 43 | - .fontSize(12) | ||
| 44 | - .fontWeight(500) | ||
| 45 | - .fontColor(Color.White) | ||
| 46 | - .padding({ | ||
| 47 | - top: 2, | ||
| 48 | - right: 8, | ||
| 49 | - left: 4, | ||
| 50 | - bottom: 2 | ||
| 51 | - }) | 36 | + if (this.liveDetailsBean.rmhInfo?.rmhName) { |
| 37 | + Row() { | ||
| 38 | + Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') | ||
| 39 | + .width(24) | ||
| 40 | + .aspectRatio(1) | ||
| 41 | + .borderRadius('50%') | ||
| 42 | + .fillColor(Color.Transparent) | ||
| 43 | + Text(this.liveDetailsBean.rmhInfo?.rmhName || '') | ||
| 44 | + .fontSize(12) | ||
| 45 | + .fontWeight(500) | ||
| 46 | + .fontColor(Color.White) | ||
| 47 | + .padding({ | ||
| 48 | + top: 2, | ||
| 49 | + right: 8, | ||
| 50 | + left: 4, | ||
| 51 | + bottom: 2 | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + .backgroundColor('#4D000000') | ||
| 55 | + .borderRadius(2) | ||
| 56 | + .margin({ right: 8 }) | ||
| 52 | } | 57 | } |
| 53 | - .backgroundColor('#4D000000') | ||
| 54 | - .borderRadius(2) | ||
| 55 | - .margin({ right: 8 }) | 58 | + |
| 56 | 59 | ||
| 57 | Row() { | 60 | Row() { |
| 58 | if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | 61 | if (this.liveDetailsBean.liveInfo?.liveState == 'running') { |
| @@ -92,6 +92,7 @@ export struct WDPlayerRenderVLiveView { | @@ -92,6 +92,7 @@ export struct WDPlayerRenderVLiveView { | ||
| 92 | // .height(this.selfSize.height) | 92 | // .height(this.selfSize.height) |
| 93 | .height('100%') | 93 | .height('100%') |
| 94 | .width('100%') | 94 | .width('100%') |
| 95 | + .renderFit(RenderFit.RESIZE_COVER) | ||
| 95 | } | 96 | } |
| 96 | .id(this.insId) | 97 | .id(this.insId) |
| 97 | .onAreaChange(() => { | 98 | .onAreaChange(() => { |
| @@ -100,6 +101,7 @@ export struct WDPlayerRenderVLiveView { | @@ -100,6 +101,7 @@ export struct WDPlayerRenderVLiveView { | ||
| 100 | .backgroundColor("#000000") | 101 | .backgroundColor("#000000") |
| 101 | .height('100%') | 102 | .height('100%') |
| 102 | .width('100%') | 103 | .width('100%') |
| 104 | + .renderFit(RenderFit.RESIZE_COVER) | ||
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | updateLayout() { | 107 | updateLayout() { |
-
Please register or login to post a comment