@faintlines/video-player
Advanced tools
Comparing version 1.0.21 to 1.0.23
@@ -1,15 +0,242 @@ | ||
"use strict"; | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "default", { | ||
enumerable: true, | ||
get: function get() { | ||
return _VideoPlayer["default"]; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var React = require('react'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); | ||
if (_i == null) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function supportsHLS() { | ||
var video = document.createElement("video"); | ||
return Boolean(video.canPlayType("application/vnd.apple.mpegURL") || video.canPlayType("audio/mpegurl")); | ||
} | ||
var SUPPORTS_HLS = supportsHLS(); // https://github.com/Dash-Industry-Forum/dash.js/issues/2055#issuecomment-313187528 | ||
var SUPPORTS_DASH = typeof (window.MediaSource || window.WebKitMediaSource) === "function"; | ||
var ReactPlayer = require("react-player/file"); | ||
var WrapperPropsContext = /*#__PURE__*/React__default['default'].createContext(); | ||
var VideoPlayer = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | ||
var hlsUrl = _ref.hlsUrl, | ||
dashUrl = _ref.dashUrl, | ||
fileUrl = _ref.fileUrl, | ||
className = _ref.className, | ||
progressInterval = _ref.progressInterval, | ||
playsInline = _ref.playsInline, | ||
autoPlay = _ref.autoPlay, | ||
preload = _ref.preload, | ||
onProgress = _ref.onProgress, | ||
props = _objectWithoutProperties(_ref, ["hlsUrl", "dashUrl", "fileUrl", "className", "progressInterval", "playsInline", "autoPlay", "preload", "onProgress"]); | ||
var _useState = React.useState(autoPlay), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
playing = _useState2[0], | ||
setPlaying = _useState2[1]; | ||
var playerRef = React.useRef(); | ||
React.useEffect(function () { | ||
if (ref) { | ||
ref.current = { | ||
play: function play() { | ||
return setPlaying(true); | ||
}, | ||
seekTo: function seekTo(time) { | ||
var _playerRef$current; | ||
return playerRef === null || playerRef === void 0 ? void 0 : (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.seekTo(time, "seconds"); | ||
} | ||
}; | ||
} | ||
}, [ref]); | ||
function progressHandler(progress) { | ||
if (ref && ref.current) { | ||
ref.current.currentTime = progress.playedSeconds; | ||
} | ||
if (onProgress) { | ||
onProgress(progress); | ||
} | ||
} | ||
return /*#__PURE__*/React__default['default'].createElement(WrapperPropsContext.Provider, { | ||
value: { | ||
className: className | ||
} | ||
}, /*#__PURE__*/React__default['default'].createElement(ReactPlayer, _extends({ | ||
ref: playerRef, | ||
url: selectVideoUrl({ | ||
hlsUrl: hlsUrl, | ||
dashUrl: dashUrl, | ||
fileUrl: fileUrl | ||
}), | ||
wrapper: Wrapper, | ||
playing: playing, | ||
config: { | ||
file: { | ||
hlsVersion: "1.0.2", | ||
dashVersion: "3.2.2", | ||
attributes: { | ||
autoPlay: autoPlay, | ||
preload: preload, | ||
disableRemotePlayback: true, | ||
disablePictureInPicture: true | ||
} | ||
} | ||
}, | ||
playsinline: playsInline, | ||
progressInterval: progressInterval, | ||
onProgress: progressHandler | ||
}, props))); | ||
}); | ||
VideoPlayer.displayName = "VideoPlayer"; | ||
VideoPlayer.defaultProps = { | ||
autoPlay: false, | ||
playsInline: true, | ||
progressInterval: 500 | ||
}; | ||
var Wrapper = /*#__PURE__*/React.forwardRef(function (_ref2, ref) { | ||
var children = _ref2.children, | ||
props = _objectWithoutProperties(_ref2, ["children"]); | ||
var _VideoPlayer = _interopRequireDefault(require("./VideoPlayer.js")); | ||
var wrapperProps = React.useContext(WrapperPropsContext) || {}; | ||
return /*#__PURE__*/React__default['default'].createElement("div", _extends({ | ||
ref: ref | ||
}, wrapperProps, props), children); | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function selectVideoUrl(_ref3) { | ||
var hlsUrl = _ref3.hlsUrl, | ||
dashUrl = _ref3.dashUrl, | ||
fileUrl = _ref3.fileUrl; | ||
if (dashUrl && SUPPORTS_DASH) { | ||
return dashUrl; | ||
} | ||
if (hlsUrl && SUPPORTS_HLS) { | ||
return hlsUrl; | ||
} | ||
return fileUrl; | ||
} | ||
exports.default = VideoPlayer; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@faintlines/video-player", | ||
"version": "1.0.21", | ||
"description": "> TODO: description", | ||
"author": "Tzach Yarimi <tzach@faintlines.com>", | ||
"homepage": "https://github.com/faintlines/faintlines#readme", | ||
"license": "ISC", | ||
"version": "1.0.23", | ||
"description": "", | ||
"license": "UNLICENSED", | ||
"main": "dist/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/faintlines/faintlines.git", | ||
"directory": "packages/video-player" | ||
}, | ||
"scripts": { | ||
"build": "npx babel src --out-dir dist", | ||
"start": "npx babel src --watch --out-dir dist", | ||
"test": "jest" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/faintlines/faintlines/issues" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.17", | ||
"@babel/core": "^7.12.3", | ||
"@babel/preset-env": "^7.12.17", | ||
"@testing-library/react": "^11.2.6", | ||
"babel-eslint": "^10.1.0", | ||
"babel-jest": "^26.6.0", | ||
"babel-plugin-named-asset-import": "^0.3.7", | ||
"babel-preset-react-app": "^10.0.0", | ||
"bfj": "^7.0.2", | ||
"eslint": "^7.11.0", | ||
"eslint-config-react-app": "^6.0.0", | ||
"eslint-plugin-flowtype": "^5.2.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jest": "^24.1.0", | ||
"eslint-plugin-jsx-a11y": "^6.3.1", | ||
"eslint-plugin-react": "^7.21.5", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"eslint-plugin-testing-library": "^3.9.2", | ||
"jest": "26.6.0", | ||
"jest-circus": "26.6.0", | ||
"jest-resolve": "26.6.0", | ||
"jest-watch-typeahead": "0.6.1", | ||
"prettier": "^2.2.1" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"rollupExternal": [ | ||
"react" | ||
], | ||
"dependencies": { | ||
@@ -51,4 +17,3 @@ "react-player": "^2.9.0" | ||
"peerDependencies": { | ||
"react": ">17", | ||
"react-dom": ">17" | ||
"react": ">17" | ||
}, | ||
@@ -61,3 +26,14 @@ "eslintConfig": { | ||
}, | ||
"gitHead": "04ffa888a0649bc15c42f997a6bef4af1366b4ed" | ||
"babel": { | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
], | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-proposal-class-properties" | ||
] | ||
] | ||
}, | ||
"gitHead": "0bb58d147b3e6d354e1225c3a81d8983eb03af73" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
14023
2
0
195
3
1
2
2
0
1
1