diff --git a/lib/videojs-resolution-switcher.js b/lib/videojs-resolution-switcher.js index 5b1448e..901add1 100644 --- a/lib/videojs-resolution-switcher.js +++ b/lib/videojs-resolution-switcher.js @@ -178,6 +178,15 @@ player.controlBar.resolutionSwitcher.dispose(); delete player.controlBar.resolutionSwitcher; } + // 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 src = src.sort(compareResolutions); groupedSrc = bucketSources(src);