Function userMedia2
has 242 lines of code (exceeds 25 allowed). Consider refactoring. Open
userMedia2: function(options) {
var opts = {};
var promise;
if (options.audio)
opts.audio = options.audio;
File webrtc_support.js
has 516 lines of code (exceeds 250 allowed). Consider refactoring. Open
Scoped.define("module:WebRTC.Support", [
"base:Promise",
"base:Objs",
"browser:Info",
"browser:Dom",
Function enumerateMediaSources
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
enumerateMediaSources: function() {
var promise = Promise.create();
var promiseCallback = function(sources) {
var result = {
audio: {},
Function errorHandler
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
errorHandler: function(err) {
switch (err) {
case 'NotReadableError':
case 'TrackStartError':
return {
Function getGlobals
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
getGlobals: function() {
var getUserMedia = null;
var getUserMediaCtx = null;
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
Function promiseCallback
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
var promiseCallback = function(sources) {
var result = {
audio: {},
audioCount: 0,
video: {},
Function bindStreamToVideo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
bindStreamToVideo: function(stream, video, flip) {
if (!video)
video = document.createElement("video");
video.volume = 0;
video.muted = true;
Avoid deeply nested control flow statements. Open
if (options.video.width)
options.video.height = Math.round(options.video.width / options.video.aspectRatio);
else if (options.video.height)
options.video.width = Math.round(options.video.height * options.video.aspectRatio);
Avoid deeply nested control flow statements. Open
if (e.name !== "ConstraintNotSatisfiedError" && e.name !== "OverconstrainedError")
return e;
Avoid deeply nested control flow statements. Open
if (!navigator.mediaDevices || !navigator.mediaDevices.getSupportedConstraints || !navigator.mediaDevices.getSupportedConstraints().mediaSource)
return Promise.error("This browser does not support screen recording.");
Avoid deeply nested control flow statements. Open
if (as) {
if (typeof opts.video.mandatory !== 'undefined') {
opts.video.mandatory.minAspectRatio = as;
opts.video.mandatory.maxAspectRatio = as;
} else {
Avoid deeply nested control flow statements. Open
if (Info.isAndroid()) {
opts.video = {};
} else {
opts.video = {
mandatory: {}
Avoid deeply nested control flow statements. Open
if (typeof opts.video.mandatory !== 'undefined') {
if (options.video.width) {
opts.video.mandatory.minWidth = options.video.width;
opts.video.mandatory.maxWidth = options.video.width;
}
Avoid deeply nested control flow statements. Open
if (options.screen) {
var extensionId = this.chromeExtensionExtract(options.screen).extensionId;
if (!extensionId)
return Promise.error("This browser does not support screen recording.");
var pingTest = Time.now();
Avoid deeply nested control flow statements. Open
if (lkey.indexOf(c) >= 0) {
var flt = lkey.indexOf("aspect") > 0;
var d = lkey.indexOf("min") === 0 ? -1 : 1;
var u = Math.max(0, mandatory[key] * (1.0 + d / 10));
mandatory[key] = flt ? u : Math.round(u);
Avoid deeply nested control flow statements. Open
if (navigator.getDisplayMedia) {
promise = Promise.create();
var pr = navigator.getDisplayMedia({
video: true
});
Avoid deeply nested control flow statements. Open
if (Info.isSafari()) {
if (options.video.sourceId) {
opts.video.sourceId = options.video.sourceId;
opts.video.deviceId = {
exact: options.video.sourceId
Avoid too many return
statements within this function. Open
return this.userMedia(opts);
Avoid too many return
statements within this function. Open
return this.chromeExtensionMessage(extensionId, {
type: "ping",
data: pingTest
}).mapSuccess(function(pingResponse) {
promise = Promise.create();
Avoid too many return
statements within this function. Open
return Promise.error("This browser does not support screen recording.");
Avoid too many return
statements within this function. Open
return promise;
Avoid too many return
statements within this function. Open
return probe.call(this, 100);
Avoid too many return
statements within this function. Open
return Promise.error("This browser does not support screen recording.");
TODO found Open
// TODO: test it just in case
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (source.kind.indexOf("audio") === 0) {
result.audioCount++;
if (typeof source.getCapabilities !== 'undefined')
_sourceCapabilities = source.getCapabilities();
result.audio[source.id || source.deviceId] = {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 119.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (source.kind.indexOf("video") === 0) {
result.videoCount++;
if (typeof source.getCapabilities !== 'undefined')
_sourceCapabilities = source.getCapabilities();
result.video[source.id || source.deviceId] = {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 119.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (options.video.width) {
opts.video.mandatory.minWidth = options.video.width;
opts.video.mandatory.maxWidth = options.video.width;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (options.video.frameRate) {
opts.video.mandatory.minFrameRate = options.video.frameRate;
opts.video.mandatory.maxFrameRate = options.video.frameRate;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (parseInt(options.video.height, 10) > 0) {
videoOptions.height = parseInt(options.video.height, 10);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 48.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (parseInt(options.video.width, 10) > 0) {
videoOptions.width = parseInt(options.video.width, 10);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 48.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76