From a0303969c2c6875790d600444f357b12bdb09b50 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sat, 8 Dec 2018 16:50:44 +1100 Subject: Fix for error when mime type not specified (fixes #1274) --- src/js/html5.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/js/html5.js') diff --git a/src/js/html5.js b/src/js/html5.js index 0876211a..3266a58e 100644 --- a/src/js/html5.js +++ b/src/js/html5.js @@ -5,6 +5,7 @@ import support from './support'; import { removeElement } from './utils/elements'; import { triggerEvent } from './utils/events'; +import is from './utils/is'; const html5 = { getSources() { @@ -14,8 +15,16 @@ const html5 = { const sources = Array.from(this.media.querySelectorAll('source')); - // Filter out unsupported sources - return sources.filter(source => support.mime.call(this, source.getAttribute('type'))); + // Filter out unsupported sources (if type is specified) + return sources.filter(source => { + const type = source.getAttribute('type'); + + if (is.empty(type)) { + return true; + } + + return support.mime.call(this, type); + }); }, // Get quality levels -- cgit v1.2.3