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