ref |> 调整播控中心进度条显示拖拽问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
2 changed files
with
11 additions
and
4 deletions
| @@ -95,7 +95,7 @@ export class BackgroundAudioController { | @@ -95,7 +95,7 @@ export class BackgroundAudioController { | ||
| 95 | let metadata: AVSessionManager.AVMetadata = { | 95 | let metadata: AVSessionManager.AVMetadata = { |
| 96 | assetId: assetId.length > 0 ? assetId : "fake-asset-id", | 96 | assetId: assetId.length > 0 ? assetId : "fake-asset-id", |
| 97 | title: title.length > 0 ? title : " ", | 97 | title: title.length > 0 ? title : " ", |
| 98 | - mediaImage: pixelMapImage ?? ("file://" + mediaImage.id), | 98 | + mediaImage: "https://cdnjdphoto.aikan.pdnews.cn/WapApi/800/launcher_icon.png" ,//pixelMapImage ?? ("file://" + mediaImage.id), |
| 99 | artist: artist.length > 0 ? artist : "人日日报", | 99 | artist: artist.length > 0 ? artist : "人日日报", |
| 100 | duration: duration | 100 | duration: duration |
| 101 | }; | 101 | }; |
| @@ -155,11 +155,14 @@ export class BackgroundAudioController { | @@ -155,11 +155,14 @@ export class BackgroundAudioController { | ||
| 155 | 155 | ||
| 156 | //设置进度,单位ms | 156 | //设置进度,单位ms |
| 157 | async setSessionPlayProgress(progressDuration: number, totalDuration: number) { | 157 | async setSessionPlayProgress(progressDuration: number, totalDuration: number) { |
| 158 | + this.setSessionPlayProgressForce(progressDuration, totalDuration, false) | ||
| 159 | + } | ||
| 160 | + async setSessionPlayProgressForce(progressDuration: number, totalDuration: number, force: boolean) { | ||
| 158 | if (totalDuration <= 0) { | 161 | if (totalDuration <= 0) { |
| 159 | return | 162 | return |
| 160 | } | 163 | } |
| 161 | let newProgress = progressDuration / totalDuration | 164 | let newProgress = progressDuration / totalDuration |
| 162 | - if (Math.abs(newProgress - this.lastProgress) < 0.01) { | 165 | + if (force == false && Math.abs(newProgress - this.lastProgress) < 0.01) { |
| 163 | return | 166 | return |
| 164 | } | 167 | } |
| 165 | // Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration); | 168 | // Logger.debug(TAG, `set progress: ` + progressDuration + " duration: " + totalDuration); |
| @@ -177,7 +180,7 @@ export class BackgroundAudioController { | @@ -177,7 +180,7 @@ export class BackgroundAudioController { | ||
| 177 | this.lastItemAssetId = undefined | 180 | this.lastItemAssetId = undefined |
| 178 | } | 181 | } |
| 179 | 182 | ||
| 180 | - if (this.hasSetupProgress) { | 183 | + if (force == false && this.hasSetupProgress) { |
| 181 | return | 184 | return |
| 182 | } | 185 | } |
| 183 | this.hasSetupProgress = true | 186 | this.hasSetupProgress = true |
| @@ -255,9 +258,9 @@ export class BackgroundAudioController { | @@ -255,9 +258,9 @@ export class BackgroundAudioController { | ||
| 255 | } else { | 258 | } else { |
| 256 | Logger.debug(TAG, `SetAVPlaybackState seek buffering`); | 259 | Logger.debug(TAG, `SetAVPlaybackState seek buffering`); |
| 257 | } | 260 | } |
| 258 | - | ||
| 259 | // 应用响应seek命令,使用应用内播放器完成seek实现 | 261 | // 应用响应seek命令,使用应用内播放器完成seek实现 |
| 260 | this.avplayerController?.setSeekMicroSecondsTime(position) | 262 | this.avplayerController?.setSeekMicroSecondsTime(position) |
| 263 | + this.setSessionPlayProgressForce(position, this.lastItemTotalDuration, true) | ||
| 261 | setTimeout(() => { | 264 | setTimeout(() => { |
| 262 | this.hasSetupProgress = false | 265 | this.hasSetupProgress = false |
| 263 | }, 1000) | 266 | }, 1000) |
| @@ -342,6 +342,10 @@ export class WDPlayerController { | @@ -342,6 +342,10 @@ export class WDPlayerController { | ||
| 342 | return; | 342 | return; |
| 343 | } | 343 | } |
| 344 | this.avPlayer?.seek(value); | 344 | this.avPlayer?.seek(value); |
| 345 | + | ||
| 346 | + if (this.status == PlayerConstants.STATUS_PAUSE) { | ||
| 347 | + this.avPlayer?.play() | ||
| 348 | + } | ||
| 345 | } | 349 | } |
| 346 | 350 | ||
| 347 | setBright() { | 351 | setBright() { |
-
Please register or login to post a comment