• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

silvermine / videojs-quality-selector / 197

pending completion
197

push

travis-ci-com

web-flow
Merge pull request #86 from crgwbr/crweber/es6_classes

refactor: use es6 classes

0 of 35 branches covered (0.0%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

0 of 119 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/js/middleware/SourceInterceptor.js
1
var _ = require('underscore'),
×
2
    events = require('../events');
×
3

4
module.exports = function(videojs) {
×
5

6
   videojs.use('*', function(player) {
×
7

8
      return {
×
9

10
         setSource: function(playerSelectedSource, next) {
11
            var sources = player.currentSources(),
×
12
                userSelectedSource, chosenSource;
13

14
            if (player._qualitySelectorSafeSeek) {
×
15
               player._qualitySelectorSafeSeek.onPlayerSourcesChange();
×
16
            }
17

18
            if (!_.isEqual(sources, player._qualitySelectorPreviousSources)) {
×
19
               player.trigger(events.PLAYER_SOURCES_CHANGED, sources);
×
20
               player._qualitySelectorPreviousSources = sources;
×
21
            }
22

23
            // There are generally two source options, the one that videojs
24
            // auto-selects and the one that a "user" of this plugin has
25
            // supplied via the `selected` property. `selected` can come from
26
            // either the `<source>` tag or the list of sources passed to
27
            // videojs using `src()`.
28

29
            userSelectedSource = _.find(sources, function(source) {
×
30
               // Must check for boolean values as well as either the string 'true' or
31
               // 'selected'. When sources are set programmatically, the value will be a
32
               // boolean, but those coming from a `<source>` tag will be a string.
33
               return source.selected === true || source.selected === 'true' || source.selected === 'selected';
×
34
            });
35

36
            chosenSource = userSelectedSource || playerSelectedSource;
×
37

38
            player.trigger(events.QUALITY_SELECTED, chosenSource);
×
39

40
            // Pass along the chosen source
41
            next(null, chosenSource);
×
42
         },
43

44
      };
45

46
   });
47

48
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc