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
zhenghy
2024-05-31 10:33:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
530afc5f6b7894bc775f095d61dee05c80771e7c
530afc5f
1 parent
cddfe21b
视频折叠屏适配
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
530afc5
...
...
@@ -13,7 +13,7 @@ import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { DisplayDirection } from 'wdConstant/Index';
import { CommentDialogView } from '../view/CommentDialogView';
import { window } from '@kit.ArkUI';
import {
componentUtils,
window } from '@kit.ArkUI';
import { PlayerFullScreenView } from '../view/PlayerFullScreenView';
import { OperRowListView, publishCommentModel } from 'wdComponent/Index';
import { ParamType, TrackConstants } from 'wdTracking/Index';
...
...
@@ -207,14 +207,17 @@ export struct DetailPlayShortVideoPage {
* 屏幕变化动态计算播放器宽高
*/
calculatePlayerRect() {
let width = this.windowWidth
let height = this.windowHeight
const windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
const rect: window.Rect = windowClass.getWindowProperties().windowRect;
let width = rect.width
let height = rect.height
if (this.displayDirection === DisplayDirection.VERTICAL) {
width = this.windowWidth
height = this.windowHeight
width = rect.width
height = rect.height
} else {
width = this.windowHeight
height = this.windowWidth
width = rect.height
height = rect.width
}
// 视频宽高比屏幕大,则宽度撑满
if (this.ratio > width / height) {
...
...
@@ -225,7 +228,7 @@ export struct DetailPlayShortVideoPage {
this.playerHeight = '100%'
this.playerWidth = px2vp(height * this.ratio)
}
console.log('calculatePlayerRect=====',
this.windowWidth, this.windowH
eight)
console.log('calculatePlayerRect=====',
width, h
eight)
}
...
...
@@ -287,6 +290,7 @@ export struct DetailPlayShortVideoPage {
.width('100%')
}
.id('video-container')
.height('100%')
.width('100%')
.onAreaChange(() => this.calculatePlayerRect())
...
...
@@ -314,7 +318,9 @@ export struct DetailPlayShortVideoPage {
@Builder
playerViewBuilder() {
Stack({alignContent: this.showCommentList && this.index === this.currentIndex ? Alignment.Top : Alignment.Center}) {
Stack({
alignContent: this.showCommentList && this.index === this.currentIndex ? Alignment.Top : Alignment.Center
}) {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
...
...
Please
register
or
login
to post a comment