webapis-user-media.ts 748 B

1234567891011121314151617181920
  1. /**
  2. * @license
  3. * Copyright Google Inc. All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. Zone.__load_patch('getUserMedia', (global: any, Zone: any, api: _ZonePrivate) => {
  9. function wrapFunctionArgs(func: Function, source?: string): Function {
  10. return function() {
  11. const args = Array.prototype.slice.call(arguments);
  12. const wrappedArgs = api.bindArguments(args, source ? source : (func as any).name);
  13. return func.apply(this, wrappedArgs);
  14. };
  15. }
  16. let navigator = global['navigator'];
  17. if (navigator && navigator.getUserMedia) {
  18. navigator.getUserMedia = wrapFunctionArgs(navigator.getUserMedia);
  19. }
  20. });