function findTrack(languages) {
	    var _this3 = this;

	    var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	    var tracks = captions.getTracks.call(this);

	    var sortIsDefault = function sortIsDefault(track) {
	      return Number((_this3.captions.meta.get(track) || {}).default);
	    };

	    var sorted = Array.from(tracks).sort(function (a, b) {
	      return sortIsDefault(b) - sortIsDefault(a);
	    });
	    var track;
	    languages.every(function (language) {
	      track = sorted.find(function (track) {
	        return track.language === language;
	      });
	      return !track; // Break iteration if there is a match
	    }); // If no match is found but is required, get first

	    return track || (force ? sorted[0] : undefined);
	  }
function findTrack(languages) {
	    var _this3 = this;

	    var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
	    var tracks = captions.getTracks.call(this);

	    var sortIsDefault = function sortIsDefault(track) {
	      return Number((_this3.captions.meta.get(track) || {}).default);
	    };

	    var sorted = Array.from(tracks).sort(function (a, b) {
	      return sortIsDefault(b) - sortIsDefault(a);
	    });
	    var track;
	    languages.every(function (language) {
	      track = sorted.find(function (track) {
	        return track.language === language;
	      });
	      return !track; 
	    }); 

	    return track || (force ? sorted[0] : undefined);
	  }
function findTrack ( languages ) { var _this3 = this ; var force = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ; var tracks = captions . getTracks . call ( this ) ; var sortIsDefault = function sortIsDefault ( track ) { return Number ( ( _this3 . captions . meta . get ( track ) || { } ) . default ) ; } ; var sorted = Array . from ( tracks ) . sort ( function ( a , b ) { return sortIsDefault ( b ) - sortIsDefault ( a ) ; } ) ; var track ; languages . every ( function ( language ) { track = sorted . find ( function ( track ) { return track . language === language ; } ) ; return ! track ; // Break iteration if there is a match } ) ; // If no match is found but is required, get first return track || ( force ? sorted [ 0 ] : undefined ) ; }
Match tracks based on languages and get the first
Match tracks based on languages and get the first