diff --git a/lib/videojs-resolution-switcher.js b/lib/videojs-resolution-switcher.js index 51936f3..9fa0274 100644 --- a/lib/videojs-resolution-switcher.js +++ b/lib/videojs-resolution-switcher.js @@ -118,7 +118,16 @@ //Return current src if src is not given if(!src){ return player.src(); } - // Sort sources + // Only add those sources which we can (maybe) play + src = src.filter( function(source) { + try { + return ( player.canPlayType( source.type ) !== '' ); + } catch (e) { + // If a Tech doesn't yet have canPlayType just add it + return true; + } + }); + //Sort sources this.currentSources = src.sort(compareResolutions); this.groupedSrc = bucketSources(this.currentSources); // Pick one by default