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-09 17:22:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a580551ffaa6fdcd3bef0273eea9d2201416d0e
1a580551
1 parent
4448d2c2
fix seek后滑块会回退
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
9 deletions
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerFullScreenView.ets
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerFullScreenView.ets
View file @
1a58055
...
...
@@ -19,10 +19,13 @@ 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
@State startX: number = 0
@State endX: number = 0
@State panDirection: number = 1 //1左滑 2右滑
private panDistance: number = 0
private touchDownX: number = 0
private touchUpX: number = 0
@State isTouched: boolean = false
getTitle() {
return this.contentDetailData?.newsTitle
...
...
@@ -156,11 +159,14 @@ export struct PlayerFullScreenView {
PlayerProgressFullScreenView({ playerController: this.playerController }).layoutWeight(1)
.onTouch((event?: TouchEvent) => {
if (event) {
if (event.type === TouchType.Down) {
// console.info(`cj2024 onTouch Down x=${event?.tiltX}`)
clearInterval(this.timer)
}
if (event.type === TouchType.Up) {
// console.info(`cj2024 onTouch Up x=${event?.tiltX}`)
this.restartTimer();
}
}
...
...
@@ -241,7 +247,8 @@ export struct PlayerFullScreenView {
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}`)
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 {
...
...
@@ -254,7 +261,7 @@ export struct PlayerFullScreenView {
this.progressVal = 0
}
} else {
if (this.progressVal <100) {
if (this.progressVal <
100) {
this.progressVal += this.panDistance
} else {
this.progressVal = 100
...
...
@@ -285,7 +292,11 @@ export struct PlayerFullScreenView {
.width('100%')
.height('100%')
.onChange((value: number, mode: SliderChangeMode) => {
// if (this.isTouched) {
// return
// }
this.progressVal = value
// console.log('cj2024 onChange slider value:', value)
if (mode === SliderChangeMode.Moving) {
this.isDragging = true
}
...
...
@@ -293,23 +304,36 @@ export struct PlayerFullScreenView {
this.isDragging = false
this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End);
}
console.log('Transparent slider value:', value)
})
}.margin({ top: 73, bottom: 73 })
.onTouch((event?: TouchEvent) => {
// console.log(`cj2024 onTouch isDragging = ${this.isDragging}`)
if (this.isDragging) {
return
}
if (event) {
if (event.type === TouchType.Down) {
// console.info(`cj2024 onTouch Down x=${event?.touches[0].x}`)
if (event?.touches.length > 0) {
this.touchDownX = event?.touches[0].x
}
clearInterval(this.timer)
}
if (event.type === TouchType.Up) {
// console.info(`cj2024 onTouch Up x=${event?.touches[0].x}`)
if (event?.touches.length > 0) {
this.touchUpX = event?.touches[0].x
this.isTouched = this.touchUpX == this.touchDownX ? true : false
}
if (this.showOperator == false) {
this.restartTimer();
} else {
if (this.isTouched) {
this.showOperator = false
}
}
}
}
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
View file @
1a58055
...
...
@@ -341,9 +341,12 @@ export class WDPlayerController {
// 100 / 1000));
}
if (mode === SliderChangeMode.End) {
// Logger.warn(`cj2024 seekTime = ${value}`)
// Logger.warn(`cj2024 duration = ${this.duration}`)
this.seekTime = Math.floor(value * this.duration / 100);
// Logger.warn(`cj2024 seekTime = ${this.seekTime}`)
this.currentPlayTime = this.seekTime
this.avPlayer?.seek(this.seekTime);
this.avPlayer?.seek(this.seekTime
,media.SeekMode.SEEK_CLOSEST
);
}
}
async setSeekMicroSecondsTime(value: number) {
...
...
Please
register
or
login
to post a comment