betajs/betajs-media

View on GitHub
src/video_recorder/video_recorder.js

Summary

Maintainability
F
4 days
Test Coverage

File video_recorder.js has 445 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:Recorder.VideoRecorderWrapper", [
    "base:Classes.ConditionalInstance",
    "base:Events.EventsMixin",
    "base:Objs",
    "base:Promise"
Severity: Minor
Found in src/video_recorder/video_recorder.js - About 6 hrs to fix

    Function _detectCurrentDeviceId has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                _detectCurrentDeviceId: function(devices, devicesCount, isVideo) {
                    var _currentDeviceTrack, _currentDeviceSettings, _counter;
                    if (isVideo) {
                        _currentDeviceTrack = this._recorder._videoTrack;
                        _currentDeviceSettings = this._recorder._videoTrackSettings;
    Severity: Minor
    Found in src/video_recorder/video_recorder.js - About 1 hr to fix

      Function constructor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  constructor: function(options) {
                      inherited.constructor.call(this, options);
                      if (this._element.tagName.toLowerCase() !== "video")
                          this._element = Dom.changeTag(this._element, "video");
                      this._recorder = RecorderWrapper.create({
      Severity: Minor
      Found in src/video_recorder/video_recorder.js - About 1 hr to fix

        Function createSnapshotDisplay has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    createSnapshotDisplay: function(parent, snapshot, x, y, w, h) {},
        Severity: Minor
        Found in src/video_recorder/video_recorder.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if (isVideo)
                                              this._currentVideo = Objs.ithKey(devices);
                                          else
                                              this._currentAudio = Objs.ithKey(devices);
          Severity: Major
          Found in src/video_recorder/video_recorder.js - About 45 mins to fix

            Function updateSnapshotDisplay has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        updateSnapshotDisplay: function(snapshot, display, x, y, w, h) {},
            Severity: Minor
            Found in src/video_recorder/video_recorder.js - About 45 mins to fix

              Function createSnapshotDisplay has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                          createSnapshotDisplay: function(parent, snapshot, x, y, w, h) {
              Severity: Minor
              Found in src/video_recorder/video_recorder.js - About 45 mins to fix

                Function updateSnapshotDisplay has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                            updateSnapshotDisplay: function(snapshot, image, x, y, w, h) {
                Severity: Minor
                Found in src/video_recorder/video_recorder.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if (isVideo)
                                                      this._currentVideo = index;
                                                  else
                                                      this._currentAudio = index;
                  Severity: Major
                  Found in src/video_recorder/video_recorder.js - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                    if (
                                        (Info.isChrome() || Info.isFirefox() || Info.isOpera() ||
                                            (Info.isSafari() && Support.globals().MediaRecorder)
                                        ) && typeof navigator.mediaDevices.getDisplayMedia !== 'undefined'
                                    )
                    Severity: Major
                    Found in src/video_recorder/video_recorder.js - About 40 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return true;
                      Severity: Major
                      Found in src/video_recorder/video_recorder.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                            return true;
                        Severity: Major
                        Found in src/video_recorder/video_recorder.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return false;
                          Severity: Major
                          Found in src/video_recorder/video_recorder.js - About 30 mins to fix

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                        createSnapshotDisplay: function(parent, snapshot, x, y, w, h) {
                                            var url = Support.globals().URL.createObjectURL(snapshot);
                                            var image = document.createElement("img");
                                            image.style.position = "absolute";
                                            this.updateSnapshotDisplay(snapshot, image, x, y, w, h);
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 5 hrs to fix
                            src/video_recorder/recorder_support.js on lines 217..228

                            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 143.

                            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

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                            return Support.chromeExtensionMessage(ext.extensionId, {
                                                type: "ping",
                                                data: pingTest
                                            }).mapError(function() {
                                                return err;
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 3 hrs to fix
                            src/image_recorder/image_recorder.js on lines 223..232

                            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 99.

                            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

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                        updateSnapshotDisplay: function(snapshot, image, x, y, w, h) {
                                            image.style.left = x + "px";
                                            image.style.top = y + "px";
                                            image.style.width = w + "px";
                                            image.style.height = h + "px";
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 2 hrs to fix
                            src/image_recorder/image_recorder.js on lines 191..196

                            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 92.

                            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

                            Further Reading

                            Identical blocks of code found in 3 locations. Consider refactoring.
                            Open

                                        constructor: function(options) {
                                            inherited.constructor.call(this, options);
                                            this._element = this._options.element;
                                            this.ready = Promise.create();
                                        },
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 2 other locations - About 1 hr to fix
                            src/audio_recorder/audio_recorder.js on lines 12..16
                            src/image_recorder/image_recorder.js on lines 12..16

                            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 64.

                            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

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                        destroy: function() {
                                            if (this._analyser)
                                                this._analyser.weakDestroy();
                                            this._recorder.destroy();
                                            inherited.destroy.call(this);
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 1 hr to fix
                            src/audio_recorder/audio_recorder.js on lines 132..137

                            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 61.

                            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

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                                else if (_currentDeviceTrack.label) {
                                                    _counter = 1;
                                                    Objs.iter(devices, function(device, index) {
                                                        // If determine label will return device ID
                                                        if (Comparators.byValue(device.label, _currentDeviceTrack.label) === 0) {
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 1 hr to fix
                            src/video_recorder/video_recorder.js on lines 479..523

                            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 58.

                            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

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                            if (_currentDeviceSettings && _currentDeviceTrack) {
                                                if (_currentDeviceSettings.deviceId && devices[_currentDeviceSettings.deviceId]) {
                                                    if (isVideo)
                                                        this._currentVideo = devices[_currentDeviceSettings.deviceId].id;
                                                    else
                            Severity: Major
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 1 hr to fix
                            src/video_recorder/video_recorder.js on lines 488..516

                            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 58.

                            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

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                                            if (Support.globals().supportedConstraints.mediaSource && Info.isFirefox() && Info.firefoxVersion() > 55)
                                                return true;
                            Severity: Minor
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 40 mins to fix
                            src/image_recorder/image_recorder.js on lines 242..243

                            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

                            Further Reading

                            Similar blocks of code found in 3 locations. Consider refactoring.
                            Open

                                            if (this._element.tagName.toLowerCase() !== "video")
                                                this._element = Dom.changeTag(this._element, "video");
                            Severity: Minor
                            Found in src/video_recorder/video_recorder.js and 2 other locations - About 35 mins to fix
                            src/audio_recorder/audio_recorder.js on lines 108..109
                            src/image_recorder/image_recorder.js on lines 102..103

                            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 47.

                            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

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                                    if (audioBlob) {
                                                        multiUploader.addUploader(FileUploader.create(Objs.extend({
                                                            source: audioBlob
                                                        }, options.audio)));
                                                    }
                            Severity: Minor
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 30 mins to fix
                            src/video_recorder/video_recorder.js on lines 399..403

                            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 45.

                            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

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                                    if (videoBlob) {
                                                        multiUploader.addUploader(FileUploader.create(Objs.extend({
                                                            source: videoBlob
                                                        }, options.video)));
                                                    }
                            Severity: Minor
                            Found in src/video_recorder/video_recorder.js and 1 other location - About 30 mins to fix
                            src/video_recorder/video_recorder.js on lines 404..408

                            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 45.

                            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

                            Further Reading

                            There are no issues that match your filters.

                            Category
                            Status