HarmonyOS 在使用AVplayer中如何自定义播放视频的大小?

HarmonyOS 在使用AVplayer中如何自定义播放视频的大小?

HarmonyOS
2024-11-13 11:14:52
1519浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
superinsect

请参考demo:

XComponent({ 
  id: 'video_player_id', 
  type: XComponentType.SURFACE, 
  controller: this.mXComponentController 
}) 
  .border({ width: 1, color: Color.Red }) 
  .onLoad(() => { 
    this.surfaceId = this.mXComponentController.getXComponentSurfaceId() 
    this.xComponentContext = this.mXComponentController.getXComponentContext() as Record<string, () => void> 
    let surfaceRect: SurfaceRect = { 
      offsetX: 200, 
      offsetY: 200, 
      surfaceWidth: 5000, 
      surfaceHeight: 1000 
    } 
    this.mXComponentController.setXComponentSurfaceRect(surfaceRect) 
    this.rect = this.mXComponentController.getXComponentSurfaceRect() 
    this.player = new AVPlayerDemo(); 
    this.player.setSurfaceID(this.mXComponentController.getXComponentSurfaceId()); 
    this.player_changed = !this.player_changed; 
    this.player.avPlayerLiveDemo() 
  }) 
  .onTouchIntercept((event: TouchEvent) => { 
    console.log("OnTouchIntercept + " + JSON.stringify(event)); 
    return HitTestMode.None 
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
分享
微博
QQ
微信
回复
2024-11-13 17:04:40
相关问题
使用AVPlayer实现视频播放
2381浏览 • 1回复 待解决
AVPlayer实现视频播放
1998浏览 • 1回复 待解决
avplayer播放视频demo
3040浏览 • 1回复 待解决
HarmonyOS AvPlayer视频播放速度问题
1384浏览 • 1回复 待解决
HarmonyOS 视频播放AVPlayer解码异常
909浏览 • 1回复 待解决
HarmonyOS如何自定义视频组件样式
1226浏览 • 1回复 待解决
HarmonyOS Progress 怎样自定义圆角大小
766浏览 • 1回复 待解决
自定义子 window 大小限制
2220浏览 • 1回复 待解决
ArkUI如何使用自定义字体
1948浏览 • 2回复 待解决
自定义弹窗大小如何自适应内容
3257浏览 • 1回复 待解决
HarmonyOS 自定义视频控制器
868浏览 • 1回复 待解决