wangliang_wd

feat:增加动态详情页重播展示

... ... @@ -35,6 +35,7 @@ export struct WdWebLocalComponent {
@StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
@State isFullScreen: boolean = false;
@State isEndPlay: boolean = false;
currentChanged(){
///折叠屏转换 暂停播放器
this.controller.pause()
... ... @@ -213,6 +214,9 @@ export struct WdWebLocalComponent {
.controls(this.isFullScreen?true:false)
.autoPlay(true)
.objectFit(ImageFit.Contain)
.onFinish(()=>{
this.isEndPlay = true
})
.onStart(() => {
this.isPause = false
})
... ... @@ -239,57 +243,75 @@ export struct WdWebLocalComponent {
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
}
})
Row() {
Image(this.isPause ? $r('app.media.icon_play') : $r('app.media.icon_pause'))
.width(24)
.height(24)
.onClick(() => {
if (this.isPause) {
if (this.isEndPlay){
Column(){
Image($r('app.media.icon_replay')).width(40).height(40)
.onClick(() => {
this.isEndPlay = false
this.controller.start()
} else {
this.controller.pause()
}
})
Row() {
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
Slider({
value: this.currentTime,
min: 0,
max: this.durationTime
})
.width("50%")
.selectedColor('#ED2800')
.trackColor("#1AFFFFFF")
.trackThickness(2)
.margin({ left: 4, right: 4 })
.blockStyle({
type: SliderBlockType.IMAGE,
image: $r('app.media.slider_block')
})
.blockSize({ width: 18, height: 12 })
.onChange((value: number, mode: SliderChangeMode) => {
this.controller.setCurrentTime(value);
})
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
Text('重播').fontColor(Color.White).fontSize(14)
}
.backgroundColor(Color.Black)
.opacity(0.5)
.justifyContent(FlexAlign.Center)
.width(this.positionWidth)
.height(this.positionHeight)
}else {
Row() {
Image(this.isPause ? $r('app.media.icon_play') : $r('app.media.icon_pause'))
.width(24)
.height(24)
.onClick(() => {
if (this.isPause) {
this.controller.start()
} else {
this.controller.pause()
}
})
Row() {
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
Slider({
value: this.currentTime,
min: 0,
max: this.durationTime
})
.width("50%")
.selectedColor('#ED2800')
.trackColor("#1AFFFFFF")
.trackThickness(2)
.margin({ left: 4, right: 4 })
.blockStyle({
type: SliderBlockType.IMAGE,
image: $r('app.media.slider_block')
})
.blockSize({ width: 18, height: 12 })
.onChange((value: number, mode: SliderChangeMode) => {
this.controller.setCurrentTime(value);
})
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
}
.justifyContent(FlexAlign.Center)
// Image($r('app.media.icon_full_screen'))
// .width(24)
// .height(24)
// .onClick(() => {
// this.controller.requestFullscreen(true)
// })
// Image($r('app.media.icon_full_screen'))
// .width(24)
// .height(24)
// .onClick(() => {
// this.controller.requestFullscreen(true)
// })
}
.opacity(0.8)
.width("100%")
.justifyContent(FlexAlign.SpaceAround)
}
.opacity(0.8)
.width("100%")
.justifyContent(FlexAlign.SpaceAround)
}
}
... ...