Showing
5 changed files
with
31 additions
and
37 deletions
| @@ -51,6 +51,8 @@ export struct DetailPlayVLivePage { | @@ -51,6 +51,8 @@ export struct DetailPlayVLivePage { | ||
| 51 | @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" | 51 | @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" |
| 52 | chatRoomController: LiveDetailChatRoomController = new LiveDetailChatRoomController() | 52 | chatRoomController: LiveDetailChatRoomController = new LiveDetailChatRoomController() |
| 53 | @Provide banComment: boolean = true | 53 | @Provide banComment: boolean = true |
| 54 | + /// null 直播流画面类型未知,0 横屏流,1 竖屏流,后台选择画面时,以选择的为准 | ||
| 55 | + @Provide isVerticalStream: boolean | null = this.liveDetailPageLogic.dealLiveStreamType() | ||
| 54 | 56 | ||
| 55 | dialogToast: CustomDialogController = new CustomDialogController({ | 57 | dialogToast: CustomDialogController = new CustomDialogController({ |
| 56 | builder: CustomToast({ | 58 | builder: CustomToast({ |
| @@ -109,4 +109,20 @@ export class LiveDetailPageLogic { | @@ -109,4 +109,20 @@ export class LiveDetailPageLogic { | ||
| 109 | return false | 109 | return false |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | + dealLiveStreamType(): boolean | null { | ||
| 113 | + if (this.contentDetailData.liveInfo.vlive && this.contentDetailData.liveInfo.vlive.count > 0) { | ||
| 114 | + const liveStreamType: number | null = this.contentDetailData.liveInfo.vlive[0].liveStreamType | ||
| 115 | + if (liveStreamType == null) { ///直播流画面类型位置 | ||
| 116 | + return null | ||
| 117 | + } | ||
| 118 | + if (liveStreamType == 1) { ///后台选择的竖屏流 | ||
| 119 | + return true | ||
| 120 | + } | ||
| 121 | + if (liveStreamType == 0) { ///后台选择的横屏流 | ||
| 122 | + return false | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + return true | ||
| 126 | + } | ||
| 127 | + | ||
| 112 | } | 128 | } |
| @@ -27,6 +27,7 @@ export struct PlayerComponent { | @@ -27,6 +27,7 @@ export struct PlayerComponent { | ||
| 27 | @Link isPlayerError: boolean | 27 | @Link isPlayerError: boolean |
| 28 | @Link isCanplay: boolean | 28 | @Link isCanplay: boolean |
| 29 | @State isLarge:boolean = false | 29 | @State isLarge:boolean = false |
| 30 | + @Consume isVerticalStream: boolean | ||
| 30 | pageShowChange() { | 31 | pageShowChange() { |
| 31 | this.playerController?.play() | 32 | this.playerController?.play() |
| 32 | } | 33 | } |
| @@ -54,13 +55,15 @@ export struct PlayerComponent { | @@ -54,13 +55,15 @@ export struct PlayerComponent { | ||
| 54 | 55 | ||
| 55 | } | 56 | } |
| 56 | this.playerController.onVideoSizePlayerComponentBack = (width: number, height: number) => { | 57 | this.playerController.onVideoSizePlayerComponentBack = (width: number, height: number) => { |
| 57 | - if(width>height){ | 58 | + if (this.isVerticalStream != null) { |
| 59 | + return | ||
| 60 | + } | ||
| 61 | + if (width > height) { | ||
| 58 | this.isLarge = false | 62 | this.isLarge = false |
| 59 | - if(width > 2){ | ||
| 60 | - this.liveStreamType = 0 | ||
| 61 | - } | ||
| 62 | - }else{ | 63 | + this.liveStreamType = 0 |
| 64 | + }else { | ||
| 63 | this.isLarge = true | 65 | this.isLarge = true |
| 66 | + this.liveStreamType = 1 | ||
| 64 | } | 67 | } |
| 65 | } | 68 | } |
| 66 | } | 69 | } |
| @@ -17,6 +17,7 @@ export struct PlayerUIComponent { | @@ -17,6 +17,7 @@ export struct PlayerUIComponent { | ||
| 17 | @Consume isFullScreen: boolean | 17 | @Consume isFullScreen: boolean |
| 18 | @Consume displayDirection: DisplayDirection | 18 | @Consume displayDirection: DisplayDirection |
| 19 | @State isPlayStatus: boolean = true; | 19 | @State isPlayStatus: boolean = true; |
| 20 | + @Consume isVerticalStream: boolean | null | ||
| 20 | onChangeMenuVisible() { | 21 | onChangeMenuVisible() { |
| 21 | if (this.displayDirection == DisplayDirection.VERTICAL | 22 | if (this.displayDirection == DisplayDirection.VERTICAL |
| 22 | || !this.isShowControl | 23 | || !this.isShowControl |
| @@ -38,6 +39,10 @@ export struct PlayerUIComponent { | @@ -38,6 +39,10 @@ export struct PlayerUIComponent { | ||
| 38 | return | 39 | return |
| 39 | } | 40 | } |
| 40 | this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => { | 41 | this.playerController.onVideoSizePlayerUIComponentMethod = (width: number, height: number) => { |
| 42 | + if (this.isVerticalStream != null) { | ||
| 43 | + this.isSmall = this.isVerticalStream == false | ||
| 44 | + return | ||
| 45 | + } | ||
| 41 | if (width > height){ | 46 | if (width > height){ |
| 42 | this.isSmall = true | 47 | this.isSmall = true |
| 43 | } else { | 48 | } else { |
| @@ -16,7 +16,6 @@ export struct PlayerVideoControlComponent { | @@ -16,7 +16,6 @@ export struct PlayerVideoControlComponent { | ||
| 16 | @Link isPlayStatus?: boolean | 16 | @Link isPlayStatus?: boolean |
| 17 | @Consume displayDirection: DisplayDirection | 17 | @Consume displayDirection: DisplayDirection |
| 18 | @Consume contentDetailData: ContentDetailDTO | 18 | @Consume contentDetailData: ContentDetailDTO |
| 19 | - @Consume isSmall:boolean | ||
| 20 | @Consume isFullScreen: boolean | 19 | @Consume isFullScreen: boolean |
| 21 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 20 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 22 | aboutToAppear(): void { | 21 | aboutToAppear(): void { |
| @@ -61,37 +60,6 @@ export struct PlayerVideoControlComponent { | @@ -61,37 +60,6 @@ export struct PlayerVideoControlComponent { | ||
| 61 | right: 16 | 60 | right: 16 |
| 62 | }) | 61 | }) |
| 63 | } | 62 | } |
| 64 | - //全屏按钮 | ||
| 65 | - // if(!this.isSmall) { | ||
| 66 | - // Image($r('app.media.icon_live_player_full_screen')) | ||
| 67 | - // .height(32) | ||
| 68 | - // .width(32) | ||
| 69 | - // .padding(5) | ||
| 70 | - // .borderRadius($r('app.float.vp_16')) | ||
| 71 | - // .border({width:0.5}) | ||
| 72 | - // .borderColor(0x4DFFFFFF) | ||
| 73 | - // .backgroundColor(0x4D222222) | ||
| 74 | - // .margin({right:10}) | ||
| 75 | - // .onClick(() => { | ||
| 76 | - // WindowModel.shared.setSpecificSystemBarEnabled(false) | ||
| 77 | - // this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL | ||
| 78 | - // WindowModel.shared.setPreferredOrientation( | ||
| 79 | - // window.Orientation.LANDSCAPE) | ||
| 80 | - // if(this.playerController){ | ||
| 81 | - // // if(this.playerController.onVideoSizePlayerUIComponentMethod){ | ||
| 82 | - // // this.playerController.onVideoSizePlayerUIComponentMethod(1,2) | ||
| 83 | - // // } | ||
| 84 | - // if(this.playerController.onVideoSizePlayerComponentBack){ | ||
| 85 | - // this.playerController.onVideoSizePlayerComponentBack(1,2) | ||
| 86 | - // } | ||
| 87 | - // | ||
| 88 | - // if(this.playerController.onVideoSizePlayerTitleComponentBack){ | ||
| 89 | - // this.playerController.onVideoSizePlayerTitleComponentBack(1,2) | ||
| 90 | - // } | ||
| 91 | - // } | ||
| 92 | - // this.isFullScreen = true | ||
| 93 | - // }) | ||
| 94 | - // } | ||
| 95 | } | 63 | } |
| 96 | .alignItems(VerticalAlign.Center) | 64 | .alignItems(VerticalAlign.Center) |
| 97 | // .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | 65 | // .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) |
-
Please register or login to post a comment