Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-10-30 10:00:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5206c5bec3ad9d3c3aef90da7781656d0ac6ee30
5206c5be
1 parent
56cdcaf3
feat:优化视频详情页转全屏问题
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderView.ets
sight_harmony/features/wdPlayer/src/main/ets/pages/WDPlayerRenderView.ets
View file @
5206c5b
...
...
@@ -4,6 +4,7 @@ import { Logger, WindowModel } from 'wdKit';
import { enableAliPlayer } from '../utils/GlobalSetting';
import json from '@ohos.util.json';
import { JSON } from '@kit.ArkTS';
import { window } from '@kit.ArkUI';
class Size {
width: Length = "100%";
...
...
@@ -159,13 +160,34 @@ export struct WDPlayerRenderView {
if (info.size.width > 0 && info.size.height > 0) {
if (!this.liftVideo) {
//解决全屏展示问题
const windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
const rect: window.Rect = windowClass.getWindowProperties().windowRect;
let ratio = this.videoWidth / this.videoHeight
const height = info.size.width / ratio
Logger.debug(TAG, "ratio = " + ratio + " ==> new height = " + height)
let width = rect.width
let height = rect.height
let playerWidth = 0
let playerHeight = 0
width = rect.width
height = rect.height
// 视频宽高比屏幕大,则宽度撑满
//console.log(`cj2024 ratio = ${this.ratio} width / height = ${width / height}`)
if (ratio > width / height) {
playerWidth = width
playerHeight = width / ratio
} else {
// 否则高度撑满
playerHeight = height
playerWidth = height * ratio
}
// const height = info.size.width / ratio
Logger.debug(TAG, "ratio = " + ratio + " ==> new height = " + playerHeight)
if (this.videoHeight > 0 && this.videoWidth > 0) {
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.width / this.videoRatio,
surfaceWidth: playerWidth,
surfaceHeight: playerHeight,
// offsetY: this.isPad ? this.topSafeHeight : (info.size.height - height) / 2
});
return
...
...
Please
register
or
login
to post a comment