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
chenjun
2024-08-08 19:01:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b8dd1de4d9cd43441e30f769cae6eef905319037
b8dd1de4
1 parent
b9cd8787
点击唤起进度控制条
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
3 deletions
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerFullScreenView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerFullScreenView.ets
View file @
b8dd1de
...
...
@@ -19,6 +19,10 @@ export struct PlayerFullScreenView {
private timer: number = -1
@State upProVal: string = ''
@State duration: string = DateTimeUtils.secondToTime(this.videoDuration)
@State startX:number = 0
@State endX:number = 0
@State panDirection:number = 1 //1左滑 2右滑
private panDistance:number = 0
getTitle() {
return this.contentDetailData?.newsTitle
...
...
@@ -65,6 +69,7 @@ export struct PlayerFullScreenView {
this.headerBuilder()
this.middleSlideBuilder()
// this.middleContainerBuilder()
this.bottomBuilder()
}
.zIndex(99999)
...
...
@@ -116,7 +121,6 @@ export struct PlayerFullScreenView {
})
}
@Builder
bottomBuilder() {
...
...
@@ -189,12 +193,88 @@ export struct PlayerFullScreenView {
}
@Builder
middleContainerBuilder() {
Row() {
}
.width('100%')
.height('100%')
.margin({ top: 73, bottom: 73 })
// .backgroundColor('#FF0000')
.onClick(() => {
Logger.warn(`cj2024 onClick showOperator=${this.showOperator}`)
if (!this.isDragging) {
if (this.showOperator == false) {
this.restartTimer();
} else {
this.showOperator = false
}
}
})
.gesture(
// 以下组合手势为顺序识别,当长按手势事件未正常触发时则不会触发拖动手势事件
GestureGroup(GestureMode.Sequence,
// TapGesture()
// .onAction((event?:GestureEvent) => {
// Logger.warn(`cj2024 TapGesture showOperator=${this.showOperator}`)
// if (this.showOperator == false) {
// this.restartTimer();
// } else {
// this.showOperator = false
// }
// }),
PanGesture()
.onActionStart((event?: GestureEvent) => {
if (event) {
this.startX = event.offsetX
}
Logger.warn(`cj2024 pan start`)
})
.onActionUpdate((event?: GestureEvent) => {
if (event) {
}
Logger.warn(`cj2024 pan update`)
})
.onActionEnd((event?: GestureEvent) => {
if (event) {
this.endX = event.offsetX
}
this.panDirection = this.endX - this.startX > 0 ? 2 : 1
Logger.warn(`cj2024 pan end panDirection = ${this.panDirection} this.progressVal = ${this.progressVal} dir=${this.endX - this.startX}`)
if (Math.abs(this.endX - this.startX) < 100) {
this.panDistance = 1
} else {
this.panDistance = Math.abs(this.endX - this.startX) / 100
}
if (this.panDirection == 1) { //左滑
if (this.progressVal > 5) {
this.progressVal -= this.panDistance
} else {
this.progressVal = 0
}
} else {
if (this.progressVal <100) {
this.progressVal += this.panDistance
} else {
this.progressVal = 100
}
}
Logger.warn(`cj2024 pan end panDistance = ${this.panDistance} this.progressVal = ${this.progressVal}`)
this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End);
})
)
)
}
@Builder
middleSlideBuilder() {
Column() {
Slider({
value: this.progressVal,
step: 0.01,
style: SliderStyle.
OutSet
style: SliderStyle.
NONE
})
.trackColor(Color.Transparent)// 设置轨道为透明
.selectedColor(Color.Transparent)// 设置已选择部分为透明
...
...
@@ -211,6 +291,7 @@ export struct PlayerFullScreenView {
}
if (mode === SliderChangeMode.End) {
this.isDragging = false
this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End);
}
console.log('Transparent slider value:', value)
...
...
@@ -222,8 +303,11 @@ export struct PlayerFullScreenView {
clearInterval(this.timer)
}
if (event.type === TouchType.Up) {
if (this.showOperator == false) {
this.restartTimer();
this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End);
} else {
this.showOperator = false
}
}
}
})
...
...
Please
register
or
login
to post a comment