Skip to content

Commit 7667e60

Browse files
committed
make duration available before sound is connected
1 parent 305f5b6 commit 7667e60

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/library/sound.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,18 +245,8 @@ export class PlayerSound implements ISound {
245245
}
246246

247247
public getDuration(): number {
248-
249-
let duration: number;
250-
251-
if (this.sourceNode !== null) {
252-
if (this.sourceNode instanceof AudioBufferSourceNode) {
253-
duration = this.audioBuffer.duration;
254-
} else if (this.sourceNode instanceof MediaElementAudioSourceNode) {
255-
duration = this.audioElement.duration;
256-
}
257-
}
258-
259-
return duration;
248+
249+
return this.duration;
260250

261251
}
262252

0 commit comments

Comments
 (0)