betajs/betajs-media

View on GitHub
src/video_player/broadcasting.js

Summary

Maintainability
D
1 day
Test Coverage

File broadcasting.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:Player.Broadcasting", [
    "base:Class",
    "browser:Loader",
    "browser:Events"
], function(Class, Loader, DomEvents, scoped) {
Severity: Minor
Found in src/video_player/broadcasting.js - About 2 hrs to fix

    Function _initializeCastApi has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                _initializeCastApi: function() {
                    var self = this;
                    self.player.trigger("cast-available", true);
                    var googleCastInitialOptions = this.googleCast.initialOptions;
    
    
    Severity: Major
    Found in src/video_player/broadcasting.js - About 2 hrs to fix

      Function _setupCastRemotePlayer has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  _setupCastRemotePlayer: function(castRemotePlayer, castRemotePlayerController) {
                      var self = this;
                      var player = this.player;
                      var options = this.castOptions;
                      var sources = player._sources;
      Severity: Major
      Found in src/video_player/broadcasting.js - About 2 hrs to fix

        Function _googleCastPlayerErrorMessages has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    _googleCastPlayerErrorMessages: function(error) {
                        switch (error.code) {
                            case chrome.cast.ErrorCode.API_NOT_INITIALIZED:
                                return 'The API is not initialized.' +
                                    (error.description ? ' :' + error.description : '');
        Severity: Minor
        Found in src/video_player/broadcasting.js - About 1 hr to fix

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

                      _googleCastRemotePlay: function() {
                          if (this.player._broadcastingState.googleCastConnected) {
                              var castRemotePlayer = this._getGoogleCastRemotePlayer();
                              var castRemotePlayerController = this._getGoogleCastRemotePlayerController();
                              if (castRemotePlayer.playerState === 'PAUSED')
          Severity: Major
          Found in src/video_player/broadcasting.js and 1 other location - About 2 hrs to fix
          src/video_player/broadcasting.js on lines 302..310

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

          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

                      _googleCastRemotePause: function() {
                          if (this.player._broadcastingState.googleCastConnected) {
                              var castRemotePlayer = this._getGoogleCastRemotePlayer();
                              var castRemotePlayerController = this._getGoogleCastRemotePlayerController();
                              if (castRemotePlayer.playerState === 'PLAYING')
          Severity: Major
          Found in src/video_player/broadcasting.js and 1 other location - About 2 hrs to fix
          src/video_player/broadcasting.js on lines 292..300

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

          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

                      _seekToGoogleCast: function(time) {
                          var castRemotePlayer = this._getGoogleCastRemotePlayer();
                          var castRemotePlayerController = this._getGoogleCastRemotePlayerController();
                          castRemotePlayer.currentTime = time;
                          castRemotePlayerController.seek();
          Severity: Major
          Found in src/video_player/broadcasting.js and 1 other location - About 1 hr to fix
          src/video_player/broadcasting.js on lines 319..324

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

          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

                      _changeGoogleCastVolume: function(volumePosition) {
                          var castRemoteController = this._getGoogleCastRemotePlayerController();
                          var castRemotePlayer = this._getGoogleCastRemotePlayer();
                          castRemotePlayer.volumeLevel = volumePosition;
                          castRemoteController.setVolumeLevel();
          Severity: Major
          Found in src/video_player/broadcasting.js and 1 other location - About 1 hr to fix
          src/video_player/broadcasting.js on lines 312..317

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

          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