Skip to content

Commit ec73fc1

Browse files
committed
fix position bug, added onStarted hook
1 parent c3d9900 commit ec73fc1

File tree

13 files changed

+273
-115
lines changed

13 files changed

+273
-115
lines changed

build/@types/web-audio-api-player/library/core.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export declare class PlayerCore {
3838
getVolume(): number;
3939
mute(): void;
4040
setPosition(soundPositionInPercent: number): void;
41+
setPositionInSeconds(soundPositionInSeconds: number): void;
4142
protected _loadSound(sound: ISound): Promise<ISound | PlayerError>;
4243
protected _decodeSound(sound: ISound, resolve: Function, reject: Function): void;
4344
play(whichSound?: number | string | undefined, playTimeOffset?: number): void;
@@ -46,9 +47,6 @@ export declare class PlayerCore {
4647
/**
4748
* whichSound is optional, if set it can be the sound id or if it's
4849
* a string it can be next / previous / first / last
49-
*
50-
* @param whichSound
51-
*
5250
*/
5351
protected _getSoundFromQueue(whichSound?: string | number, updateIndex?: boolean): ISound | null;
5452
protected _findSoundById(soundId: string | number, updateIndex: boolean): ISound | null;

build/@types/web-audio-api-player/library/sound.d.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ export interface IOnProgress {
99
export interface IOnEnded {
1010
(willPlayNext: boolean): void;
1111
}
12+
export interface IOnStarted {
13+
(): void;
14+
}
1215
export interface ISoundAttributes {
13-
sources: (ISoundSource | string)[] | string;
16+
sources?: (ISoundSource | string)[] | string;
1417
id: number;
1518
playlistId?: number | null;
1619
loop?: boolean;
1720
onLoading?: IOnProgress;
1821
onPlaying?: IOnProgress;
1922
onEnded?: IOnEnded;
23+
onStarted?: IOnStarted;
2024
audioBuffer?: AudioBuffer | null;
2125
arrayBuffer?: ArrayBuffer | null;
26+
duration?: number | null;
2227
}
2328
export interface ISound extends ISoundAttributes, IRequested {
2429
sourceNode: AudioBufferSourceNode | null;
@@ -34,7 +39,7 @@ export interface ISound extends ISoundAttributes, IRequested {
3439
isPlaying: boolean;
3540
sources: (ISoundSource | string)[];
3641
codec: string | null;
37-
duration: number;
42+
duration: number | null;
3843
}
3944
export interface IOptions {
4045
}
@@ -57,9 +62,10 @@ export declare class PlayerSound implements ISound {
5762
isPlaying: boolean;
5863
loadingProgress: number;
5964
codec: string;
60-
duration: number;
65+
duration: number | null;
6166
onLoading: IOnProgress;
6267
onPlaying: IOnProgress;
68+
onStarted: IOnStarted;
6369
onEnded: IOnEnded;
6470
constructor(soundAttributes: ISoundAttributes);
6571
}

build/index.js

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/library/audio.js

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/library/core.js

Lines changed: 63 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/library/error.js

Lines changed: 19 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/library/request.js

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)