Comparing version 1.0.11 to 1.1.0
@@ -167,2 +167,41 @@ (function (global, factory) { | ||
var mediaError = function mediaError(media, callback) { | ||
var err = media.error; | ||
var message = err.message; | ||
var nodeName = media.nodeName.toLowerCase(); | ||
var errMsg = ''; | ||
try { | ||
switch (err.code) { | ||
case MediaError.MEDIA_ERR_ABORTED: | ||
errMsg += 'The user canceled the ' + nodeName + '. '; | ||
break; | ||
case MediaError.MEDIA_ERR_NETWORK: | ||
errMsg += 'A network error occurred while fetching the ' + nodeName + '. '; | ||
break; | ||
case MediaError.MEDIA_ERR_DECODE: | ||
errMsg += 'An error occurred while decoding the ' + nodeName + '. '; | ||
break; | ||
case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED: | ||
errMsg += 'The ' + nodeName + ' is missing or is in a format not supported by your browser. '; | ||
break; | ||
default: | ||
errMsg += 'An unknown error occurred. '; | ||
break; | ||
} | ||
} catch (err) { | ||
console && console.log(err); | ||
} | ||
if (message && message.length) { | ||
errMsg += message; | ||
} | ||
callback && callback({ | ||
code: err.code, | ||
msg: errMsg | ||
}); | ||
}; | ||
var mobileCheck = function mobileCheck() { | ||
@@ -319,2 +358,3 @@ var check = false; | ||
urlQuery: urlQuery, | ||
mediaError: mediaError, | ||
detectedInfos: detectedInfos, | ||
@@ -321,0 +361,0 @@ getVersionOfIOS: getVersionOfIOS, |
@@ -5,2 +5,3 @@ import date from './date' | ||
import urlQuery from './urlQuery' | ||
import mediaError from './mediaError' | ||
import detectedInfos from './detectedInfos' | ||
@@ -16,2 +17,3 @@ import getVersionOfIOS from './getVersionOfIOS' | ||
urlQuery, | ||
mediaError, | ||
detectedInfos, | ||
@@ -18,0 +20,0 @@ getVersionOfIOS, |
{ | ||
"name": "fe-utils", | ||
"version": "1.0.11", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "fe-utils.js", |
@@ -49,2 +49,4 @@ # fe-utils | ||
9. **logger** | ||
* <img src="http://o4a7cbihz.qnssl.com/cover/4ec91a4e-e638-4753-9f6a-9cee4e715420" width = "250" align="center" /> | ||
* <img src="http://o4a7cbihz.qnssl.com/cover/4ec91a4e-e638-4753-9f6a-9cee4e715420" width = "250" align="center" /> | ||
10. **mediaError** | ||
* ```mediaError(video / audio, (code, msg) => { ... }) // for error-listener-callback of audio and video ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40739
31
1142
52