Showing
2 changed files
with
4 additions
and
2 deletions
| @@ -27,7 +27,7 @@ export class BackgroundAudioController { | @@ -27,7 +27,7 @@ export class BackgroundAudioController { | ||
| 27 | 27 | ||
| 28 | public gotContextFunc?: () => Context | 28 | public gotContextFunc?: () => Context |
| 29 | public avplayerController?: WDPlayerController | 29 | public avplayerController?: WDPlayerController |
| 30 | - private lastSession?: AVSessionManager.AVSession | 30 | + private lastSession?: AVSessionManager.AVSession | null |
| 31 | 31 | ||
| 32 | private applyedLongTaskPlay: boolean = false | 32 | private applyedLongTaskPlay: boolean = false |
| 33 | 33 | ||
| @@ -64,6 +64,7 @@ export class BackgroundAudioController { | @@ -64,6 +64,7 @@ export class BackgroundAudioController { | ||
| 64 | if (this.lastSession) { | 64 | if (this.lastSession) { |
| 65 | this.lastSession.deactivate(); | 65 | this.lastSession.deactivate(); |
| 66 | this.lastSession.destroy(); | 66 | this.lastSession.destroy(); |
| 67 | + this.lastSession = null | ||
| 67 | } | 68 | } |
| 68 | } | 69 | } |
| 69 | 70 |
| 1 | import { AudioSuspensionModel } from 'wdComponent' | 1 | import { AudioSuspensionModel } from 'wdComponent' |
| 2 | -import { PlayerConstants, DateFormatUtil } from 'wdPlayer' | 2 | +import { PlayerConstants, DateFormatUtil, BackgroundAudioController } from 'wdPlayer' |
| 3 | import { EmitterEventId, EmitterUtils, SPHelper } from 'wdKit/Index' | 3 | import { EmitterEventId, EmitterUtils, SPHelper } from 'wdKit/Index' |
| 4 | import window from '@ohos.window'; | 4 | import window from '@ohos.window'; |
| 5 | import lottie from '@ohos/lottie'; | 5 | import lottie from '@ohos/lottie'; |
| @@ -195,6 +195,7 @@ struct Index { | @@ -195,6 +195,7 @@ struct Index { | ||
| 195 | if (this.AudioSuspension.playerController) { | 195 | if (this.AudioSuspension.playerController) { |
| 196 | this.AudioSuspension.playerController.get().pause() | 196 | this.AudioSuspension.playerController.get().pause() |
| 197 | this.AudioSuspension.minimize() | 197 | this.AudioSuspension.minimize() |
| 198 | + BackgroundAudioController.sharedController().destorySession() | ||
| 198 | } | 199 | } |
| 199 | })) | 200 | })) |
| 200 | } | 201 | } |
-
Please register or login to post a comment