Skip to content

Commit

Permalink
Merge pull request #17 from fankw1/sig
Browse files Browse the repository at this point in the history
修复视频高度为0,修改按home 返回桌面,再返回后无法播放。
  • Loading branch information
GreatQin1 authored Jun 6, 2024
2 parents 33f1ece + 47d6e95 commit 44f149d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Binary file modified harmony/rn_video.har
Binary file not shown.
2 changes: 1 addition & 1 deletion harmony/rn_video/oh-package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "@react-native-oh-tpl/react-native-video",
"description": "main cpai architecture",
"main": "index.ets",
"version": "5.2.1-0.2.4",
"version": "5.2.1-0.2.5",
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony"
}
Expand Down
9 changes: 4 additions & 5 deletions harmony/rn_video/src/main/ets/RNCVideo.ets
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ export struct RNCVideo {
this.muted = this.descriptor.props.muted
this.paused = this.descriptor.props.paused
this.resizeMode = this.descriptor.props.resizeMode
if(this.resizeMode === 'cover')
{
this.videoHeight = this.viewHeight
}

this.repeat = this.descriptor.props.repeat
this.volume = this.descriptor.props.volume
this.srcParam = this.descriptor.props.src.uri
Expand All @@ -194,6 +189,10 @@ export struct RNCVideo {
this.viewHeight = this.descriptor.layoutMetrics.frame.size.height
this.changedViewWidth = this.viewWidth
this.changedviewHeight = this.viewHeight
if(this.resizeMode === 'cover')
{
this.videoHeight = this.viewHeight
}
}

/**
Expand Down
5 changes: 4 additions & 1 deletion harmony/rn_video/src/main/ets/view/PlayPlayer.ets
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ export struct PlayPlayer {
.height(this.videoHeight)
.scale(this.matrix)
.onVisibleAreaChange([0.0,1.0],(isVisble:boolean,currentRatio:number)=>{
if(!isVisble && currentRatio <=1.0){
if (isVisble && currentRatio >= 0.7) {
this.playVideoModel.switchPlayOrPause(false)
}
if (!isVisble && currentRatio <= 1.0) {
this.playVideoModel.pause()
}
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-native-oh-tpl/react-native-video",
"version": "5.2.1-0.2.4",
"version": "5.2.1-0.2.5",
"description": "A <Video /> element for react-native",
"harmony": {
"alias": "react-native-video"
Expand Down

0 comments on commit 44f149d

Please sign in to comment.