Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
debug = require('debug')('rtcninja:Adapter'),
debugerror = require('debug')('rtcninja:ERROR:Adapter'),
// Internal vars
getUserMedia = null,
mediaDevices = null,
RTCPeerConnection = null,
RTCSessionDescription = null,
RTCIceCandidate = null,
MediaStreamTrack = null,
getMediaDevices = null,
attachMediaStream = null,
canRenegotiate = false,
oldSpecRTCOfferOptions = false,
browserVersion = Number(browser.version) || 0,
isDesktop = !!(!browser.mobile && (!browser.tablet || (browser.msie && browserVersion >= 10))),
hasWebRTC = false,
// Dirty trick to get this library working in a Node-webkit env with browserified libs
virtGlobal = global.window || global,
// Don't fail in Node
virtNavigator = virtGlobal.navigator || {};
debugerror.log = console.warn.bind(console);
// Constructor.
function Adapter(options) {
// Chrome desktop, Chrome Android, Opera desktop, Opera Android, Android native browser
// or generic Webkit browser.
if (
(isDesktop && browser.chrome && browserVersion >= 32) ||
// Dependencies.
var browser = require('bowser'),
debug = require('debug')('rtcninja'),
debugerror = require('debug')('rtcninja:ERROR'),
version = require('./version'),
Adapter = require('./Adapter'),
RTCPeerConnection = require('./RTCPeerConnection'),
// Internal vars.
called = false;
debugerror.log = console.warn.bind(console);
debug('version %s', version);
debug('detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]',
browser.name, browser.version, !!browser.mobile, !!browser.tablet,
!!browser.android, !!browser.ios);
// Constructor.
function rtcninja(options) {
// Load adapter
var iface = Adapter(options || {}); // jshint ignore:line
called = true;
// Expose RTCPeerConnection class.
rtcninja.RTCPeerConnection = RTCPeerConnection;
// Expose WebRTC API and utils.
rtcninja.getUserMedia = iface.getUserMedia;
// Dependencies.
var browser = require('bowser'),
debug = require('debug')('rtcninja'),
debugerror = require('debug')('rtcninja:ERROR'),
version = require('./version'),
Adapter = require('./Adapter'),
RTCPeerConnection = require('./RTCPeerConnection'),
// Internal vars.
called = false;
debugerror.log = console.warn.bind(console);
debug('version %s', version);
debug('detected browser: %s %s [mobile:%s, tablet:%s, android:%s, ios:%s]',
browser.name, browser.version, !!browser.mobile, !!browser.tablet,
!!browser.android, !!browser.ios);
// Constructor.
function rtcninja(options) {
// Load adapter
var iface = Adapter(options || {}); // jshint ignore:line
called = true;
// Expose RTCPeerConnection class.
rtcninja.RTCPeerConnection = RTCPeerConnection;
// Expose WebRTC API and utils.
rtcninja.getUserMedia = iface.getUserMedia;
function create_fixed_footer_placement() {
var element_id = 'rtd-' + (Math.random() + 1).toString(36).substring(4);
var display_type = constants.PROMO_TYPES.FIXED_FOOTER;
// Only propose the fixed footer ad for mobile
if (bowser && bowser.mobile) {
$('<div>').attr('id', element_id).appendTo('body');
return {
'div_id': element_id,
'display_type': display_type,
// Prioritize mobile ads when on mobile
'priority': constants.MAXIMUM_PROMO_PRIORITY,
};
}
return null;
}
</div>
// if we have an error, just render the error component
if (localStream.error) {
return (
<div style="{[styles.css]}">
</div>
);
}
let overlayComponent;
if (!~['connected', 'joining'].indexOf(this.state.status)) {
if (Browser.mobile || Browser.tablet || this.state.status === 'connecting') {
overlayComponent = (
);
} else if (this.state.status !== 'connecting' && !localStream.loading) {
overlayComponent = (
);
}
}
export const loginWithGoogle = () => (dispatch, getState) => {
dispatch({
type: constants.LOGIN_WITH_GOOGLE,
});
Meteor.loginWithGoogle({
requestPermissions: GOOGLE_PERMISSIONS,
loginStyle: (Browser.mobile || Browser.tablet) ? 'redirect' : 'popup',
requestOfflineToken: true,
forceApprovalPrompt: true,
}, (error) => {
if (error) {
return dispatch({
type: constants.LOGIN_ERROR,
error,
});
}
});
};
OneSignal.isOptedOut().then(isOptedOut => {
if (!isOptedOut) {
/*
* Chrome 63 on Android permission prompts are permanent without a dismiss option. To avoid
* permanent blocks, we want to replace sites automatically showing the native browser request
* with a slide prompt first.
*/
if (
(
!options ||
options && !options.fromRegisterFor
) &&
Browser.chrome &&
Number(Browser.version) >= 63 &&
(Browser.tablet || Browser.mobile)
) {
OneSignal.showHttpPrompt();
} else {
SubscriptionHelper.registerForPush();
}
} else {
OneSignal._sessionInitAlreadyRunning = false;
}
});
}