zhenghy

直播加载中页面与通顶

@@ -60,6 +60,7 @@ export struct DetailPlayVLivePage { @@ -60,6 +60,7 @@ export struct DetailPlayVLivePage {
60 .width('100%') 60 .width('100%')
61 .blur(100) 61 .blur(100)
62 .renderFit(RenderFit.RESIZE_COVER) 62 .renderFit(RenderFit.RESIZE_COVER)
  63 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
63 // 直播结束且无回看 64 // 直播结束且无回看
64 if (this.liveState === 'end' && !this.playUrl) { 65 if (this.liveState === 'end' && !this.playUrl) {
65 PlayerEndView() 66 PlayerEndView()
@@ -75,7 +76,6 @@ export struct DetailPlayVLivePage { @@ -75,7 +76,6 @@ export struct DetailPlayVLivePage {
75 playerController: this.playerController 76 playerController: this.playerController
76 }) 77 })
77 } 78 }
78 -  
79 PlayerInfoComponent({ 79 PlayerInfoComponent({
80 playerController: this.playerController, 80 playerController: this.playerController,
81 swiperController: this.swiperController, 81 swiperController: this.swiperController,
@@ -98,7 +98,7 @@ export struct DetailPlayVLivePage { @@ -98,7 +98,7 @@ export struct DetailPlayVLivePage {
98 } 98 }
99 .height('100%') 99 .height('100%')
100 .width('100%') 100 .width('100%')
101 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) 101 +
102 } 102 }
103 103
104 getLiveDetails() { 104 getLiveDetails() {
  1 +import { Logger } from 'wdKit';
  2 +
  3 +const TAG = 'PictureLoading';
  4 +
  5 +@Component
  6 +export struct PictureLoading {
  7 + private imagePath: string = ''
  8 + //alt app.media.picture_loading 设计稿尺寸
  9 + @State imageWidth: string | number = 167
  10 + @State ratio: number = 167 / 60
  11 +
  12 + async aboutToAppear() {
  13 + Logger.info(TAG, 'pictures preview')
  14 + }
  15 +
  16 + build() {
  17 + Row() {
  18 + Image(this.imagePath)
  19 + .alt($r('app.media.picture_loading'))
  20 + .width(this.imageWidth)
  21 + .aspectRatio(this.ratio)
  22 + .objectFit(ImageFit.Fill)
  23 + .interpolation(ImageInterpolation.High)
  24 + .onComplete((event) => {
  25 + if (event) {
  26 + this.imageWidth = '100%'
  27 + this.ratio = event.width / event.height
  28 + }
  29 +
  30 + })
  31 + }
  32 + .height('100%')
  33 + .width('100%')
  34 + .backgroundColor(Color.Black)
  35 + .justifyContent(FlexAlign.Center)
  36 + }
  37 +}
1 import { LiveDetailsBean } from 'wdBean/Index'; 1 import { LiveDetailsBean } from 'wdBean/Index';
2 import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; 2 import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index';
  3 +import { PictureLoading } from './PictureLoading';
3 4
4 const TAG = 'PlayerComponent' 5 const TAG = 'PlayerComponent'
5 6
@@ -15,6 +16,7 @@ export struct PlayerComponent { @@ -15,6 +16,7 @@ export struct PlayerComponent {
15 @State isWait: boolean = false 16 @State isWait: boolean = false
16 @State liveStreamType: number | null = -1 17 @State liveStreamType: number | null = -1
17 @State playUrl: string = '' 18 @State playUrl: string = ''
  19 + @State isCanplay: boolean = false
18 20
19 pageShowChange() { 21 pageShowChange() {
20 this.playerController?.play() 22 this.playerController?.play()
@@ -29,6 +31,7 @@ export struct PlayerComponent { @@ -29,6 +31,7 @@ export struct PlayerComponent {
29 this.playerController.onCanplay = () => { 31 this.playerController.onCanplay = () => {
30 console.log('可以播放了') 32 console.log('可以播放了')
31 this.playerController?.play() 33 this.playerController?.play()
  34 + this.isCanplay = true
32 } 35 }
33 } 36 }
34 37
@@ -66,9 +69,8 @@ export struct PlayerComponent { @@ -66,9 +69,8 @@ export struct PlayerComponent {
66 build() { 69 build() {
67 Column() { 70 Column() {
68 Stack() { 71 Stack() {
69 -  
70 // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,裁剪不拉伸,liveStreamType=0横屏正常展示 72 // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,裁剪不拉伸,liveStreamType=0横屏正常展示
71 - if (this.liveStreamType == null) { 73 + if (this.liveStreamType == null || this.liveStreamType == 1) {
72 WDPlayerRenderVLiveView({ 74 WDPlayerRenderVLiveView({
73 playerController: this.playerController, 75 playerController: this.playerController,
74 onLoad: () => { 76 onLoad: () => {
@@ -83,6 +85,8 @@ export struct PlayerComponent { @@ -83,6 +85,8 @@ export struct PlayerComponent {
83 } 85 }
84 }).margin({ top: 195 }).height(211) 86 }).margin({ top: 195 }).height(211)
85 } 87 }
  88 +
  89 + PictureLoading().visibility(this.isCanplay ? Visibility.None : Visibility.Visible)
86 } 90 }
87 .height('100%') 91 .height('100%')
88 .width('100%') 92 .width('100%')
@@ -12,7 +12,7 @@ export struct PlayerUIComponent { @@ -12,7 +12,7 @@ export struct PlayerUIComponent {
12 Stack() { 12 Stack() {
13 PlayerTitleComponent() 13 PlayerTitleComponent()
14 // Row() { 14 // Row() {
15 - // // 全屏按钮 15 + // // 全屏与暂停按钮
16 // }.layoutWeight(1) 16 // }.layoutWeight(1)
17 17
18 18
@@ -93,6 +93,7 @@ export struct WDPlayerRenderVLiveView { @@ -93,6 +93,7 @@ export struct WDPlayerRenderVLiveView {
93 .height('100%') 93 .height('100%')
94 .width('100%') 94 .width('100%')
95 .renderFit(RenderFit.RESIZE_COVER) 95 .renderFit(RenderFit.RESIZE_COVER)
  96 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
96 } 97 }
97 .id(this.insId) 98 .id(this.insId)
98 .onAreaChange(() => { 99 .onAreaChange(() => {