Skip to content

Commit 926e562

Browse files
committed
seekPercentage can be set through initial options
1 parent debfcc8 commit 926e562

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/library/sound.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export interface ISoundAttributes {
4848
audioBuffer?: AudioBuffer;
4949
arrayBuffer?: ArrayBuffer;
5050
duration?: number;
51+
seekPercentage: number;
5152

5253
// callbacks
5354
onLoading?: IOnProgress;
@@ -79,7 +80,6 @@ export interface ISound extends ISoundAttributes, ISoundSource {
7980
isConnectToPlayerGain: boolean;
8081
durationSetManually: boolean;
8182
elapsedPlayTime: number;
82-
seekPercentage: number;
8383
// methods
8484
getCurrentTime(): number;
8585
getDuration(): number;
@@ -155,6 +155,8 @@ export class PlayerSound implements ISound {
155155

156156
this.loop = soundAttributes.loop || false;
157157

158+
this.seekPercentage = soundAttributes.seekPercentage || 0;
159+
158160
// the user can set the duration manually
159161
// this is usefull if we need to convert the position percentage into seconds but don't want to preload the song
160162
// to get the duration the song has to get preloaded as the duration is a property of the audioBuffer
@@ -245,7 +247,7 @@ export class PlayerSound implements ISound {
245247
}
246248

247249
public getDuration(): number {
248-
250+
249251
return this.duration;
250252

251253
}

0 commit comments

Comments
 (0)