From 08db8f10f3f6860d6d6464f619afe426bd1dab2c Mon Sep 17 00:00:00 2001 From: Kasper Moskwiak Date: Tue, 5 Apr 2016 19:19:57 +0200 Subject: [PATCH] fix #41 --- lib/videojs-resolution-switcher.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/videojs-resolution-switcher.js b/lib/videojs-resolution-switcher.js index 01edb6d..5b1448e 100644 --- a/lib/videojs-resolution-switcher.js +++ b/lib/videojs-resolution-switcher.js @@ -269,17 +269,14 @@ if (selectedRes === 'high') { selectedRes = src[0].res; selectedLabel = src[0].label; - } else if (selectedRes === 'low' || selectedRes == null) { + } else if (selectedRes === 'low' || selectedRes == null || !groupedSrc.res[selectedRes]) { // Select low-res if default is low or not set selectedRes = src[src.length - 1].res; selectedLabel = src[src.length -1].label; } else if (groupedSrc.res[selectedRes]) { selectedLabel = groupedSrc.res[selectedRes][0].label; } - - if(selectedRes === undefined){ - return {res: selectedRes, label: selectedLabel, sources: groupedSrc.label[selectedLabel]}; - } + return {res: selectedRes, label: selectedLabel, sources: groupedSrc.res[selectedRes]}; }