Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Adapter(options) {
// Chrome desktop, Chrome Android, Opera desktop, Opera Android, Android native browser
// or generic Webkit browser.
if (
(isDesktop && browser.chrome && browserVersion >= 32) ||
(browser.android && browser.chrome && browserVersion >= 39) ||
(isDesktop && browser.opera && browserVersion >= 27) ||
(browser.android && browser.opera && browserVersion >= 24) ||
(browser.android && browser.webkit && !browser.chrome && browserVersion >= 37) ||
(virtNavigator.webkitGetUserMedia && virtGlobal.webkitRTCPeerConnection)
) {
hasWebRTC = true;
getUserMedia = virtNavigator.webkitGetUserMedia.bind(virtNavigator);
RTCPeerConnection = virtGlobal.webkitRTCPeerConnection;
RTCSessionDescription = virtGlobal.RTCSessionDescription;
RTCIceCandidate = virtGlobal.RTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
if (MediaStreamTrack && MediaStreamTrack.getSources) {
getMediaDevices = MediaStreamTrack.getSources.bind(MediaStreamTrack);
} else if (virtNavigator.getMediaDevices) {
getMediaDevices = virtNavigator.getMediaDevices.bind(virtNavigator);
}
attachMediaStream = function (element, stream) {
element.src = URL.createObjectURL(stream);
function Adapter(options) {
// Chrome desktop, Chrome Android, Opera desktop, Opera Android, Android native browser
// or generic Webkit browser.
if (
(isDesktop && browser.chrome && browserVersion >= 32) ||
(browser.android && browser.chrome && browserVersion >= 39) ||
(isDesktop && browser.opera && browserVersion >= 27) ||
(browser.android && browser.opera && browserVersion >= 24) ||
(browser.android && browser.webkit && !browser.chrome && browserVersion >= 37) ||
(virtNavigator.webkitGetUserMedia && virtGlobal.webkitRTCPeerConnection)
) {
hasWebRTC = true;
getUserMedia = virtNavigator.webkitGetUserMedia.bind(virtNavigator);
mediaDevices = virtNavigator.mediaDevices;
RTCPeerConnection = virtGlobal.webkitRTCPeerConnection;
RTCSessionDescription = virtGlobal.RTCSessionDescription;
RTCIceCandidate = virtGlobal.RTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
if (MediaStreamTrack && MediaStreamTrack.getSources) {
getMediaDevices = MediaStreamTrack.getSources.bind(MediaStreamTrack);
} else if (virtNavigator.getMediaDevices) {
getMediaDevices = virtNavigator.getMediaDevices.bind(virtNavigator);
}
attachMediaStream = function (element, stream) {
// Device flags
const isPhone = bowser.mobile === true;
const isTablet = bowser.tablet === true;
const isMobile = isPhone || isTablet;
const isDesktop = !isMobile;
const isiPhone = isiOS && bowser.iphone === true;
const isiPad = isiOS && bowser.ipad === true;
const isiPod = isiOS && bowser.ipod === true;
// Browser flags
const isChrome = bowser.chrome === true;
const isFirefox = bowser.firefox === true;
const isSafari = bowser.safari === true;
const isEdge = bowser.msedge === true;
const isIE = bowser.msie === true;
const isOpera = bowser.opera === true;
const checkDevice = () => {
if (isPhone) return 'phone';
if (isTablet) return 'tablet';
if (isDesktop) return 'desktop';
return '';
};
const checkOSName = () => {
if (isiOS) return 'ios';
if (isAndroid) return 'android';
if (isFirefoxOS) return 'firefoxos';
if (isWindowsPhone) return 'windowsphone';
if (isBlackberry) return 'blackberry';
if (isMac) return 'mac';
if (isWindows) return 'windows';
if (Browser.safari && Number(Browser.version) >= 7.1)
return true;
// Android Chrome WebView
if (navigator.appVersion.match(/ wv/))
return false;
if (Browser.chrome && Number(Browser.version) >= 42)
return true;
if (Browser.yandexbrowser && Number(Browser.version) >= 15.12)
return true;
// https://www.chromestatus.com/feature/5416033485586432
if (Browser.opera && Browser.mobile && Number(Browser.version) >= 37)
return true;
return false;
}
function Adapter(options) {
// Chrome desktop, Chrome Android, Opera desktop, Opera Android, Android native browser
// or generic Webkit browser.
if (
(isDesktop && browser.chrome && browserVersion >= 32) ||
(browser.android && browser.chrome && browserVersion >= 39) ||
(isDesktop && browser.opera && browserVersion >= 27) ||
(browser.android && browser.opera && browserVersion >= 24) ||
(browser.android && browser.webkit && !browser.chrome && browserVersion >= 37) ||
(virtNavigator.webkitGetUserMedia && virtGlobal.webkitRTCPeerConnection)
) {
hasWebRTC = true;
getUserMedia = virtNavigator.webkitGetUserMedia.bind(virtNavigator);
mediaDevices = virtNavigator.mediaDevices;
RTCPeerConnection = virtGlobal.webkitRTCPeerConnection;
RTCSessionDescription = virtGlobal.RTCSessionDescription;
RTCIceCandidate = virtGlobal.RTCIceCandidate;
MediaStreamTrack = virtGlobal.MediaStreamTrack;
if (MediaStreamTrack && MediaStreamTrack.getSources) {
getMediaDevices = MediaStreamTrack.getSources.bind(MediaStreamTrack);
} else if (virtNavigator.getMediaDevices) {
getMediaDevices = virtNavigator.getMediaDevices.bind(virtNavigator);
}
attachMediaStream = function (element, stream) {
it('cut should be supported on Chrome 43+', function() {
assert.equal(document.queryCommandSupported('cut'), true);
});
}
else {
it('copy should not be supported on Chrome 42-', function() {
assert.equal(document.queryCommandSupported('copy'), false);
});
it('cut should not be supported on Chrome 42-', function() {
assert.equal(document.queryCommandSupported('cut'), false);
});
}
}
if (bowser.opera) {
if (bowser.version >= 30) {
it('copy should be supported on Opera 30+', function() {
assert.equal(document.queryCommandSupported('copy'), true);
});
it('cut should be supported on Opera 30+', function() {
assert.equal(document.queryCommandSupported('cut'), true);
});
}
else {
it('copy should not be supported on Opera 29-', function() {
assert.equal(document.queryCommandSupported('copy'), false);
});
it('cut should not be supported on Opera 29-', function() {
assert.equal(document.queryCommandSupported('cut'), false);
document.queryCommandSupported = function(cmd) {
if (cmd === 'copy' || cmd === 'cut') {
if (bowser.chrome) {
if (bowser.version >= 43) {
return true;
}
return false;
}
if (bowser.opera) {
if (bowser.version >= 30) {
return true;
}
return false;
}
if (bowser.firefox && bowser.version < 41) {
return false;
}
}
return _queryCommandSupported.apply(this, arguments);
};
getBrowserType(): BrowserType {
if (bowser.chrome) {
return BrowserType.Chrome;
} else if (bowser.firefox) {
return BrowserType.Firefox;
} else if (bowser.opera) {
return BrowserType.Opera;
} else if (bowser.msedge) {
return BrowserType.Edge;
} else if (bowser.safari) {
return BrowserType.Safari;
} else {
return BrowserType.Other;
}
},
getOperatingSystem(): OperatingSystemType {
getBrowser(): Browser {
if (bowser.chrome) {
return Browser.Chrome;
} else if (bowser.firefox) {
return Browser.Firefox;
} else if (bowser.opera) {
return Browser.Opera;
} else if (bowser.msedge) {
return Browser.Edge;
} else if (bowser.safari) {
return Browser.Safari;
} else {
return Browser.Other;
}
},
isMobileOperatingSystem(): boolean {