File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,8 @@ export function play_in_tab(sound: Sound): Sound {
347
347
throw new Error ( `${ play_in_tab . name } : audio system still playing previous sound` ) ;
348
348
} else if ( get_duration ( sound ) < 0 ) {
349
349
throw new Error ( `${ play_in_tab . name } : duration of sound is negative` ) ;
350
+ } else if ( get_duration ( sound ) === 0 ) {
351
+ return sound ;
350
352
} else {
351
353
// Instantiate audio context if it has not been instantiated.
352
354
if ( ! audioplayer ) {
@@ -417,6 +419,8 @@ export function play(sound: Sound): Sound {
417
419
) ;
418
420
} else if ( get_duration ( sound ) < 0 ) {
419
421
throw new Error ( `${ play . name } : duration of sound is negative` ) ;
422
+ } else if ( get_duration ( sound ) === 0 ) {
423
+ return sound ;
420
424
} else {
421
425
// Instantiate audio context if it has not been instantiated.
422
426
if ( ! audioplayer ) {
Original file line number Diff line number Diff line change @@ -382,6 +382,8 @@ export function play_in_tab(sound: Sound): Sound {
382
382
throw new Error ( `${ play_in_tab . name } : audio system still playing previous sound` ) ;
383
383
} else if ( get_duration ( sound ) < 0 ) {
384
384
throw new Error ( `${ play_in_tab . name } : duration of sound is negative` ) ;
385
+ } else if ( get_duration ( sound ) === 0 ) {
386
+ return sound ;
385
387
} else {
386
388
// Instantiate audio context if it has not been instantiated.
387
389
if ( ! audioplayer ) {
@@ -478,6 +480,8 @@ export function play(sound: Sound): Sound {
478
480
throw new Error ( `${ play . name } : audio system still playing previous sound` ) ;
479
481
} else if ( get_duration ( sound ) < 0 ) {
480
482
throw new Error ( `${ play . name } : duration of sound is negative` ) ;
483
+ } else if ( get_duration ( sound ) === 0 ) {
484
+ return sound ;
481
485
} else {
482
486
// Instantiate audio context if it has not been instantiated.
483
487
if ( ! audioplayer ) {
You can’t perform that action at this time.
0 commit comments