You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
1016 B

/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree.
*/
/* eslint-env node */
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shimGetUserMedia = shimGetUserMedia;
function shimGetUserMedia(window) {
var navigator = window && window.navigator;
var shimError_ = function shimError_(e) {
return {
name: { PermissionDeniedError: 'NotAllowedError' }[e.name] || e.name,
message: e.message,
constraint: e.constraint,
toString: function toString() {
return this.name;
}
};
};
// getUserMedia error shim.
var origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
navigator.mediaDevices.getUserMedia = function (c) {
return origGetUserMedia(c).catch(function (e) {
return Promise.reject(shimError_(e));
});
};
}