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

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

HarmonyOS
2024-11-13 11:14:52
浏览
收藏 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 
  })
分享
微博
QQ
微信
回复
2024-11-13 17:04:40
相关问题
使用AVPlayer实现视频播放
1603浏览 • 1回复 待解决
AVPlayer实现视频播放
1301浏览 • 1回复 待解决
avplayer播放视频demo
1931浏览 • 1回复 待解决
HarmonyOS AvPlayer视频播放速度问题
692浏览 • 1回复 待解决
HarmonyOS 视频播放AVPlayer解码异常
263浏览 • 1回复 待解决
HarmonyOS如何自定义视频组件样式
618浏览 • 1回复 待解决
自定义子 window 大小限制
1822浏览 • 1回复 待解决
ArkUI如何使用自定义字体
1105浏览 • 2回复 待解决
自定义弹窗大小如何自适应内容
2619浏览 • 1回复 待解决
HarmonyOS Progress 怎样自定义圆角大小
255浏览 • 1回复 待解决