Merge pull request #11 from silvermine/adjust_unselected_source_state

Use 'selected = false', over '_.omit' to deselect a source
This commit is contained in:
Jeremy Thomerson 2017-11-20 15:29:44 -05:00 committed by GitHub
commit cdea57c3a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,11 @@ module.exports = function(videojs) {
isPaused = player.paused(),
selectedSource;
sources = _.map(sources, _.partial(_.omit, _, 'selected'));
// Clear out any previously selected sources (see: #11)
_.each(sources, function(source) {
source.selected = false;
});
selectedSource = _.findWhere(sources, { src: newSource.src });
// Note: `_.findWhere` returns a reference to an object. Thus the
// following updates the original object in `sources`.