This file is indexed.

/usr/share/javascript/rtcninja/Adapter.min.js is in libjs-rtcninja 0.6.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
"use strict";module.exports=Adapter;var browser=require("bowser").browser,debug=require("debug")("rtcninja:Adapter"),debugerror=require("debug")("rtcninja:ERROR:Adapter"),getUserMedia=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),hasWebRTC=false,virtGlobal,virtNavigator;debugerror.log=console.warn.bind(console);virtGlobal=global.window||global;virtNavigator=virtGlobal.navigator||{};function Adapter(options){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);return element};canRenegotiate=true;oldSpecRTCOfferOptions=false}else if(isDesktop&&browser.firefox&&browserVersion>=22||browser.android&&browser.firefox&&browserVersion>=33||virtNavigator.mozGetUserMedia&&virtGlobal.mozRTCPeerConnection){hasWebRTC=true;getUserMedia=virtNavigator.mozGetUserMedia.bind(virtNavigator);RTCPeerConnection=virtGlobal.mozRTCPeerConnection;RTCSessionDescription=virtGlobal.mozRTCSessionDescription;RTCIceCandidate=virtGlobal.mozRTCIceCandidate;MediaStreamTrack=virtGlobal.MediaStreamTrack;attachMediaStream=function(element,stream){element.src=URL.createObjectURL(stream);return element};canRenegotiate=false;oldSpecRTCOfferOptions=false}else if(options.plugin&&typeof options.plugin.isRequired==="function"&&options.plugin.isRequired()&&typeof options.plugin.isInstalled==="function"&&options.plugin.isInstalled()){var pluginiface=options.plugin.interface;hasWebRTC=true;getUserMedia=pluginiface.getUserMedia;RTCPeerConnection=pluginiface.RTCPeerConnection;RTCSessionDescription=pluginiface.RTCSessionDescription;RTCIceCandidate=pluginiface.RTCIceCandidate;MediaStreamTrack=pluginiface.MediaStreamTrack;if(MediaStreamTrack&&MediaStreamTrack.getSources){getMediaDevices=MediaStreamTrack.getSources.bind(MediaStreamTrack)}else if(virtNavigator.getMediaDevices){getMediaDevices=virtNavigator.getMediaDevices.bind(virtNavigator)}attachMediaStream=pluginiface.attachMediaStream;canRenegotiate=pluginiface.canRenegotiate;oldSpecRTCOfferOptions=true}else if(virtNavigator.getUserMedia&&virtGlobal.RTCPeerConnection){hasWebRTC=true;getUserMedia=virtNavigator.getUserMedia.bind(virtNavigator);RTCPeerConnection=virtGlobal.RTCPeerConnection;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=virtGlobal.attachMediaStream||function(element,stream){element.src=URL.createObjectURL(stream);return element};canRenegotiate=false;oldSpecRTCOfferOptions=false}function throwNonSupported(item){return function(){throw new Error("rtcninja: WebRTC not supported, missing "+item+" [browser: "+browser.name+" "+browser.version+"]")}}Adapter.hasWebRTC=function(){return hasWebRTC};if(getUserMedia){Adapter.getUserMedia=function(constraints,successCallback,errorCallback){debug("getUserMedia() | constraints: %o",constraints);try{getUserMedia(constraints,function(stream){debug("getUserMedia() | success");if(successCallback){successCallback(stream)}},function(error){debug("getUserMedia() | error:",error);if(errorCallback){errorCallback(error)}})}catch(error){debugerror("getUserMedia() | error:",error);if(errorCallback){errorCallback(error)}}}}else{Adapter.getUserMedia=function(constraints,successCallback,errorCallback){debugerror("getUserMedia() | WebRTC not supported");if(errorCallback){errorCallback(new Error("rtcninja: WebRTC not supported, missing "+"getUserMedia [browser: "+browser.name+" "+browser.version+"]"))}else{throwNonSupported("getUserMedia")}}}Adapter.RTCPeerConnection=RTCPeerConnection||throwNonSupported("RTCPeerConnection");Adapter.RTCSessionDescription=RTCSessionDescription||throwNonSupported("RTCSessionDescription");Adapter.RTCIceCandidate=RTCIceCandidate||throwNonSupported("RTCIceCandidate");Adapter.MediaStreamTrack=MediaStreamTrack||throwNonSupported("MediaStreamTrack");Adapter.getMediaDevices=getMediaDevices;Adapter.attachMediaStream=attachMediaStream||throwNonSupported("attachMediaStream");Adapter.canRenegotiate=canRenegotiate;Adapter.closeMediaStream=function(stream){if(!stream){return}if(MediaStreamTrack&&MediaStreamTrack.prototype&&MediaStreamTrack.prototype.stop){debug("closeMediaStream() | calling stop() on all the MediaStreamTrack");var tracks,i,len;if(stream.getTracks){tracks=stream.getTracks();for(i=0,len=tracks.length;i<len;i+=1){tracks[i].stop()}}else{tracks=stream.getAudioTracks();for(i=0,len=tracks.length;i<len;i+=1){tracks[i].stop()}tracks=stream.getVideoTracks();for(i=0,len=tracks.length;i<len;i+=1){tracks[i].stop()}}}else if(typeof stream.stop==="function"){debug("closeMediaStream() | calling stop() on the MediaStream");stream.stop()}};Adapter.fixPeerConnectionConfig=function(pcConfig){var i,len,iceServer,hasUrls,hasUrl;if(!Array.isArray(pcConfig.iceServers)){pcConfig.iceServers=[]}for(i=0,len=pcConfig.iceServers.length;i<len;i+=1){iceServer=pcConfig.iceServers[i];hasUrls=iceServer.hasOwnProperty("urls");hasUrl=iceServer.hasOwnProperty("url");if(typeof iceServer==="object"){if(hasUrls&&!hasUrl){iceServer.url=Array.isArray(iceServer.urls)?iceServer.urls[0]:iceServer.urls}else if(!hasUrls&&hasUrl){iceServer.urls=Array.isArray(iceServer.url)?iceServer.url.slice():iceServer.url}if(hasUrl&&Array.isArray(iceServer.url)){iceServer.url=iceServer.url[0]}}}};Adapter.fixRTCOfferOptions=function(options){options=options||{};if(!oldSpecRTCOfferOptions){if(options.mandatory&&options.mandatory.OfferToReceiveAudio){options.offerToReceiveAudio=1}if(options.mandatory&&options.mandatory.OfferToReceiveVideo){options.offerToReceiveVideo=1}delete options.mandatory}else{if(options.offerToReceiveAudio){options.mandatory=options.mandatory||{};options.mandatory.OfferToReceiveAudio=true}if(options.offerToReceiveVideo){options.mandatory=options.mandatory||{};options.mandatory.OfferToReceiveVideo=true}}};return Adapter}