react-player
Advanced tools
Comparing version 2.0.0-alpha.1 to 2.0.0
@@ -18,3 +18,2 @@ import * as React from 'react'; | ||
options?: Object; | ||
preload?: boolean; | ||
} | ||
@@ -25,3 +24,2 @@ | ||
embedOptions?: Object; | ||
preload?: boolean; | ||
} | ||
@@ -31,2 +29,4 @@ | ||
appId: string; | ||
version: string; | ||
playerId: string; | ||
} | ||
@@ -36,3 +36,2 @@ | ||
params?: Object; | ||
preload?: boolean; | ||
} | ||
@@ -42,3 +41,2 @@ | ||
playerOptions?: Object; | ||
preload?: boolean; | ||
} | ||
@@ -99,9 +97,2 @@ | ||
config?: Config; | ||
soundcloudConfig?: SoundCloudConfig; | ||
youtubeConfig?: YouTubeConfig; | ||
facebookConfig?: FacebookConfig; | ||
dailymotionConfig?: DailyMotionConfig; | ||
vimeoConfig?: VimeoConfig; | ||
fileConfig?: FileConfig; | ||
wistiaConfig?: WistiaConfig; | ||
onReady?(): void; | ||
@@ -132,2 +123,3 @@ onStart?(): void; | ||
getInternalPlayer(key?: string): Object; | ||
showPreview(): void; | ||
} |
@@ -9,3 +9,3 @@ "use strict"; | ||
exports.MATCH_URL_YOUTUBE = MATCH_URL_YOUTUBE; | ||
var MATCH_URL_SOUNDCLOUD = /(soundcloud\.com|snd\.sc)\/.+$/; | ||
var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/; | ||
exports.MATCH_URL_SOUNDCLOUD = MATCH_URL_SOUNDCLOUD; | ||
@@ -16,3 +16,3 @@ var MATCH_URL_VIMEO = /vimeo\.com\/.+/; | ||
exports.MATCH_URL_VIMEO_FILE = MATCH_URL_VIMEO_FILE; | ||
var MATCH_URL_FACEBOOK = /facebook\.com\/([^/?].+\/)?video(s|\.php)[/?].*$/; | ||
var MATCH_URL_FACEBOOK = /^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/; | ||
exports.MATCH_URL_FACEBOOK = MATCH_URL_FACEBOOK; | ||
@@ -19,0 +19,0 @@ var MATCH_URL_STREAMABLE = /streamable\.com\/([a-z0-9]+)$/; |
@@ -10,11 +10,13 @@ "use strict"; | ||
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare")); | ||
var _props = require("./props"); | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -29,11 +31,15 @@ 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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -44,10 +50,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var Player = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Player = /*#__PURE__*/function (_Component) { | ||
_inherits(Player, _Component); | ||
var _super = _createSuper(Player); | ||
function Player() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -61,3 +65,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Player)).call.apply(_getPrototypeOf2, [this].concat(_args))); | ||
_this = _super.call.apply(_super, [this].concat(_args)); | ||
@@ -273,3 +277,3 @@ _defineProperty(_assertThisInitialized(_this), "mounted", false); | ||
if (!(0, _utils.isEqual)(prevProps.url, url)) { | ||
if (!(0, _reactFastCompare["default"])(prevProps.url, url)) { | ||
if (this.isLoading && !activePlayer.forceLoad) { | ||
@@ -388,3 +392,3 @@ console.warn("ReactPlayer: the attempt to load ".concat(url, " is being deferred until the player has loaded")); | ||
return _react["default"].createElement(Player, _extends({}, this.props, { | ||
return /*#__PURE__*/_react["default"].createElement(Player, _extends({}, this.props, { | ||
onMount: this.handlePlayerMount, | ||
@@ -391,0 +395,0 @@ onReady: this.handleReady, |
@@ -12,18 +12,24 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
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 _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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(n); 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 _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
@@ -37,11 +43,15 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -53,12 +63,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL_READY = 'dmAsyncInit'; | ||
var MATCH_URL = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?$/; | ||
var DailyMotion = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var DailyMotion = /*#__PURE__*/function (_Component) { | ||
_inherits(DailyMotion, _Component); | ||
var _super = _createSuper(DailyMotion); | ||
function DailyMotion() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -72,3 +79,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DailyMotion)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -114,3 +121,3 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
var _url$match = url.match(MATCH_URL), | ||
var _url$match = url.match(_patterns.MATCH_URL_DAILYMOTION), | ||
_url$match2 = _slicedToArray(_url$match, 2), | ||
@@ -142,3 +149,3 @@ id = _url$match2[1]; | ||
origin: window.location.origin | ||
}, config.dailymotion.params), | ||
}, config.params), | ||
events: { | ||
@@ -209,5 +216,5 @@ apiready: _this2.props.onReady, | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, _react["default"].createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
ref: this.ref | ||
@@ -225,6 +232,2 @@ })); | ||
_defineProperty(DailyMotion, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(DailyMotion, "loopOnEnded", true); |
@@ -14,5 +14,5 @@ "use strict"; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -25,11 +25,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -41,13 +45,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL_READY = 'fbAsyncInit'; | ||
var MATCH_URL = /facebook\.com\/([^/?].+\/)?video(s|\.php)[/?].*$/; | ||
var PLAYER_ID_PREFIX = 'facebook-player-'; | ||
var Facebook = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Facebook = /*#__PURE__*/function (_Component) { | ||
_inherits(Facebook, _Component); | ||
var _super = _createSuper(Facebook); | ||
function Facebook() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -61,7 +62,7 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Facebook)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", PLAYER_ID_PREFIX + (0, _utils.randomString)()); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat((0, _utils.randomString)())); | ||
@@ -98,5 +99,5 @@ _defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
FB.init({ | ||
appId: _this2.props.config.facebook.appId, | ||
appId: _this2.props.config.appId, | ||
xfbml: true, | ||
version: 'v2.5' | ||
version: _this2.props.config.version | ||
}); | ||
@@ -184,3 +185,3 @@ FB.Event.subscribe('xfbml.render', function (msg) { | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style, | ||
@@ -204,6 +205,2 @@ id: this.playerID, | ||
_defineProperty(Facebook, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(Facebook, "loopOnEnded", true); |
@@ -12,7 +12,9 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -27,11 +29,15 @@ 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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -41,8 +47,4 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var IOS = typeof navigator !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; | ||
var AUDIO_EXTENSIONS = /\.(m4a|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i; | ||
var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)($|\?)/i; | ||
var HLS_EXTENSIONS = /\.(m3u8)($|\?)/i; | ||
var HLS_SDK_URL = 'https://cdnjs.cloudflare.com/ajax/libs/hls.js/VERSION/hls.min.js'; | ||
var HLS_SDK_URL = 'https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js'; | ||
var HLS_GLOBAL = 'Hls'; | ||
var DASH_EXTENSIONS = /\.(mpd)($|\?)/i; | ||
var DASH_SDK_URL = 'https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js'; | ||
@@ -52,64 +54,8 @@ var DASH_GLOBAL = 'dashjs'; | ||
function canPlay(url) { | ||
if (url instanceof Array) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var FilePlayer = /*#__PURE__*/function (_Component) { | ||
_inherits(FilePlayer, _Component); | ||
try { | ||
for (var _iterator = url[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var item = _step.value; | ||
var _super = _createSuper(FilePlayer); | ||
if (typeof item === 'string' && canPlay(item)) { | ||
return true; | ||
} | ||
if (canPlay(item.src)) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
if ((0, _utils.isMediaStream)(url)) { | ||
return true; | ||
} | ||
return AUDIO_EXTENSIONS.test(url) || VIDEO_EXTENSIONS.test(url) || HLS_EXTENSIONS.test(url) || DASH_EXTENSIONS.test(url); | ||
} | ||
function supportsWebKitPresentationMode(video) { | ||
if (!video) video = document.createElement('video'); // Check if Safari supports PiP, and is not on mobile (other than iPad) | ||
// iPhone safari appears to "support" PiP through the check, however PiP does not function | ||
return video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function' && !/iPhone|iPod/.test(navigator.userAgent); | ||
} | ||
function canEnablePIP(url) { | ||
return canPlay(url) && (!!document.pictureInPictureEnabled || supportsWebKitPresentationMode()) && !AUDIO_EXTENSIONS.test(url); | ||
} | ||
var FilePlayer = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(FilePlayer, _Component); | ||
function FilePlayer() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -123,3 +69,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(FilePlayer)).call.apply(_getPrototypeOf2, [this].concat(_args))); | ||
_this = _super.call.apply(_super, [this].concat(_args)); | ||
@@ -186,3 +132,3 @@ _defineProperty(_assertThisInitialized(_this), "onReady", function () { | ||
_defineProperty(_assertThisInitialized(_this), "onPresentationModeChange", function (e) { | ||
if (_this.player && supportsWebKitPresentationMode(_this.player)) { | ||
if (_this.player && (0, _utils.supportsWebKitPresentationMode)(_this.player)) { | ||
var webkitPresentationMode = _this.player.webkitPresentationMode; | ||
@@ -212,3 +158,3 @@ | ||
if (typeof source === 'string') { | ||
return _react["default"].createElement("source", { | ||
return /*#__PURE__*/_react["default"].createElement("source", { | ||
key: index, | ||
@@ -219,3 +165,3 @@ src: source | ||
return _react["default"].createElement("source", _extends({ | ||
return /*#__PURE__*/_react["default"].createElement("source", _extends({ | ||
key: index | ||
@@ -226,3 +172,3 @@ }, source)); | ||
_defineProperty(_assertThisInitialized(_this), "renderTrack", function (track, index) { | ||
return _react["default"].createElement("track", _extends({ | ||
return /*#__PURE__*/_react["default"].createElement("track", _extends({ | ||
key: index | ||
@@ -266,2 +212,6 @@ }, track)); | ||
this.removeListeners(this.player); | ||
if (this.hls) { | ||
this.hls.destroy(); | ||
} | ||
} | ||
@@ -309,11 +259,11 @@ }, { | ||
value: function shouldUseAudio(props) { | ||
if (props.config.file.forceVideo) { | ||
if (props.config.forceVideo) { | ||
return false; | ||
} | ||
if (props.config.file.attributes.poster) { | ||
if (props.config.attributes.poster) { | ||
return false; // Use <video> so that poster is shown | ||
} | ||
return AUDIO_EXTENSIONS.test(props.url) || props.config.file.forceAudio; | ||
return _patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio; | ||
} | ||
@@ -323,3 +273,3 @@ }, { | ||
value: function shouldUseHLS(url) { | ||
return HLS_EXTENSIONS.test(url) && !IOS || this.props.config.file.forceHLS; | ||
return _patterns.HLS_EXTENSIONS.test(url) && !IOS || this.props.config.forceHLS; | ||
} | ||
@@ -329,3 +279,3 @@ }, { | ||
value: function shouldUseDASH(url) { | ||
return DASH_EXTENSIONS.test(url) || this.props.config.file.forceDASH; | ||
return _patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH; | ||
} | ||
@@ -337,9 +287,10 @@ }, { | ||
var _this$props$config$fi = this.props.config.file, | ||
hlsVersion = _this$props$config$fi.hlsVersion, | ||
dashVersion = _this$props$config$fi.dashVersion; | ||
var _this$props$config = this.props.config, | ||
hlsVersion = _this$props$config.hlsVersion, | ||
hlsOptions = _this$props$config.hlsOptions, | ||
dashVersion = _this$props$config.dashVersion; | ||
if (this.shouldUseHLS(url)) { | ||
(0, _utils.getSDK)(HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(function (Hls) { | ||
_this2.hls = new Hls(_this2.props.config.file.hlsOptions); | ||
_this2.hls = new Hls(hlsOptions); | ||
@@ -401,6 +352,2 @@ _this2.hls.on(Hls.Events.ERROR, function (e, data) { | ||
if (this.hls) { | ||
this.hls.destroy(); | ||
} | ||
if (this.dash) { | ||
@@ -425,3 +372,3 @@ this.dash.reset(); | ||
this.player.requestPictureInPicture(); | ||
} else if (supportsWebKitPresentationMode(this.player) && this.player.webkitPresentationMode !== 'picture-in-picture') { | ||
} else if ((0, _utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== 'picture-in-picture') { | ||
this.player.webkitSetPresentationMode('picture-in-picture'); | ||
@@ -435,3 +382,3 @@ } | ||
document.exitPictureInPicture(); | ||
} else if (supportsWebKitPresentationMode(this.player) && this.player.webkitPresentationMode !== 'inline') { | ||
} else if ((0, _utils.supportsWebKitPresentationMode)(this.player) && this.player.webkitPresentationMode !== 'inline') { | ||
this.player.webkitSetPresentationMode('inline'); | ||
@@ -519,3 +466,3 @@ } | ||
}; | ||
return _react["default"].createElement(Element, _extends({ | ||
return /*#__PURE__*/_react["default"].createElement(Element, _extends({ | ||
ref: this.ref, | ||
@@ -529,3 +476,3 @@ src: this.getSource(url), | ||
loop: loop | ||
}, config.file.attributes), url instanceof Array && url.map(this.renderSourceElement), config.file.tracks.map(this.renderTrack)); | ||
}, config.attributes), url instanceof Array && url.map(this.renderSourceElement), config.tracks.map(this.renderTrack)); | ||
} | ||
@@ -539,6 +486,2 @@ }]); | ||
_defineProperty(FilePlayer, "displayName", 'FilePlayer'); | ||
_defineProperty(FilePlayer, "canPlay", canPlay); | ||
_defineProperty(FilePlayer, "canEnablePIP", canEnablePIP); | ||
_defineProperty(FilePlayer, "displayName", 'FilePlayer'); |
@@ -14,14 +14,21 @@ "use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
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(n); 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; } | ||
var canPlayFile = function canPlayFile(url) { | ||
if (url instanceof Array) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _iterator = _createForOfIteratorHelper(url), | ||
_step; | ||
try { | ||
for (var _iterator = url[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var item = _step.value; | ||
@@ -38,14 +45,5 @@ | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
_iterator.e(err); | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
_iterator.f(); | ||
} | ||
@@ -64,24 +62,23 @@ | ||
var _default = [{ | ||
key: 'youtube', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_YOUTUBE.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
return _interopRequireWildcard(require('./YouTube')); | ||
}); | ||
}), | ||
configKey: 'youtube', | ||
preloadUrl: 'https://www.youtube.com/watch?v=GlCmAC4MHek' | ||
}) | ||
}, { | ||
key: 'soundcloud', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_SOUNDCLOUD.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
return _interopRequireWildcard(require('./SoundCloud')); | ||
}); | ||
}), | ||
configKey: 'soundcloud', | ||
preloadUrl: 'https://soundcloud.com/seucheu/john-cage-433-8-bit-version' | ||
}) | ||
}, { | ||
key: 'vimeo', | ||
canPlay: function canPlay(url) { | ||
@@ -94,14 +91,13 @@ if (_patterns.MATCH_URL_VIMEO_FILE.test(url)) { | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
return _interopRequireWildcard(require('./Vimeo')); | ||
}); | ||
}), | ||
configKey: 'vimeo', | ||
preloadUrl: 'https://vimeo.com/300970506' | ||
}) | ||
}, { | ||
key: 'facebook', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_FACEBOOK.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -112,6 +108,7 @@ return _interopRequireWildcard(require('./Facebook')); | ||
}, { | ||
key: 'streamable', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_STREAMABLE.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -122,6 +119,7 @@ return _interopRequireWildcard(require('./Streamable')); | ||
}, { | ||
key: 'wistia', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_WISTIA.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -132,6 +130,7 @@ return _interopRequireWildcard(require('./Wistia')); | ||
}, { | ||
key: 'twitch', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_TWITCH_VIDEO.test(url) || _patterns.MATCH_URL_TWITCH_CHANNEL.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -142,17 +141,17 @@ return _interopRequireWildcard(require('./Twitch')); | ||
}, { | ||
key: 'dailymotion', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_DAILYMOTION.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
return _interopRequireWildcard(require('./DailyMotion')); | ||
}); | ||
}), | ||
configKey: 'dailymotion', | ||
preloadUrl: 'http://www.dailymotion.com/video/xqdpyk' | ||
}) | ||
}, { | ||
key: 'mixcloud', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_MIXCLOUD.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -163,6 +162,7 @@ return _interopRequireWildcard(require('./Mixcloud')); | ||
}, { | ||
key: 'vidyard', | ||
canPlay: function canPlay(url) { | ||
return _patterns.MATCH_URL_VIDYARD.test(url); | ||
}, | ||
Player: (0, _react.lazy)(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -173,4 +173,8 @@ return _interopRequireWildcard(require('./Vidyard')); | ||
}, { | ||
key: 'file', | ||
canPlay: canPlayFile, | ||
Player: (0, _react.lazy)(function () { | ||
canEnablePIP: function canEnablePIP(url) { | ||
return canPlayFile(url) && (document.pictureInPictureEnabled || (0, _utils.supportsWebKitPresentationMode)()) && !_patterns.AUDIO_EXTENSIONS.test(url); | ||
}, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
@@ -177,0 +181,0 @@ return _interopRequireWildcard(require('./FilePlayer')); |
@@ -12,11 +12,13 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,11 +31,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -44,12 +50,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL = 'Mixcloud'; | ||
var MATCH_URL = /mixcloud\.com\/([^/]+\/[^/]+)/; | ||
var Mixcloud = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Mixcloud = /*#__PURE__*/function (_Component) { | ||
_inherits(Mixcloud, _Component); | ||
var _super = _createSuper(Mixcloud); | ||
function Mixcloud() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -63,3 +66,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Mixcloud)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -162,3 +165,3 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
config = _this$props.config; | ||
var id = url.match(MATCH_URL)[1]; | ||
var id = url.match(_patterns.MATCH_URL_MIXCLOUD)[1]; | ||
var style = { | ||
@@ -168,3 +171,3 @@ width: '100%', | ||
}; | ||
var query = (0, _utils.queryString)(_objectSpread({}, config.mixcloud.options, { | ||
var query = (0, _utils.queryString)(_objectSpread({}, config.options, { | ||
feed: "/".concat(id, "/") | ||
@@ -174,3 +177,3 @@ })); // We have to give the iframe a key here to prevent a | ||
return _react["default"].createElement("iframe", { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
key: id, | ||
@@ -192,6 +195,2 @@ ref: this.ref, | ||
_defineProperty(Mixcloud, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(Mixcloud, "loopOnEnded", true); |
@@ -14,9 +14,9 @@ "use strict"; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,11 +29,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -44,12 +48,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL = 'SC'; | ||
var MATCH_URL = /(soundcloud\.com|snd\.sc)\/.+$/; | ||
var SoundCloud = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var SoundCloud = /*#__PURE__*/function (_Component) { | ||
_inherits(SoundCloud, _Component); | ||
var _super = _createSuper(SoundCloud); | ||
function SoundCloud() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -63,3 +64,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SoundCloud)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -131,3 +132,3 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_this2.player.load(url, _objectSpread({}, _this2.props.config.soundcloud.options, { | ||
_this2.player.load(url, _objectSpread({}, _this2.props.config.options, { | ||
callback: function callback() { | ||
@@ -191,3 +192,3 @@ _this2.player.getDuration(function (duration) { | ||
}; | ||
return _react["default"].createElement("iframe", { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
ref: this.ref, | ||
@@ -209,6 +210,2 @@ src: "https://w.soundcloud.com/player/?url=".concat(encodeURIComponent(this.props.url)), | ||
_defineProperty(SoundCloud, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(SoundCloud, "loopOnEnded", true); |
@@ -12,7 +12,9 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -25,11 +27,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -40,12 +46,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL = 'playerjs'; | ||
var MATCH_URL = /streamable\.com\/([a-z0-9]+)$/; | ||
var Streamable = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Streamable = /*#__PURE__*/function (_Component) { | ||
_inherits(Streamable, _Component); | ||
var _super = _createSuper(Streamable); | ||
function Streamable() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -59,3 +62,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Streamable)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -180,3 +183,3 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
value: function render() { | ||
var id = this.props.url.match(MATCH_URL)[1]; | ||
var id = this.props.url.match(_patterns.MATCH_URL_STREAMABLE)[1]; | ||
var style = { | ||
@@ -186,3 +189,3 @@ width: '100%', | ||
}; | ||
return _react["default"].createElement("iframe", { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
ref: this.ref, | ||
@@ -203,6 +206,2 @@ src: "https://streamable.com/o/".concat(id), | ||
_defineProperty(Streamable, "displayName", 'Streamable'); | ||
_defineProperty(Streamable, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(Streamable, "displayName", 'Streamable'); |
@@ -12,11 +12,13 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,11 +31,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -44,14 +50,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL = 'Twitch'; | ||
var MATCH_VIDEO_URL = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/; | ||
var MATCH_CHANNEL_URL = /(?:www\.|go\.)?twitch\.tv\/([a-z0-9_]+)($|\?)/; | ||
var PLAYER_ID_PREFIX = 'twitch-player-'; | ||
var Twitch = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Twitch = /*#__PURE__*/function (_Component) { | ||
_inherits(Twitch, _Component); | ||
var _super = _createSuper(Twitch); | ||
function Twitch() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -65,7 +67,7 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Twitch)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", PLAYER_ID_PREFIX + (0, _utils.randomString)()); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat((0, _utils.randomString)())); | ||
@@ -98,5 +100,7 @@ _defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
controls = _this$props.controls; | ||
var isChannel = MATCH_CHANNEL_URL.test(url); | ||
var id = isChannel ? url.match(MATCH_CHANNEL_URL)[1] : url.match(MATCH_VIDEO_URL)[1]; | ||
var isChannel = _patterns.MATCH_URL_TWITCH_CHANNEL.test(url); | ||
var id = isChannel ? url.match(_patterns.MATCH_URL_TWITCH_CHANNEL)[1] : url.match(_patterns.MATCH_URL_TWITCH_VIDEO)[1]; | ||
if (isReady) { | ||
@@ -123,3 +127,3 @@ if (isChannel) { | ||
controls: isChannel ? true : controls | ||
}, config.twitch.options)); | ||
}, config.options)); | ||
var _Twitch$Player = Twitch.Player, | ||
@@ -194,3 +198,3 @@ READY = _Twitch$Player.READY, | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style, | ||
@@ -209,6 +213,2 @@ id: this.playerID | ||
_defineProperty(Twitch, "canPlay", function (url) { | ||
return MATCH_VIDEO_URL.test(url) || MATCH_CHANNEL_URL.test(url); | ||
}); | ||
_defineProperty(Twitch, "loopOnEnded", true); |
@@ -12,11 +12,13 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,11 +31,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -45,12 +51,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL_READY = 'onVidyardAPI'; | ||
var MATCH_URL = /vidyard.com\/(?:watch\/)?([a-zA-Z0-9-]+)/; | ||
var Vidyard = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Vidyard = /*#__PURE__*/function (_Component) { | ||
_inherits(Vidyard, _Component); | ||
var _super = _createSuper(Vidyard); | ||
function Vidyard() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -64,3 +67,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Vidyard)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -100,3 +103,3 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
onDuration = _this$props.onDuration; | ||
var id = url && url.match(MATCH_URL)[1]; | ||
var id = url && url.match(_patterns.MATCH_URL_VIDYARD)[1]; | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (Vidyard) { | ||
@@ -120,3 +123,3 @@ if (!_this2.container) return; | ||
container: _this2.container | ||
}, config.vidyard.options)); | ||
}, config.options)); | ||
Vidyard.api.getPlayerMetadata(id).then(function (meta) { | ||
@@ -182,5 +185,5 @@ _this2.duration = meta.length_in_seconds; | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, _react["default"].createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
ref: this.ref | ||
@@ -196,6 +199,2 @@ })); | ||
_defineProperty(Vidyard, "displayName", 'Vidyard'); | ||
_defineProperty(Vidyard, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(Vidyard, "displayName", 'Vidyard'); |
@@ -14,9 +14,9 @@ "use strict"; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,11 +29,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -44,13 +48,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL = 'Vimeo'; | ||
var MATCH_URL = /vimeo\.com\/.+/; | ||
var MATCH_FILE_URL = /vimeo\.com\/external\/[0-9]+\..+/; | ||
var Vimeo = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Vimeo = /*#__PURE__*/function (_Component) { | ||
_inherits(Vimeo, _Component); | ||
var _super = _createSuper(Vimeo); | ||
function Vimeo() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -64,3 +64,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Vimeo)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -112,3 +112,3 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
controls: _this2.props.controls | ||
}, _this2.props.config.vimeo.playerOptions)); | ||
}, _this2.props.config.playerOptions)); | ||
@@ -228,3 +228,3 @@ _this2.player.ready().then(function () { | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: this.props.url, | ||
@@ -244,10 +244,2 @@ ref: this.ref, | ||
_defineProperty(Vimeo, "forceLoad", true); | ||
_defineProperty(Vimeo, "canPlay", function (url) { | ||
if (MATCH_FILE_URL.test(url)) { | ||
return false; | ||
} | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(Vimeo, "forceLoad", true); |
@@ -12,11 +12,13 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,11 +31,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -44,12 +50,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var SDK_GLOBAL = 'Wistia'; | ||
var MATCH_URL = /(?:wistia\.com|wi\.st)\/(?:medias|embed)\/(.*)$/; | ||
var Wistia = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Wistia = /*#__PURE__*/function (_Component) { | ||
_inherits(Wistia, _Component); | ||
var _super = _createSuper(Wistia); | ||
function Wistia() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -59,10 +62,34 @@ | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
_args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Wistia)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(_args)); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "onPlay", function () { | ||
var _this$props; | ||
return (_this$props = _this.props).onPlay.apply(_this$props, arguments); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "onPause", function () { | ||
var _this$props2; | ||
return (_this$props2 = _this.props).onPause.apply(_this$props2, arguments); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "onSeek", function () { | ||
var _this$props3; | ||
return (_this$props3 = _this.props).onSeek.apply(_this$props3, arguments); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "onEnded", function () { | ||
var _this$props4; | ||
return (_this$props4 = _this.props).onEnded.apply(_this$props4, arguments); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
@@ -87,3 +114,3 @@ _this.callPlayer('mute'); | ||
value: function getID(url) { | ||
return url && url.match(MATCH_URL)[1]; | ||
return url && url.match(_patterns.MATCH_URL_WISTIA)[1]; | ||
} | ||
@@ -95,13 +122,9 @@ }, { | ||
var _this$props = this.props, | ||
playing = _this$props.playing, | ||
muted = _this$props.muted, | ||
controls = _this$props.controls, | ||
_onReady = _this$props.onReady, | ||
onPlay = _this$props.onPlay, | ||
onPause = _this$props.onPause, | ||
onSeek = _this$props.onSeek, | ||
onEnded = _this$props.onEnded, | ||
config = _this$props.config, | ||
onError = _this$props.onError; | ||
var _this$props5 = this.props, | ||
playing = _this$props5.playing, | ||
muted = _this$props5.muted, | ||
controls = _this$props5.controls, | ||
_onReady = _this$props5.onReady, | ||
config = _this$props5.config, | ||
onError = _this$props5.onError; | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function () { | ||
@@ -117,3 +140,3 @@ window._wq = window._wq || []; | ||
controlsVisibleOnLoad: controls | ||
}, config.wistia.options), | ||
}, config.options), | ||
onReady: function onReady(player) { | ||
@@ -124,9 +147,9 @@ _this2.player = player; | ||
_this2.player.bind('play', onPlay); | ||
_this2.player.bind('play', _this2.onPlay); | ||
_this2.player.bind('pause', onPause); | ||
_this2.player.bind('pause', _this2.onPause); | ||
_this2.player.bind('seek', onSeek); | ||
_this2.player.bind('seek', _this2.onSeek); | ||
_this2.player.bind('end', onEnded); | ||
_this2.player.bind('end', _this2.onEnded); | ||
@@ -139,2 +162,11 @@ _onReady(); | ||
}, { | ||
key: "unbind", | ||
value: function unbind() { | ||
this.player.unbind('play', this.onPlay); | ||
this.player.unbind('pause', this.onPause); | ||
this.player.unbind('seek', this.onSeek); | ||
this.player.unbind('end', this.onEnded); | ||
} // Proxy methods to prevent listener leaks | ||
}, { | ||
key: "play", | ||
@@ -150,15 +182,2 @@ value: function play() { | ||
}, { | ||
key: "unbind", | ||
value: function unbind() { | ||
var _this$props2 = this.props, | ||
onPlay = _this$props2.onPlay, | ||
onPause = _this$props2.onPause, | ||
onSeek = _this$props2.onSeek, | ||
onEnded = _this$props2.onEnded; | ||
this.player.unbind('play', onPlay); | ||
this.player.unbind('pause', onPause); | ||
this.player.unbind('seek', onSeek); | ||
this.player.unbind('end', onEnded); | ||
} | ||
}, { | ||
key: "stop", | ||
@@ -208,3 +227,3 @@ value: function stop() { | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: id, | ||
@@ -224,6 +243,2 @@ className: className, | ||
_defineProperty(Wistia, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(Wistia, "loopOnEnded", true); |
@@ -12,11 +12,13 @@ "use strict"; | ||
var _patterns = require("../patterns"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -29,20 +31,28 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
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 _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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(n); 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 _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
@@ -53,3 +63,2 @@ | ||
var SDK_GLOBAL_READY = 'onYouTubeIframeAPIReady'; | ||
var MATCH_URL = /(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})|youtube\.com\/playlist\?list=/; | ||
var MATCH_PLAYLIST = /list=([a-zA-Z0-9_-]+)/; | ||
@@ -72,10 +81,8 @@ | ||
var YouTube = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var YouTube = /*#__PURE__*/function (_Component) { | ||
_inherits(YouTube, _Component); | ||
var _super = _createSuper(YouTube); | ||
function YouTube() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -89,3 +96,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(YouTube)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -166,6 +173,5 @@ _defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_onError = _this$props2.onError; | ||
var _config$youtube = config.youtube, | ||
playerVars = _config$youtube.playerVars, | ||
embedOptions = _config$youtube.embedOptions; | ||
var id = url && url.match(MATCH_URL)[1]; | ||
var playerVars = config.playerVars, | ||
embedOptions = config.embedOptions; | ||
var id = url && url.match(_patterns.MATCH_URL_YOUTUBE)[1]; | ||
@@ -284,5 +290,5 @@ if (isReady) { | ||
}; | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, _react["default"].createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
ref: this.ref | ||
@@ -298,6 +304,2 @@ })); | ||
_defineProperty(YouTube, "displayName", 'YouTube'); | ||
_defineProperty(YouTube, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}); | ||
_defineProperty(YouTube, "displayName", 'YouTube'); |
@@ -12,9 +12,9 @@ "use strict"; | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
@@ -27,11 +27,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -42,10 +46,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var Preview = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var Preview = /*#__PURE__*/function (_Component) { | ||
_inherits(Preview, _Component); | ||
var _super = _createSuper(Preview); | ||
function Preview() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -59,3 +61,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Preview)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
@@ -158,6 +160,6 @@ _defineProperty(_assertThisInitialized(_this), "mounted", false); | ||
var defaultPlayIcon = _react["default"].createElement("div", { | ||
var defaultPlayIcon = /*#__PURE__*/_react["default"].createElement("div", { | ||
style: styles.shadow, | ||
className: "react-player__shadow" | ||
}, _react["default"].createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
style: styles.playIcon, | ||
@@ -167,3 +169,3 @@ className: "react-player__play-icon" | ||
return _react["default"].createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: styles.preview, | ||
@@ -170,0 +172,0 @@ className: "react-player__preview", |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.DEPRECATED_CONFIG_PROPS = exports.defaultProps = exports.propTypes = void 0; | ||
exports.defaultProps = exports.propTypes = void 0; | ||
@@ -43,20 +43,18 @@ var _propTypes = _interopRequireDefault(require("prop-types")); | ||
soundcloud: shape({ | ||
options: object, | ||
preload: bool | ||
options: object | ||
}), | ||
youtube: shape({ | ||
playerVars: object, | ||
embedOptions: object, | ||
preload: bool | ||
embedOptions: object | ||
}), | ||
facebook: shape({ | ||
appId: string | ||
appId: string, | ||
version: string, | ||
playerId: string | ||
}), | ||
dailymotion: shape({ | ||
params: object, | ||
preload: bool | ||
params: object | ||
}), | ||
vimeo: shape({ | ||
playerOptions: object, | ||
preload: bool | ||
playerOptions: object | ||
}), | ||
@@ -81,3 +79,4 @@ file: shape({ | ||
twitch: shape({ | ||
options: object | ||
options: object, | ||
playerId: string | ||
}), | ||
@@ -139,7 +138,8 @@ vidyard: shape({ | ||
}, | ||
embedOptions: {}, | ||
preload: false | ||
embedOptions: {} | ||
}, | ||
facebook: { | ||
appId: '1309697205772819' | ||
appId: '1309697205772819', | ||
version: 'v3.3', | ||
playerId: null | ||
}, | ||
@@ -150,4 +150,3 @@ dailymotion: { | ||
'endscreen-enable': false | ||
}, | ||
preload: false | ||
} | ||
}, | ||
@@ -160,4 +159,3 @@ vimeo: { | ||
title: false | ||
}, | ||
preload: false | ||
} | ||
}, | ||
@@ -172,3 +170,3 @@ file: { | ||
hlsOptions: {}, | ||
hlsVersion: '0.10.1', | ||
hlsVersion: '0.13.1', | ||
dashVersion: '2.9.2' | ||
@@ -185,3 +183,4 @@ }, | ||
twitch: { | ||
options: {} | ||
options: {}, | ||
playerId: null | ||
}, | ||
@@ -206,4 +205,2 @@ vidyard: { | ||
}; | ||
exports.defaultProps = defaultProps; | ||
var DEPRECATED_CONFIG_PROPS = ['soundcloudConfig', 'youtubeConfig', 'facebookConfig', 'dailymotionConfig', 'vimeoConfig', 'fileConfig', 'wistiaConfig']; | ||
exports.DEPRECATED_CONFIG_PROPS = DEPRECATED_CONFIG_PROPS; | ||
exports.defaultProps = defaultProps; |
@@ -10,2 +10,8 @@ "use strict"; | ||
var _deepmerge = _interopRequireDefault(require("deepmerge")); | ||
var _memoizeOne = _interopRequireDefault(require("memoize-one")); | ||
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare")); | ||
var _props = require("./props"); | ||
@@ -19,22 +25,24 @@ | ||
var _preload = _interopRequireDefault(require("./preload")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -46,11 +54,15 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
@@ -61,9 +73,4 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var FilePlayer = (0, _react.lazy)(function () { | ||
return Promise.resolve().then(function () { | ||
return _interopRequireWildcard(require('./players/FilePlayer')); | ||
}); | ||
}); | ||
var Preview = (0, _react.lazy)(function () { | ||
@@ -77,10 +84,8 @@ return Promise.resolve().then(function () { | ||
var ReactPlayer = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
var ReactPlayer = /*#__PURE__*/function (_Component) { | ||
_inherits(ReactPlayer, _Component); | ||
var _super = _createSuper(ReactPlayer); | ||
function ReactPlayer() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -94,6 +99,4 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ReactPlayer)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this), "config", (0, _utils.getConfig)(_this.props, _props.defaultProps, true)); | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
@@ -103,2 +106,11 @@ showPreview: !!_this.props.light | ||
_defineProperty(_assertThisInitialized(_this), "refs", { | ||
wrapper: function wrapper(_wrapper) { | ||
_this.wrapper = _wrapper; | ||
}, | ||
player: function player(_player) { | ||
_this.player = _player; | ||
} | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleClickPreview", function () { | ||
@@ -147,8 +159,38 @@ _this.setState({ | ||
_defineProperty(_assertThisInitialized(_this), "wrapperRef", function (wrapper) { | ||
_this.wrapper = wrapper; | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getActivePlayer", (0, _memoizeOne["default"])(function (url) { | ||
for (var _i = 0, _arr = [].concat(customPlayers, _toConsumableArray(_players["default"])); _i < _arr.length; _i++) { | ||
var player = _arr[_i]; | ||
_defineProperty(_assertThisInitialized(_this), "activePlayerRef", function (player) { | ||
_this.player = player; | ||
if (player.canPlay(url)) { | ||
return player; | ||
} | ||
} // Fall back to FilePlayer if nothing else can play the URL | ||
return _players["default"][_players["default"].length - 1]; | ||
})); | ||
_defineProperty(_assertThisInitialized(_this), "getConfig", (0, _memoizeOne["default"])(function (url, key) { | ||
var config = _this.props.config; | ||
return _deepmerge["default"].all([_props.defaultProps.config, config, config[key] || {}]); | ||
})); | ||
_defineProperty(_assertThisInitialized(_this), "getAttributes", (0, _memoizeOne["default"])(function (url) { | ||
return (0, _utils.omit)(_this.props, SUPPORTED_PROPS); | ||
})); | ||
_defineProperty(_assertThisInitialized(_this), "renderActivePlayer", function (url) { | ||
if (!url) return null; | ||
var player = _this.getActivePlayer(url); | ||
var config = _this.getConfig(url, player.key); | ||
return /*#__PURE__*/_react["default"].createElement(_Player3["default"], _extends({}, _this.props, { | ||
key: player.key, | ||
ref: _this.refs.player, | ||
config: config, | ||
activePlayer: player.lazyPlayer || player, | ||
onReady: _this.handleReady | ||
})); | ||
}); | ||
@@ -160,13 +202,5 @@ | ||
_createClass(ReactPlayer, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
if (this.props.progressFrequency) { | ||
var message = 'ReactPlayer: %cprogressFrequency%c is deprecated, please use %cprogressInterval%c instead'; | ||
console.warn(message, 'font-weight: bold', '', 'font-weight: bold', ''); | ||
} | ||
} | ||
}, { | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return !(0, _utils.isEqual)(this.props, nextProps) || !(0, _utils.isEqual)(this.state, nextState); | ||
return !(0, _reactFastCompare["default"])(this.props, nextProps) || !(0, _reactFastCompare["default"])(this.state, nextState); | ||
} | ||
@@ -177,3 +211,2 @@ }, { | ||
var light = this.props.light; | ||
this.config = (0, _utils.getConfig)(this.props, _props.defaultProps); | ||
@@ -193,57 +226,9 @@ if (!prevProps.light && light) { | ||
}, { | ||
key: "getActivePlayer", | ||
value: function getActivePlayer(url) { | ||
for (var _i = 0, _arr = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players["default"])); _i < _arr.length; _i++) { | ||
var player = _arr[_i]; | ||
if (player.canPlay(url)) { | ||
return player.Player || player; | ||
} | ||
} // Fall back to FilePlayer if nothing else can play the URL | ||
return FilePlayer; | ||
} | ||
}, { | ||
key: "renderActivePlayer", | ||
value: function renderActivePlayer(url, activePlayer) { | ||
key: "renderPreview", | ||
value: function renderPreview(url) { | ||
if (!url) return null; | ||
return _react["default"].createElement(_Player3["default"], _extends({}, this.props, { | ||
key: url, | ||
ref: this.activePlayerRef, | ||
config: this.config, | ||
activePlayer: activePlayer, | ||
onReady: this.handleReady | ||
})); | ||
} | ||
}, { | ||
key: "sortPlayers", | ||
value: function sortPlayers(a, b) { | ||
// Retain player order to prevent weird iframe behaviour when switching players | ||
if (a && b) { | ||
return a.key < b.key ? -1 : 1; | ||
} | ||
return 0; | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
url = _this$props.url, | ||
controls = _this$props.controls, | ||
style = _this$props.style, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
light = _this$props.light, | ||
playIcon = _this$props.playIcon, | ||
Wrapper = _this$props.wrapper; | ||
var showPreview = this.state.showPreview && url; | ||
var otherProps = (0, _utils.omit)(this.props, SUPPORTED_PROPS, _props.DEPRECATED_CONFIG_PROPS); | ||
var activePlayer = this.getActivePlayer(url); | ||
var renderedActivePlayer = this.renderActivePlayer(url, activePlayer); | ||
var preloadPlayers = (0, _preload["default"])(url, controls, this.config); | ||
var players = [renderedActivePlayer].concat(_toConsumableArray(preloadPlayers)).sort(this.sortPlayers); | ||
var preview = _react["default"].createElement(Preview, { | ||
playIcon = _this$props.playIcon; | ||
return /*#__PURE__*/_react["default"].createElement(Preview, { | ||
url: url, | ||
@@ -254,5 +239,16 @@ light: light, | ||
}); | ||
return _react["default"].createElement(Wrapper, _extends({ | ||
ref: this.wrapperRef, | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _this$props2 = this.props, | ||
url = _this$props2.url, | ||
style = _this$props2.style, | ||
width = _this$props2.width, | ||
height = _this$props2.height, | ||
Wrapper = _this$props2.wrapper; | ||
var showPreview = this.state.showPreview; | ||
var attributes = this.getAttributes(url); | ||
return /*#__PURE__*/_react["default"].createElement(Wrapper, _extends({ | ||
ref: this.refs.wrapper, | ||
style: _objectSpread({}, style, { | ||
@@ -262,5 +258,5 @@ width: width, | ||
}) | ||
}, otherProps), _react["default"].createElement(_react.Suspense, { | ||
}, attributes), /*#__PURE__*/_react["default"].createElement(_react.Suspense, { | ||
fallback: null | ||
}, showPreview ? preview : players)); | ||
}, showPreview ? this.renderPreview(url) : this.renderActivePlayer(url))); | ||
} | ||
@@ -285,7 +281,7 @@ }]); | ||
_defineProperty(ReactPlayer, "removeCustomPlayers", function () { | ||
customPlayers = []; | ||
customPlayers.length = 0; | ||
}); | ||
_defineProperty(ReactPlayer, "canPlay", function (url) { | ||
for (var _i2 = 0, _arr2 = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players["default"])); _i2 < _arr2.length; _i2++) { | ||
for (var _i2 = 0, _arr2 = [].concat(customPlayers, _toConsumableArray(_players["default"])); _i2 < _arr2.length; _i2++) { | ||
var _Player = _arr2[_i2]; | ||
@@ -302,3 +298,3 @@ | ||
_defineProperty(ReactPlayer, "canEnablePIP", function (url) { | ||
for (var _i3 = 0, _arr3 = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players["default"])); _i3 < _arr3.length; _i3++) { | ||
for (var _i3 = 0, _arr3 = [].concat(customPlayers, _toConsumableArray(_players["default"])); _i3 < _arr3.length; _i3++) { | ||
var _Player2 = _arr3[_i3]; | ||
@@ -305,0 +301,0 @@ |
@@ -17,3 +17,3 @@ "use strict"; | ||
function renderReactPlayer(container, props) { | ||
(0, _reactDom.render)(_react["default"].createElement(_ReactPlayer["default"], props), container); | ||
(0, _reactDom.render)( /*#__PURE__*/_react["default"].createElement(_ReactPlayer["default"], props), container); | ||
} |
106
lib/utils.js
@@ -14,5 +14,4 @@ "use strict"; | ||
exports.callPlayer = callPlayer; | ||
exports.isObject = isObject; | ||
exports.isEqual = isEqual; | ||
exports.isMediaStream = isMediaStream; | ||
exports.supportsWebKitPresentationMode = supportsWebKitPresentationMode; | ||
@@ -23,15 +22,13 @@ var _loadScript = _interopRequireDefault(require("load-script")); | ||
var _props = require("./props"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
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 _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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 _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; } | ||
@@ -164,39 +161,4 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function getConfig(props, defaultProps, showWarning) { | ||
var config = (0, _deepmerge["default"])(defaultProps.config, props.config); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = _props.DEPRECATED_CONFIG_PROPS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var p = _step.value; | ||
if (props[p]) { | ||
var key = p.replace(/Config$/, ''); | ||
config = (0, _deepmerge["default"])(config, _defineProperty({}, key, props[p])); | ||
if (showWarning) { | ||
var link = 'https://github.com/CookPete/react-player#config-prop'; | ||
var message = "ReactPlayer: %c".concat(p, " %cis deprecated, please use the config prop instead \u2013 ").concat(link); | ||
console.warn(message, 'font-weight: bold', ''); | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return config; | ||
function getConfig(props, defaultProps) { | ||
return (0, _deepmerge["default"])(defaultProps.config, props.config); | ||
} | ||
@@ -252,48 +214,12 @@ | ||
function isObject(val) { | ||
return val !== null && _typeof(val) === 'object'; | ||
} // Deep comparison of two objects but ignoring | ||
// functions, for use in shouldComponentUpdate | ||
function isEqual(a, b) { | ||
if (typeof a === 'function' && typeof b === 'function') { | ||
return true; | ||
} | ||
if (a instanceof Array && b instanceof Array) { | ||
if (a.length !== b.length) { | ||
return false; | ||
} | ||
for (var i = 0; i !== a.length; i++) { | ||
if (!isEqual(a[i], b[i])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
if (isObject(a) && isObject(b)) { | ||
if (Object.keys(a).length !== Object.keys(b).length) { | ||
return false; | ||
} | ||
for (var _i3 = 0, _Object$keys = Object.keys(a); _i3 < _Object$keys.length; _i3++) { | ||
var key = _Object$keys[_i3]; | ||
if (!isEqual(a[key], b[key])) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return a === b; | ||
function isMediaStream(url) { | ||
return typeof window !== 'undefined' && typeof window.MediaStream !== 'undefined' && url instanceof window.MediaStream; | ||
} | ||
function isMediaStream(url) { | ||
return typeof window !== 'undefined' && typeof window.MediaStream !== 'undefined' && url instanceof window.MediaStream; | ||
function supportsWebKitPresentationMode() { | ||
var video = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.createElement('video'); | ||
// Check if Safari supports PiP, and is not on mobile (other than iPad) | ||
// iPhone safari appears to "support" PiP through the check, however PiP does not function | ||
var notMobile = /iPhone|iPod/.test(navigator.userAgent) === false; | ||
return video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function' && notMobile; | ||
} |
The MIT License | ||
Copyright (c) 2017 Pete Cook http://cookpete.com | ||
Copyright © Pete Cook http://cookpete.com | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "react-player", | ||
"version": "2.0.0-alpha.1", | ||
"version": "2.0.0", | ||
"description": "A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion", | ||
@@ -53,46 +53,46 @@ "main": "lib/ReactPlayer.js", | ||
"peerDependencies": { | ||
"react": "*" | ||
"react": ">=16.6.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@ava/babel": "^1.0.1", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-proposal-class-properties": "^7.5.5", | ||
"@babel/polyfill": "^7.4.4", | ||
"@babel/preset-env": "^7.5.5", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/register": "^7.5.5", | ||
"@hot-loader/react-dom": "^16.9.0", | ||
"auto-changelog": "^1.15.0", | ||
"autoprefixer": "^9.6.1", | ||
"ava": "^2.3.0", | ||
"babel-eslint": "^10.0.2", | ||
"babel-loader": "^8.0.6", | ||
"babel-plugin-istanbul": "^5.2.0", | ||
"codecov": "^3.5.0", | ||
"cross-env": "^6.0.0", | ||
"css-loader": "^3.2.0", | ||
"@babel/polyfill": "^7.8.7", | ||
"@babel/preset-env": "^7.9.5", | ||
"@babel/preset-react": "^7.9.4", | ||
"@babel/register": "^7.9.0", | ||
"@hot-loader/react-dom": "^16.13.0", | ||
"auto-changelog": "^2.0.0", | ||
"autoprefixer": "^9.7.6", | ||
"ava": "^3.6.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.1.0", | ||
"babel-plugin-istanbul": "^6.0.0", | ||
"codecov": "^3.6.5", | ||
"cross-env": "^7.0.2", | ||
"css-loader": "^3.5.2", | ||
"enzyme": "^3.10.0", | ||
"enzyme-adapter-react-16": "^1.14.0", | ||
"file-loader": "^4.2.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"mini-css-extract-plugin": "^0.8.0", | ||
"nyc": "^14.1.1", | ||
"file-loader": "^6.0.0", | ||
"html-webpack-plugin": "^4.2.0", | ||
"mini-css-extract-plugin": "^0.9.0", | ||
"nyc": "^15.0.1", | ||
"optimize-css-assets-webpack-plugin": "^5.0.3", | ||
"postcss-advanced-variables": "^3.0.0", | ||
"postcss-advanced-variables": "^3.0.1", | ||
"postcss-loader": "^3.0.0", | ||
"postcss-nested": "^4.1.2", | ||
"react": "^16.9.0", | ||
"react-dom": "^16.9.0", | ||
"react-hot-loader": "^4.12.11", | ||
"rimraf": "^3.0.0", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"react-hot-loader": "^4.12.20", | ||
"rimraf": "^3.0.2", | ||
"sanitize.css": "^11.0.0", | ||
"screenfull": "^5.0.0", | ||
"sinon": "^7.4.1", | ||
"screenfull": "^5.0.2", | ||
"sinon": "^9.0.2", | ||
"snazzy": "^8.0.0", | ||
"standard": "^14.0.0", | ||
"standard": "^14.3.3", | ||
"style-loader": "^1.0.0", | ||
"uglifyjs-webpack-plugin": "^2.2.0", | ||
"webpack": "^4.39.2", | ||
"webpack-cli": "^3.3.7", | ||
"webpack-dev-server": "^3.8.0" | ||
"webpack": "^4.42.1", | ||
"webpack-cli": "^3.3.11", | ||
"webpack-dev-server": "^3.10.3" | ||
}, | ||
@@ -102,3 +102,5 @@ "dependencies": { | ||
"load-script": "^1.0.0", | ||
"prop-types": "^15.7.2" | ||
"memoize-one": "^5.1.1", | ||
"prop-types": "^15.7.2", | ||
"react-fast-compare": "^3.0.1" | ||
}, | ||
@@ -136,2 +138,6 @@ "babel": { | ||
"ava": { | ||
"files": [ | ||
"test/**/*", | ||
"!test/helpers" | ||
], | ||
"require": [ | ||
@@ -141,5 +147,7 @@ "@babel/register", | ||
], | ||
"helpers": [ | ||
"test/helpers/*" | ||
] | ||
"babel": { | ||
"compileAsTests": [ | ||
"test/helpers/*" | ||
] | ||
} | ||
}, | ||
@@ -157,3 +165,6 @@ "nyc": { | ||
] | ||
}, | ||
"auto-changelog": { | ||
"breakingPattern": "Breaking changes:" | ||
} | ||
} |
@@ -27,2 +27,6 @@ <h1 align='center'> | ||
### Migrating to ReactPlayer `v2.0` | ||
ReactPlayer `v2.0` removes single player imports in favour of lazy loading players. Support for `preload` has also been removed, plus some other changes. See [`MIGRATING.md`](/MIGRATING.md) for information. | ||
### Usage | ||
@@ -106,3 +110,3 @@ | ||
As of version `0.24`, there is a single `config` prop to override the settings for the various players. If you are migrating from an earlier version, you must move all the old config props inside `config`: | ||
There is a single `config` prop to override settings for each type of player: | ||
@@ -123,12 +127,2 @@ ```jsx | ||
The old style [config props](https://github.com/CookPete/react-player/tree/v0.23.0#config-props) still work but will produce a console warning: | ||
```jsx | ||
<ReactPlayer | ||
url={url} | ||
youtubeConfig={{ playerVars: { showinfo: 1 } }} | ||
facebookConfig={{ appId: '12345' }} | ||
/> | ||
``` | ||
Settings for each player live under different keys: | ||
@@ -138,16 +132,12 @@ | ||
--- | ------- | ||
`youtube` | `playerVars`: Override the [default player vars](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5)<br />`embedOptions`: Override the [default embed options](https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player)<br />`preload`: Used for [preloading](#preloading) | ||
`facebook` | `appId`: Your own [Facebook app ID](https://developers.facebook.com/docs/apps/register#app-id) | ||
`soundcloud` | `options`: Override the [default player options](https://developers.soundcloud.com/docs/api/html5-widget#params)<br />`preload`: Used for [preloading](#preloading) | ||
`vimeo` | `playerOptions`: Override the [default params](https://developer.vimeo.com/player/embedding#universal-parameters)<br />`preload`: Used for [preloading](#preloading) | ||
`youtube` | `playerVars`: Override the [default player vars](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5)<br />`embedOptions`: Override the [default embed options](https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player) | ||
`facebook` | `appId`: Your own [Facebook app ID](https://developers.facebook.com/docs/apps/register#app-id)<br />`version`: Facebook SDK version<br />`playerId`: Override player ID for consistent server-side rendering (use with [`react-uid`](https://github.com/thearnica/react-uid)) | ||
`soundcloud` | `options`: Override the [default player options](https://developers.soundcloud.com/docs/api/html5-widget#params) | ||
`vimeo` | `playerOptions`: Override the [default params](https://developer.vimeo.com/player/sdk/embed) | ||
`wistia` | `options`: Override the [default player options](https://wistia.com/doc/embed-options#options_list) | ||
`mixcloud` | `options`: Override the [default player options](https://www.mixcloud.com/developers/widget/#methods) | ||
`dailymotion` | `params`: Override the [default player vars](https://developer.dailymotion.com/player#player-parameters)<br />`preload`: Used for [preloading](#preloading) | ||
`twitch` | `options`: Override the [default player options](https://dev.twitch.tv/docs/embed) | ||
`file` | `attributes`: Apply [element attributes](https://developer.mozilla.org/en/docs/Web/HTML/Element/video#Attributes)<br />`forceVideo`: Always render a `<video>` element<br />`forceAudio`: Always render an `<audio>` element<br />`forceHLS`: Use [hls.js](https://github.com/video-dev/hls.js) for HLS streams<br />`forceDASH`: Always use [dash.js](https://github.com/Dash-Industry-Forum/dash.js) for DASH streams<br />`hlsOptions`: Override the [default `hls.js` options](https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning)<br />`hlsVersion`: Override the [`hls.js`](https://github.com/video-dev/hls.js) version loaded from [`cdnjs`](https://cdnjs.com/libraries/hls.js), default: `0.10.1`<br />`dashVersion`: Override the [`dash.js`](https://github.com/Dash-Industry-Forum/dash.js) version loaded from [`cdnjs`](https://cdnjs.com/libraries/dashjs), default: `2.9.2` | ||
`dailymotion` | `params`: Override the [default player vars](https://developer.dailymotion.com/player#player-parameters) | ||
`twitch` | `options`: Override the [default player options](https://dev.twitch.tv/docs/embed)<br />`playerId`: Override player ID for consistent server-side rendering (use with [`react-uid`](https://github.com/thearnica/react-uid)) | ||
`file` | `attributes`: Apply [element attributes](https://developer.mozilla.org/en/docs/Web/HTML/Element/video#Attributes)<br />`forceVideo`: Always render a `<video>` element<br />`forceAudio`: Always render an `<audio>` element<br />`forceHLS`: Use [hls.js](https://github.com/video-dev/hls.js) for HLS streams<br />`forceDASH`: Always use [dash.js](https://github.com/Dash-Industry-Forum/dash.js) for DASH streams<br />`hlsOptions`: Override the [default `hls.js` options](https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning)<br />`hlsVersion`: Override the [`hls.js`](https://github.com/video-dev/hls.js) version loaded from [`cdnjs`](https://cdnjs.com/libraries/hls.js), default: `0.13.1`<br />`dashVersion`: Override the [`dash.js`](https://github.com/Dash-Industry-Forum/dash.js) version loaded from [`cdnjs`](https://cdnjs.com/libraries/dashjs), default: `2.9.2` | ||
##### Preloading | ||
When `preload` is set to `true` for players that support it, a short, silent video is played in the background when `ReactPlayer` first mounts. This fixes a [bug](https://github.com/CookPete/react-player/issues/7) where videos would not play when loaded in a background browser tab. | ||
### Methods | ||
@@ -227,19 +217,2 @@ | ||
#### Single player imports | ||
If you are only ever playing a single type of URL, you can import individual players to keep your bundle size down: | ||
```jsx | ||
import YouTubePlayer from 'react-player/lib/players/YouTube' | ||
<YouTubePlayer | ||
url='https://www.youtube.com/watch?v=d46Azg3Pm4c' | ||
playing | ||
controls | ||
// Other ReactPlayer props will work here | ||
/> | ||
``` | ||
See a list of available players [here](https://github.com/CookPete/react-player/tree/master/src/players). | ||
#### Standalone player | ||
@@ -326,3 +299,3 @@ | ||
[`<track>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track) elements for subtitles can be added using `fileConfig`: | ||
[`<track>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track) elements for subtitles can be added using `config.file`: | ||
@@ -350,3 +323,3 @@ ```jsx | ||
* Vidme videos are [no longer supported](https://medium.com/vidme/goodbye-for-now-120b40becafa) | ||
* Vimeo videos use the [Vimeo Player API](https://developer.vimeo.com/player/js-api) | ||
* Vimeo videos use the [Vimeo Player API](https://developer.vimeo.com/player/sdk) | ||
* Wistia videos use the [Wistia Player API](https://wistia.com/doc/player-api) | ||
@@ -353,0 +326,0 @@ * Twitch videos use the [Twitch Interactive Frames API](https://dev.twitch.tv/docs/embed#interactive-frames-for-live-streams-and-vods) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1166950
0
0
6
4748
334
+ Addedmemoize-one@^5.1.1
+ Addedreact-fast-compare@^3.0.1
+ Addedmemoize-one@5.2.1(transitive)
+ Addedreact-fast-compare@3.2.2(transitive)