wuyanan

ref |> 处理竖屏直播竖屏流上下有黑边问题

1 import { ContentDetailDTO } from 'wdBean/Index'; 1 import { ContentDetailDTO } from 'wdBean/Index';
2 -import { AliPlayerRenderView, PlayerConstants, WDAliPlayerController, WDPlayerRenderVLiveView } from 'wdPlayer/Index'; 2 +import { AliPlayerRenderView,
  3 + AliScaleMode,
  4 + PlayerConstants, WDAliPlayerController, WDPlayerRenderVLiveView } from 'wdPlayer/Index';
3 import { ParamType, TrackConstants } from 'wdTracking/Index'; 5 import { ParamType, TrackConstants } from 'wdTracking/Index';
4 import { PictureLoading } from './PictureLoading'; 6 import { PictureLoading } from './PictureLoading';
5 7
@@ -59,6 +61,7 @@ export struct PlayerComponent { @@ -59,6 +61,7 @@ export struct PlayerComponent {
59 } 61 }
60 }else{ 62 }else{
61 this.isLarge = true 63 this.isLarge = true
  64 + this.playerController?.setScaleMode(AliScaleMode.SCALE_ASPECT_FILL)
62 } 65 }
63 } 66 }
64 } 67 }
@@ -12,7 +12,7 @@ export { SpeedBean } from "./src/main/ets/bean/SpeedBean" @@ -12,7 +12,7 @@ export { SpeedBean } from "./src/main/ets/bean/SpeedBean"
12 12
13 export { DateFormatUtil } from "./src/main/ets/utils/DateFormatUtil" 13 export { DateFormatUtil } from "./src/main/ets/utils/DateFormatUtil"
14 14
15 -export { WDAliPlayerController } from "./src/main/ets/controller/WDAliPlayerController" 15 +export { WDAliPlayerController, AliScaleMode } from "./src/main/ets/controller/WDAliPlayerController"
16 16
17 export { WDListPlayerData, WDAliListPlayerController } from "./src/main/ets/controller/WDAliListPlayerController" 17 export { WDListPlayerData, WDAliListPlayerController } from "./src/main/ets/controller/WDAliListPlayerController"
18 18
@@ -7,7 +7,8 @@ import { @@ -7,7 +7,8 @@ import {
7 paused, 7 paused,
8 stopped, 8 stopped,
9 completion, 9 completion,
10 - error 10 + error,
  11 + ScaleMode
11 } from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer'; 12 } from 'premierlibrary/src/main/ets/com/aliyun/player/IPlayer';
12 13
13 import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting'; 14 import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting';
@@ -18,6 +19,30 @@ import { ParamType, TrackingPlay } from 'wdTracking/Index'; @@ -18,6 +19,30 @@ import { ParamType, TrackingPlay } from 'wdTracking/Index';
18 19
19 const TAG = "WDAliPlayerController" 20 const TAG = "WDAliPlayerController"
20 21
  22 +export enum AliScaleMode {
  23 + /**
  24 + * 宽高比适应
  25 + */
  26 + /****
  27 + * Auto zoom to fit.
  28 + */
  29 + SCALE_ASPECT_FIT = 0,
  30 + /**
  31 + * 宽高比填充
  32 + */
  33 + /****
  34 + * Fill to fit.
  35 + */
  36 + SCALE_ASPECT_FILL,
  37 + /**
  38 + * 拉伸填充
  39 + */
  40 + /****
  41 + * Stretch to fit.
  42 + */
  43 + SCALE_TO_FILL
  44 +}
  45 +
21 /* 46 /*
22 * 此播放器为阿里播放器鸿蒙版本封装,可播放单个视频、或直播 47 * 此播放器为阿里播放器鸿蒙版本封装,可播放单个视频、或直播
23 * 列表上下滑场景用:WDListPlayerController 48 * 列表上下滑场景用:WDListPlayerController
@@ -95,6 +120,16 @@ export class WDAliPlayerController { @@ -95,6 +120,16 @@ export class WDAliPlayerController {
95 }); 120 });
96 } 121 }
97 122
  123 + public setScaleMode(mode: AliScaleMode) {
  124 + let m:ScaleMode = ScaleMode.SCALE_ASPECT_FIT
  125 + if (mode == AliScaleMode.SCALE_ASPECT_FILL) {
  126 + m = ScaleMode.SCALE_ASPECT_FILL
  127 + } else if (mode == AliScaleMode.SCALE_TO_FILL) {
  128 + m = ScaleMode.SCALE_TO_FILL
  129 + }
  130 + this.avPlayer?.setScaleMode(m)
  131 + }
  132 +
98 public destory() { 133 public destory() {
99 Logger.debug(TAG, "播放器销毁") 134 Logger.debug(TAG, "播放器销毁")
100 this.avPlayer?.stop() 135 this.avPlayer?.stop()