@faintlines/video-player
Advanced tools
Comparing version 1.3.13 to 1.4.0
@@ -182,3 +182,3 @@ import React, { forwardRef, useState, useRef, useEffect, useCallback, useMemo, useContext } from 'react'; | ||
var _excluded = ["url", "hlsUrl", "dashUrl", "fileUrl", "className", "progressInterval", "playsInline", "startAt", "autoPlay", "preload", "poster", "controlsList", "loopRange", "onPlay", "onPause", "onProgress", "onLoadedMetadata"], | ||
var _excluded = ["url", "hlsUrl", "dashUrl", "fileUrl", "className", "progressInterval", "playsInline", "startAt", "autoPlay", "preload", "poster", "controlsList", "loopRange", "autoRetry", "onPlay", "onPause", "onProgress", "onLoadedMetadata", "onError", "onRetryAttempt"], | ||
_excluded2 = ["children"]; | ||
@@ -203,2 +203,3 @@ | ||
loopRange = _ref.loopRange, | ||
autoRetry = _ref.autoRetry, | ||
onPlay = _ref.onPlay, | ||
@@ -208,2 +209,4 @@ onPause = _ref.onPause, | ||
onLoadedMetadata = _ref.onLoadedMetadata, | ||
onError = _ref.onError, | ||
onRetryAttempt = _ref.onRetryAttempt, | ||
props = _objectWithoutProperties(_ref, _excluded); | ||
@@ -216,2 +219,7 @@ | ||
var _useState3 = useState(0), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
retryAttempt = _useState4[0], | ||
setRetryAttempt = _useState4[1]; | ||
var playerRef = useRef(); | ||
@@ -312,2 +320,19 @@ var loopRangeRef = useRef(loopRange); | ||
[onPause]); | ||
var errorHandler = useCallback(function (evt) { | ||
if (onError) { | ||
onError(evt); | ||
} | ||
if (autoRetry && !evt.defaultPrevented) { | ||
setTimeout(function () { | ||
setRetryAttempt(function (x) { | ||
return x + 1; | ||
}); | ||
if (onRetryAttempt) { | ||
onRetryAttempt(); | ||
} | ||
}, 1000); | ||
} | ||
}, [onError, onRetryAttempt, autoRetry]); | ||
var providerProps = useMemo(function () { | ||
@@ -322,2 +347,3 @@ return { | ||
ref: playerRef, | ||
key: retryAttempt, | ||
url: selectVideoUrl({ | ||
@@ -348,3 +374,4 @@ hlsUrl: (urlObj === null || urlObj === void 0 ? void 0 : urlObj.hls) || hlsUrl, | ||
onProgress: progressHandler, | ||
onLoadedMetadata: metadataLoadedHandler | ||
onLoadedMetadata: metadataLoadedHandler, | ||
onError: errorHandler | ||
}, props))); | ||
@@ -356,3 +383,5 @@ }); | ||
playsInline: true, | ||
progressInterval: 500 | ||
progressInterval: 500, | ||
poster: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" // transparent pixel | ||
}; | ||
@@ -359,0 +388,0 @@ var Wrapper = /*#__PURE__*/forwardRef(function (_ref2, ref) { |
{ | ||
"name": "@faintlines/video-player", | ||
"version": "1.3.13", | ||
"version": "1.4.0", | ||
"description": "", | ||
@@ -42,3 +42,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "85cacbfd795414cb2bc6cd0f3d0aa4bcf84fdc4d" | ||
"gitHead": "57c4f5103c1bc4539ecb9b6c22eeee0ebc189f37" | ||
} |
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
33659
360