@faintlines/video-player
Advanced tools
Comparing version 1.8.2 to 1.9.0
@@ -795,3 +795,16 @@ import classnames from 'classnames'; | ||
var loopRangeRef = useRef(loopRange); | ||
var _useState5 = useState(false), | ||
_useState6 = _slicedToArray(_useState5, 2), | ||
hlsError = _useState6[0], | ||
setHlsError = _useState6[1]; | ||
var urlObj = ensureUrlObject(url); | ||
var subtitlesUrl = urlObj === null || urlObj === void 0 ? void 0 : urlObj.subtitles; | ||
var _selectVideoUrl = selectVideoUrl({ | ||
hlsUrl: hlsError ? null : (urlObj === null || urlObj === void 0 ? void 0 : urlObj.hls) || hlsUrl, | ||
dashUrl: (urlObj === null || urlObj === void 0 ? void 0 : urlObj.dash) || dashUrl, | ||
fileUrl: (urlObj === null || urlObj === void 0 ? void 0 : urlObj.file) || fileUrl | ||
}), | ||
_selectVideoUrl2 = _slicedToArray(_selectVideoUrl, 2), | ||
selectedUrl = _selectVideoUrl2[0], | ||
selectedUrlType = _selectVideoUrl2[1]; | ||
useEffect(function () { | ||
@@ -881,3 +894,3 @@ if (ref) { | ||
[onPause]); | ||
var errorHandler = useCallback(function (evt) { | ||
var errorHandler = useCallback(function (evt, data) { | ||
// NotAllowedError means we tried playing the video before the user | ||
@@ -896,7 +909,10 @@ // interacted with the page (see https://goo.gl/xX8pDD) | ||
} | ||
if (isNonRecoverableHlsError(evt, data)) { | ||
setHlsError(true); | ||
} | ||
if (onError) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
args[_key - 2] = arguments[_key]; | ||
} | ||
onError.apply(void 0, [evt].concat(args)); | ||
onError.apply(void 0, [evt, data].concat(args)); | ||
} | ||
@@ -914,3 +930,2 @@ if (autoRetry && !evt.defaultPrevented) { | ||
}, [onError, onRetryAttempt, autoRetry]); | ||
var subtitlesUrl = urlObj === null || urlObj === void 0 ? void 0 : urlObj.subtitles; | ||
var providerProps = useMemo(function () { | ||
@@ -925,8 +940,2 @@ return { | ||
}, [className, subtitlesClassName, enableSubtitles, subtitlesUrl, playerRef]); | ||
var selectedUrl = selectVideoUrl({ | ||
hlsUrl: (urlObj === null || urlObj === void 0 ? void 0 : urlObj.hls) || hlsUrl, | ||
dashUrl: (urlObj === null || urlObj === void 0 ? void 0 : urlObj.dash) || dashUrl, | ||
fileUrl: (urlObj === null || urlObj === void 0 ? void 0 : urlObj.file) || fileUrl | ||
}); | ||
var isHlsUrl = selectedUrl && selectedUrl === ((urlObj === null || urlObj === void 0 ? void 0 : urlObj.hls) || hlsUrl); | ||
return /*#__PURE__*/React.createElement(WrapperPropsContext.Provider, { | ||
@@ -946,3 +955,3 @@ value: providerProps | ||
// and not the default one, as for example happends in IOS | ||
forceHLS: isHlsUrl, | ||
forceHLS: selectedUrlType === "hls", | ||
dashVersion: "4.0.0-npm", | ||
@@ -1003,8 +1012,8 @@ attributes: _objectSpread2({ | ||
if (hlsUrl && SUPPORTS_HLS) { | ||
return hlsUrl; | ||
return [hlsUrl, "hls"]; | ||
} | ||
if (dashUrl && SUPPORTS_DASH) { | ||
return dashUrl; | ||
return [dashUrl, "dash"]; | ||
} | ||
return fileUrl; | ||
return [fileUrl, "file"]; | ||
} | ||
@@ -1032,2 +1041,6 @@ function getRemotePlaybackAttribute() { | ||
} | ||
function isNonRecoverableHlsError(evt, data) { | ||
// TODO: add here more error types | ||
return evt.toString() === "hlsError" && (data === null || data === void 0 ? void 0 : data.type) === "mediaError"; | ||
} | ||
function NOOP() { | ||
@@ -1034,0 +1047,0 @@ // nothing |
{ | ||
"name": "@faintlines/video-player", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"description": "", | ||
@@ -30,3 +30,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "e76b5251483156b831d37ea65ab938b0a7687307" | ||
"gitHead": "3e87a3b2f7dd4eb9cf10db1b4b2fa61add242cb6" | ||
} |
Sorry, the diff of this file is not supported yet
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
99786
1065