xugenyuan

ref |> 解决视频宽高被缩小问题

@@ -403,7 +403,8 @@ export struct DetailPlayShortVideoPage { @@ -403,7 +403,8 @@ export struct DetailPlayShortVideoPage {
403 this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl, this.PageName, this.PageName, 403 this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl, this.PageName, this.PageName,
404 this.pageParam); 404 this.pageParam);
405 } 405 }
406 - } 406 + },
  407 + liftVideo: $showCommentList,
407 }) 408 })
408 .width(this.playerWidth) 409 .width(this.playerWidth)
409 .height(this.playerHeight) 410 .height(this.playerHeight)
@@ -49,6 +49,9 @@ export struct WDPlayerRenderView { @@ -49,6 +49,9 @@ export struct WDPlayerRenderView {
49 @State videoHeight: number = 9 49 @State videoHeight: number = 9
50 @State videoRatio: number = 16 / 9 50 @State videoRatio: number = 16 / 9
51 @State selfSize: Size = new Size('100%', '100%'); 51 @State selfSize: Size = new Size('100%', '100%');
  52 +
  53 + // 是否上推视频中
  54 + @Link liftVideo: boolean
52 private enableAliPlayer = false 55 private enableAliPlayer = false
53 56
54 aboutToAppear() { 57 aboutToAppear() {
@@ -61,7 +64,7 @@ export struct WDPlayerRenderView { @@ -61,7 +64,7 @@ export struct WDPlayerRenderView {
61 64
62 this.playerController.onVideoSizeChange = (width: number, height: number) => { 65 this.playerController.onVideoSizeChange = (width: number, height: number) => {
63 // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) 66 // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
64 - Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) 67 + Logger.info(TAG, ` onVideoSizeChange width:${width} height:${height}`)
65 this.videoWidth = width; 68 this.videoWidth = width;
66 this.videoHeight = height; 69 this.videoHeight = height;
67 this.videoRatio = width / height 70 this.videoRatio = width / height
@@ -127,6 +130,21 @@ export struct WDPlayerRenderView { @@ -127,6 +130,21 @@ export struct WDPlayerRenderView {
127 130
128 if (info.size.width > 0 && info.size.height > 0) { 131 if (info.size.width > 0 && info.size.height > 0) {
129 132
  133 + if (!this.liftVideo) {
  134 + if (this.videoHeight > 0 && this.videoWidth > 0) {
  135 + this.xComponentController.setXComponentSurfaceRect({
  136 + surfaceWidth: info.size.width,
  137 + surfaceHeight: info.size.width / this.videoRatio,
  138 + });
  139 + return
  140 + }
  141 + this.xComponentController.setXComponentSurfaceRect({
  142 + surfaceWidth: info.size.width,
  143 + surfaceHeight: info.size.height,
  144 + });
  145 + return
  146 + }
  147 +
130 // 竖屏 148 // 竖屏
131 if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) { 149 if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) {
132 let ratio = this.videoWidth / this.videoHeight 150 let ratio = this.videoWidth / this.videoHeight