OLD | NEW |
(Empty) | |
| 1 (function(){ |
| 2 if( navigator.userAgent.toLowerCase().indexOf('edge') === -1 |
| 3 && navigator.userAgent.toLowerCase().indexOf('chrome') > -1){ |
| 4 |
| 5 if ( ( /chrome\/([0-9]*)\./.exec( navigator.userAgent.toLowerCase() )[1]
| 0 ) < 54 ) { |
| 6 |
| 7 // Work around https://bugs.chromium.org/p/chromium/issues/detail?id
=622956 |
| 8 // Chrome does not fire the empty keystatuschange event when a sessi
on is closed |
| 9 var _mediaKeySessionClose = MediaKeySession.prototype.close; |
| 10 var _mediaKeySessionKeyStatusesGetter = Object.getOwnPropertyDescrip
tor( MediaKeySession.prototype, 'keyStatuses' ).get; |
| 11 var _emptyMediaKeyStatusMap = { size: 0, |
| 12 has: function() { return false; }
, |
| 13 get: function() { return undefine
d; }, |
| 14 entries:function() { return []; },
// this may not be correct, I think it should be some iterator thing |
| 15 keys: function() { return []; }, |
| 16 values: function() { return []; }, |
| 17 forEach:function() { return; } }; |
| 18 |
| 19 MediaKeySession.prototype.close = function close() |
| 20 { |
| 21 this.__closed = true; |
| 22 |
| 23 setTimeout( function() { |
| 24 this.dispatchEvent( new Event( 'keystatuseschange' ) ); |
| 25 }.bind( this ), 0 ); |
| 26 |
| 27 return _mediaKeySessionClose.call( this ); |
| 28 }; |
| 29 |
| 30 Object.defineProperty( MediaKeySession.prototype, 'keyStatuses', { g
et: function() { |
| 31 |
| 32 return this.__closed ? _emptyMediaKeyStatusMap : _mediaKeySessio
nKeyStatusesGetter.call( this ); |
| 33 |
| 34 } } ); |
| 35 } |
| 36 } |
| 37 }()); |
OLD | NEW |