Showing
2 changed files
with
27 additions
and
9 deletions
| @@ -19,7 +19,7 @@ export struct VideoPlayPage { | @@ -19,7 +19,7 @@ export struct VideoPlayPage { | ||
| 19 | @State totalTime: string = '' | 19 | @State totalTime: string = '' |
| 20 | @State progressVal: number = 0; | 20 | @State progressVal: number = 0; |
| 21 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 21 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 22 | - | 22 | + @State isPlayEnd: boolean = false |
| 23 | 23 | ||
| 24 | aboutToAppear(): void { | 24 | aboutToAppear(): void { |
| 25 | let par: Action = router.getParams() as Action | 25 | let par: Action = router.getParams() as Action |
| @@ -35,6 +35,9 @@ export struct VideoPlayPage { | @@ -35,6 +35,9 @@ export struct VideoPlayPage { | ||
| 35 | this.playerController.onCanplay = () => { | 35 | this.playerController.onCanplay = () => { |
| 36 | this.playerController.play() | 36 | this.playerController.play() |
| 37 | } | 37 | } |
| 38 | + this.playerController.onStatusChange = (status: number) =>{ | ||
| 39 | + this.isPlayEnd = status === 5 ? true:false | ||
| 40 | + } | ||
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | build() { | 43 | build() { |
| @@ -55,6 +58,22 @@ export struct VideoPlayPage { | @@ -55,6 +58,22 @@ export struct VideoPlayPage { | ||
| 55 | this.getTopUIComponent() | 58 | this.getTopUIComponent() |
| 56 | Stack() | 59 | Stack() |
| 57 | .layoutWeight(1) | 60 | .layoutWeight(1) |
| 61 | + Column(){ | ||
| 62 | + Image($r('app.media.icon_live_player_replay')).width(40).height(40) | ||
| 63 | + .onClick(() => { | ||
| 64 | + this.progressVal = 0 | ||
| 65 | + this.isPlayEnd = false | ||
| 66 | + this.playerController.firstPlay(this.videoUrl) | ||
| 67 | + }) | ||
| 68 | + Text('重播').fontColor(Color.White).fontSize(14) | ||
| 69 | + } | ||
| 70 | + .justifyContent(FlexAlign.Center) | ||
| 71 | + .backgroundColor("#80000000") | ||
| 72 | + .width('100%') | ||
| 73 | + .height('60%') | ||
| 74 | + .visibility(this.isPlayEnd ? Visibility.Visible : Visibility.None) | ||
| 75 | + Stack() | ||
| 76 | + .layoutWeight(1) | ||
| 58 | this.getBottomUIComponent() | 77 | this.getBottomUIComponent() |
| 59 | } | 78 | } |
| 60 | } | 79 | } |
| @@ -82,17 +101,12 @@ export struct VideoPlayPage { | @@ -82,17 +101,12 @@ export struct VideoPlayPage { | ||
| 82 | .alignItems(VerticalAlign.Center) | 101 | .alignItems(VerticalAlign.Center) |
| 83 | .margin({ top: `${this.topSafeHeight}px` }) | 102 | .margin({ top: `${this.topSafeHeight}px` }) |
| 84 | }.width('100%') | 103 | }.width('100%') |
| 85 | - // .padding({ | ||
| 86 | - // top: 20, | ||
| 87 | - // bottom: 6, | ||
| 88 | - // left: 10, | ||
| 89 | - // right: 10 | ||
| 90 | - // }) | ||
| 91 | .alignItems(HorizontalAlign.Start) | 104 | .alignItems(HorizontalAlign.Start) |
| 92 | } | 105 | } |
| 93 | 106 | ||
| 94 | @Builder | 107 | @Builder |
| 95 | getBottomUIComponent() { | 108 | getBottomUIComponent() { |
| 109 | + Column(){ | ||
| 96 | Row() { | 110 | Row() { |
| 97 | this.playOrPauseBtn() | 111 | this.playOrPauseBtn() |
| 98 | Text(this.currentTime) | 112 | Text(this.currentTime) |
| @@ -112,14 +126,18 @@ export struct VideoPlayPage { | @@ -112,14 +126,18 @@ export struct VideoPlayPage { | ||
| 112 | }) | 126 | }) |
| 113 | } | 127 | } |
| 114 | .alignItems(VerticalAlign.Center) | 128 | .alignItems(VerticalAlign.Center) |
| 129 | + .height(40) | ||
| 115 | .width('100%') | 130 | .width('100%') |
| 131 | + .visibility(this.isPlayEnd ? Visibility.None:Visibility.Visible) | ||
| 116 | .padding({ | 132 | .padding({ |
| 117 | left: 10, | 133 | left: 10, |
| 118 | right: 10, | 134 | right: 10, |
| 119 | - top: 15, | ||
| 120 | - bottom: 15 | ||
| 121 | }) | 135 | }) |
| 122 | } | 136 | } |
| 137 | + .align(Alignment.Top) | ||
| 138 | + .height(64) | ||
| 139 | + .width('100%') | ||
| 140 | + } | ||
| 123 | 141 | ||
| 124 | @Builder | 142 | @Builder |
| 125 | playOrPauseBtn() { | 143 | playOrPauseBtn() { |
-
Please register or login to post a comment