From ff1dcc28200637586bf03d990800ede438cd766e Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Wed, 14 Oct 2015 11:22:42 -0700 Subject: [PATCH] Refine MediaKeys polyfill error type Inspired by code in pull #176 Change-Id: I2e29310c8a3583ed208d7bd1ae2e747a92ddf480 --- lib/polyfill/patchedmediakeys_v01b.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/polyfill/patchedmediakeys_v01b.js b/lib/polyfill/patchedmediakeys_v01b.js index f37b7b9aa1..71c1daa0b6 100644 --- a/lib/polyfill/patchedmediakeys_v01b.js +++ b/lib/polyfill/patchedmediakeys_v01b.js @@ -247,7 +247,14 @@ shaka.polyfill.PatchedMediaKeys.v01b.MediaKeySystemAccess = } } // for each cfg in supportedConfigurations - throw Error('None of the requested configurations were supported.'); + var message = 'Unsupported keySystem'; + if (keySystem == 'org.w3.clearkey' || keySystem == 'com.widevine.alpha') { + message = 'None of the requested configurations were supported.'; + } + var unsupportedError = new Error(message); + unsupportedError.name = 'NotSupportedError'; + unsupportedError.code = DOMException.NOT_SUPPORTED_ERR; + throw unsupportedError; };