zhenghy

解决竖屏直播黑屏

@@ -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,6 +33,7 @@ export struct PlayerTitleComponent { @@ -33,6 +33,7 @@ export struct PlayerTitleComponent {
33 33
34 @Builder 34 @Builder
35 getLiveStatusView() { 35 getLiveStatusView() {
  36 + if (this.liveDetailsBean.rmhInfo?.rmhName) {
36 Row() { 37 Row() {
37 Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') 38 Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '')
38 .width(24) 39 .width(24)
@@ -53,6 +54,8 @@ export struct PlayerTitleComponent { @@ -53,6 +54,8 @@ export struct PlayerTitleComponent {
53 .backgroundColor('#4D000000') 54 .backgroundColor('#4D000000')
54 .borderRadius(2) 55 .borderRadius(2)
55 .margin({ right: 8 }) 56 .margin({ right: 8 })
  57 + }
  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() {