Skip to content

feat: 补充player的codegen配置和continueToPlayInBackground属性的实现 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class RCTAudioPlayerTurboModule extends TurboModule {
onBackground() {
this.ctx.rnInstance.subscribeToLifecycleEvents('BACKGROUND', () => {
logger.debug(`app state is BACKGROUND`)
this.pauseOnBackground()
})
}
pauseOnBackground() {
Expand Down
6 changes: 6 additions & 0 deletions src/PlayerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ interface setOptions {
speed: boolean,
}

interface PlayInfo{
duration: number,
position: number
}

export interface Spec extends TurboModule {
/**
* Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
Expand Down Expand Up @@ -64,6 +69,7 @@ export interface Spec extends TurboModule {
removeListener(): void;
addListener(eventName: string): void;
removeListeners(count: Int32): void;
getCurrentTime(playerId: number, callback:(err: string, result?: PlayInfo) => void): void
}

const RCTAudioPlayer =
Expand Down