Showing
2 changed files
with
25 additions
and
6 deletions
| @@ -68,7 +68,9 @@ export struct DetailPlayShortVideoPage { | @@ -68,7 +68,9 @@ export struct DetailPlayShortVideoPage { | ||
| 68 | this.queryNewsInfoOfUser() | 68 | this.queryNewsInfoOfUser() |
| 69 | if (this.switchVideoStatus && this.isPlay && this.onlyWifiLoadVideo) { | 69 | if (this.switchVideoStatus && this.isPlay && this.onlyWifiLoadVideo) { |
| 70 | await this.playerController.play() | 70 | await this.playerController.play() |
| 71 | - this.imageVisible = false | 71 | + await this.playerController.startRenderFrame(() => { |
| 72 | + this.imageVisible = false | ||
| 73 | + }) | ||
| 72 | } | 74 | } |
| 73 | } | 75 | } |
| 74 | } | 76 | } |
| @@ -81,7 +83,9 @@ export struct DetailPlayShortVideoPage { | @@ -81,7 +83,9 @@ export struct DetailPlayShortVideoPage { | ||
| 81 | if (this.currentIndex === this.index) { | 83 | if (this.currentIndex === this.index) { |
| 82 | if (this.switchVideoStatus && this.isPlay && this.onlyWifiLoadVideo) { | 84 | if (this.switchVideoStatus && this.isPlay && this.onlyWifiLoadVideo) { |
| 83 | await this.playerController.play() | 85 | await this.playerController.play() |
| 84 | - this.imageVisible = false | 86 | + await this.playerController.startRenderFrame(() => { |
| 87 | + this.imageVisible = false | ||
| 88 | + }) | ||
| 85 | } else { | 89 | } else { |
| 86 | this.playerController.pause() | 90 | this.playerController.pause() |
| 87 | } | 91 | } |
| @@ -106,14 +110,18 @@ export struct DetailPlayShortVideoPage { | @@ -106,14 +110,18 @@ export struct DetailPlayShortVideoPage { | ||
| 106 | this.playerController.onCanplay = async () => { | 110 | this.playerController.onCanplay = async () => { |
| 107 | this.ratio = this.playerController.videoWidth / this.playerController.videoHeight | 111 | this.ratio = this.playerController.videoWidth / this.playerController.videoHeight |
| 108 | await this.playerController.play() | 112 | await this.playerController.play() |
| 109 | - this.imageVisible = false | 113 | + await this.playerController.startRenderFrame(() => { |
| 114 | + this.imageVisible = false | ||
| 115 | + }) | ||
| 110 | } | 116 | } |
| 111 | } else { | 117 | } else { |
| 112 | if (!this.onlyWifiLoadVideo) { | 118 | if (!this.onlyWifiLoadVideo) { |
| 113 | await this.playerController.pause() | 119 | await this.playerController.pause() |
| 114 | } else { | 120 | } else { |
| 115 | await this.playerController.play() | 121 | await this.playerController.play() |
| 116 | - this.imageVisible = false | 122 | + await this.playerController.startRenderFrame(() => { |
| 123 | + this.imageVisible = false | ||
| 124 | + }) | ||
| 117 | } | 125 | } |
| 118 | } | 126 | } |
| 119 | } | 127 | } |
| @@ -186,7 +194,9 @@ export struct DetailPlayShortVideoPage { | @@ -186,7 +194,9 @@ export struct DetailPlayShortVideoPage { | ||
| 186 | await this.playerController.pause() | 194 | await this.playerController.pause() |
| 187 | } else { | 195 | } else { |
| 188 | await this.playerController.play() | 196 | await this.playerController.play() |
| 189 | - this.imageVisible = false | 197 | + await this.playerController.startRenderFrame(() => { |
| 198 | + this.imageVisible = false | ||
| 199 | + }) | ||
| 190 | } | 200 | } |
| 191 | } | 201 | } |
| 192 | } | 202 | } |
| @@ -363,7 +373,9 @@ export struct DetailPlayShortVideoPage { | @@ -363,7 +373,9 @@ export struct DetailPlayShortVideoPage { | ||
| 363 | this.onlyWifiLoadVideo = true | 373 | this.onlyWifiLoadVideo = true |
| 364 | this.toastTextVisible = false | 374 | this.toastTextVisible = false |
| 365 | this.playerController?.play() | 375 | this.playerController?.play() |
| 366 | - this.imageVisible = false | 376 | + this.playerController.startRenderFrame(() => { |
| 377 | + this.imageVisible = false | ||
| 378 | + }) | ||
| 367 | }) | 379 | }) |
| 368 | } | 380 | } |
| 369 | .width('100%') | 381 | .width('100%') |
| @@ -250,6 +250,13 @@ export class WDPlayerController { | @@ -250,6 +250,13 @@ export class WDPlayerController { | ||
| 250 | this.avPlayer?.play(); | 250 | this.avPlayer?.play(); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | + async startRenderFrame(cb: Function) { | ||
| 254 | + this.avPlayer?.on('startRenderFrame', () => { | ||
| 255 | + cb && cb(); | ||
| 256 | + console.info('startRenderFrame success') | ||
| 257 | + }) | ||
| 258 | + } | ||
| 259 | + | ||
| 253 | async stop() { | 260 | async stop() { |
| 254 | // if (this.avPlayer == null) { | 261 | // if (this.avPlayer == null) { |
| 255 | // await this.initPromise; | 262 | // await this.initPromise; |
-
Please register or login to post a comment