File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 466
466
467
467
self . _suspendTimer = null ;
468
468
self . state = 'suspending' ;
469
- self . ctx . suspend ( ) . then ( function ( ) {
469
+
470
+ var handleSuspension = function ( ) {
470
471
self . state = 'suspended' ;
471
472
472
473
if ( self . _resumeAfterSuspend ) {
473
474
delete self . _resumeAfterSuspend ;
474
475
self . _autoResume ( ) ;
475
476
}
476
- } ) ;
477
+ } ;
478
+
479
+ // Either suspension is resolved or rejected (i.e. in case of interrupted state of audio context)
480
+ // the Howler's 'suspending' state needs to be updated.
481
+ self . ctx . suspend ( ) . then ( handleSuspension , handleSuspension ) ;
477
482
} , 30000 ) ;
478
483
479
484
return self ;
490
495
return ;
491
496
}
492
497
493
- if ( self . state === 'running' && self . _suspendTimer ) {
498
+ if ( self . state === 'running' && self . ctx . state !== 'interrupted' && self . _suspendTimer ) {
494
499
clearTimeout ( self . _suspendTimer ) ;
495
500
self . _suspendTimer = null ;
496
- } else if ( self . state === 'suspended' ) {
501
+ } else if ( self . state === 'suspended' || self . state === 'running' && self . ctx . state === 'interrupted' ) {
497
502
self . ctx . resume ( ) . then ( function ( ) {
498
503
self . state = 'running' ;
499
504
851
856
}
852
857
} ;
853
858
854
- if ( Howler . state === 'running' ) {
859
+ if ( Howler . state === 'running' && Howler . ctx . state !== 'interrupted' ) {
855
860
playWebAudio ( ) ;
856
861
} else {
857
862
self . _playLock = true ;
You can’t perform that action at this time.
0 commit comments