@faintlines/video-player
Advanced tools
Comparing version 1.1.10 to 1.1.14
@@ -140,4 +140,7 @@ import React, { forwardRef, useState, useRef, useEffect, useContext } from 'react'; | ||
preload = _ref.preload, | ||
onPlay = _ref.onPlay, | ||
onPause = _ref.onPause, | ||
onProgress = _ref.onProgress, | ||
props = _objectWithoutProperties(_ref, ["url", "hlsUrl", "dashUrl", "fileUrl", "className", "progressInterval", "playsInline", "autoPlay", "preload", "onProgress"]); | ||
onLoadedMetadata = _ref.onLoadedMetadata, | ||
props = _objectWithoutProperties(_ref, ["url", "hlsUrl", "dashUrl", "fileUrl", "className", "progressInterval", "playsInline", "autoPlay", "preload", "onPlay", "onPause", "onProgress", "onLoadedMetadata"]); | ||
@@ -159,13 +162,23 @@ var _useState = useState(autoPlay), | ||
if (ref) { | ||
var _playerRef$current, _playerRef$current$ge, _playerRef$current2, _playerRef$current2$g; | ||
ref.current = { | ||
paused: playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : (_playerRef$current$ge = _playerRef$current.getInternalPlayer()) === null || _playerRef$current$ge === void 0 ? void 0 : _playerRef$current$ge.paused, | ||
duration: playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current2 = playerRef.current) === null || _playerRef$current2 === void 0 ? void 0 : (_playerRef$current2$g = _playerRef$current2.getInternalPlayer()) === null || _playerRef$current2$g === void 0 ? void 0 : _playerRef$current2$g.duration, | ||
play: function play() { | ||
var _playerRef$current, _playerRef$current$ge; | ||
var _playerRef$current3, _playerRef$current3$g; | ||
setPlaying(true); | ||
playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : (_playerRef$current$ge = _playerRef$current.getInternalPlayer()) === null || _playerRef$current$ge === void 0 ? void 0 : _playerRef$current$ge.play(); | ||
playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current3 = playerRef.current) === null || _playerRef$current3 === void 0 ? void 0 : (_playerRef$current3$g = _playerRef$current3.getInternalPlayer()) === null || _playerRef$current3$g === void 0 ? void 0 : _playerRef$current3$g.play(); | ||
}, | ||
pause: function pause() { | ||
var _playerRef$current4, _playerRef$current4$g; | ||
setPlaying(false); | ||
playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current4 = playerRef.current) === null || _playerRef$current4 === void 0 ? void 0 : (_playerRef$current4$g = _playerRef$current4.getInternalPlayer()) === null || _playerRef$current4$g === void 0 ? void 0 : _playerRef$current4$g.pause(); | ||
}, | ||
seekTo: function seekTo(time) { | ||
var _playerRef$current2; | ||
var _playerRef$current5; | ||
return playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current2 = playerRef.current) === null || _playerRef$current2 === void 0 ? void 0 : _playerRef$current2.seekTo(time, "seconds"); | ||
return playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current5 = playerRef.current) === null || _playerRef$current5 === void 0 ? void 0 : _playerRef$current5.seekTo(time, "seconds"); | ||
} | ||
@@ -181,7 +194,31 @@ }; | ||
if (onProgress) { | ||
onProgress(progress); | ||
onProgress && onProgress(progress); | ||
} | ||
function metadataLoadedHandler(evt) { | ||
if (ref && ref.current) { | ||
var _playerRef$current6, _playerRef$current6$g; | ||
ref.current.duration = playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current6 = playerRef.current) === null || _playerRef$current6 === void 0 ? void 0 : (_playerRef$current6$g = _playerRef$current6.getInternalPlayer()) === null || _playerRef$current6$g === void 0 ? void 0 : _playerRef$current6$g.duration; | ||
} | ||
onLoadedMetadata && onLoadedMetadata(evt); | ||
} | ||
function playHandler(evt) { | ||
if (ref && ref.current) { | ||
ref.current.paused = false; | ||
} | ||
onPlay && onPlay(evt); | ||
} | ||
function pauseHandler(evt) { | ||
if (ref && ref.current) { | ||
ref.current.paused = true; | ||
} | ||
onPause && onPause(evt); | ||
} | ||
return /*#__PURE__*/React.createElement(WrapperPropsContext.Provider, { | ||
@@ -202,4 +239,4 @@ value: { | ||
file: { | ||
hlsVersion: "1.0.2", | ||
dashVersion: "3.2.2", | ||
hlsVersion: "1.0.7", | ||
dashVersion: "4.0.0-npm", | ||
attributes: { | ||
@@ -215,3 +252,6 @@ autoPlay: autoPlay, | ||
progressInterval: progressInterval, | ||
onProgress: progressHandler | ||
onPlay: playHandler, | ||
onPause: pauseHandler, | ||
onProgress: progressHandler, | ||
onLoadedMetadata: metadataLoadedHandler | ||
}, props))); | ||
@@ -218,0 +258,0 @@ }); |
{ | ||
"name": "@faintlines/video-player", | ||
"version": "1.1.10", | ||
"version": "1.1.14", | ||
"description": "", | ||
@@ -36,3 +36,3 @@ "license": "UNLICENSED", | ||
}, | ||
"gitHead": "31e8d915d850d839574008e90cbef6ef94356296" | ||
"gitHead": "9d27de38e84b62a5d537ab9ac61ff9a89167466a" | ||
} |
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
19513
236