Only add sources if the type is supported by a Tech

There is not much use in adding sources that we cannot play, so filter
them out. Backwards compatible with Tech's that do not yet support
canPlayType().

Fixes #15
This commit is contained in:
Derk-Jan Hartman 2016-05-23 23:25:43 +02:00
parent 56760f6314
commit d5aec7c6c6

View file

@ -178,6 +178,15 @@
player.controlBar.resolutionSwitcher.dispose(); player.controlBar.resolutionSwitcher.dispose();
delete player.controlBar.resolutionSwitcher; 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 //Sort sources
src = src.sort(compareResolutions); src = src.sort(compareResolutions);
groupedSrc = bucketSources(src); groupedSrc = bucketSources(src);