react-player
Advanced tools
Comparing version 2.2.0-beta.0 to 2.2.0-beta.1
@@ -0,1 +1,9 @@ | ||
const getExcludes = lazy => { | ||
if (lazy) { | ||
// Disable transforming `import()` statements to enable lazy players | ||
return ['@babel/plugin-proposal-dynamic-import'] | ||
} | ||
return [] | ||
} | ||
module.exports = { | ||
@@ -5,5 +13,3 @@ presets: [ | ||
'@babel/preset-env', | ||
// Set modules: false to not transform `import()` | ||
// statements and enable lazy loaded players | ||
{ modules: process.env.LAZY ? false : 'auto' } | ||
{ exclude: getExcludes(process.env.LAZY) } | ||
], | ||
@@ -10,0 +16,0 @@ '@babel/preset-react' |
@@ -1,5 +0,19 @@ | ||
import players from './players'; | ||
import { createReactPlayer } from './ReactPlayer'; // Fall back to FilePlayer if nothing else can play the URL | ||
"use strict"; | ||
var fallback = players[players.length - 1]; | ||
export default createReactPlayer(players, fallback); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _players = _interopRequireDefault(require("./players")); | ||
var _ReactPlayer = require("./ReactPlayer"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
// Fall back to FilePlayer if nothing else can play the URL | ||
var fallback = _players["default"][_players["default"].length - 1]; | ||
var _default = (0, _ReactPlayer.createReactPlayer)(_players["default"], fallback); | ||
exports["default"] = _default; |
@@ -0,1 +1,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.canPlay = exports.DASH_EXTENSIONS = exports.HLS_EXTENSIONS = exports.VIDEO_EXTENSIONS = exports.AUDIO_EXTENSIONS = exports.MATCH_URL_VIDYARD = exports.MATCH_URL_MIXCLOUD = exports.MATCH_URL_DAILYMOTION = exports.MATCH_URL_TWITCH_CHANNEL = exports.MATCH_URL_TWITCH_VIDEO = exports.MATCH_URL_WISTIA = exports.MATCH_URL_STREAMABLE = exports.MATCH_URL_FACEBOOK = exports.MATCH_URL_VIMEO = exports.MATCH_URL_SOUNDCLOUD = exports.MATCH_URL_YOUTUBE = void 0; | ||
var _utils = require("./utils"); | ||
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; } } }; } | ||
@@ -7,18 +16,32 @@ | ||
import { isMediaStream } from './utils'; | ||
export var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//; | ||
export var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/; | ||
export var MATCH_URL_VIMEO = /vimeo\.com\/.+/; | ||
export var MATCH_URL_FACEBOOK = /^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/; | ||
export var MATCH_URL_STREAMABLE = /streamable\.com\/([a-z0-9]+)$/; | ||
export var MATCH_URL_WISTIA = /(?:wistia\.com|wi\.st)\/(?:medias|embed)\/(.*)$/; | ||
export var MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/; | ||
export var MATCH_URL_TWITCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/; | ||
export var MATCH_URL_DAILYMOTION = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?$/; | ||
export var MATCH_URL_MIXCLOUD = /mixcloud\.com\/([^/]+\/[^/]+)/; | ||
export var MATCH_URL_VIDYARD = /vidyard.com\/(?:watch\/)?([a-zA-Z0-9-]+)/; | ||
export var AUDIO_EXTENSIONS = /\.(m4a|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i; | ||
export var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)($|\?)/i; | ||
export var HLS_EXTENSIONS = /\.(m3u8)($|\?)/i; | ||
export var DASH_EXTENSIONS = /\.(mpd)($|\?)/i; | ||
var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//; | ||
exports.MATCH_URL_YOUTUBE = MATCH_URL_YOUTUBE; | ||
var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/; | ||
exports.MATCH_URL_SOUNDCLOUD = MATCH_URL_SOUNDCLOUD; | ||
var MATCH_URL_VIMEO = /vimeo\.com\/.+/; | ||
exports.MATCH_URL_VIMEO = MATCH_URL_VIMEO; | ||
var MATCH_URL_FACEBOOK = /^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/; | ||
exports.MATCH_URL_FACEBOOK = MATCH_URL_FACEBOOK; | ||
var MATCH_URL_STREAMABLE = /streamable\.com\/([a-z0-9]+)$/; | ||
exports.MATCH_URL_STREAMABLE = MATCH_URL_STREAMABLE; | ||
var MATCH_URL_WISTIA = /(?:wistia\.com|wi\.st)\/(?:medias|embed)\/(.*)$/; | ||
exports.MATCH_URL_WISTIA = MATCH_URL_WISTIA; | ||
var MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/; | ||
exports.MATCH_URL_TWITCH_VIDEO = MATCH_URL_TWITCH_VIDEO; | ||
var MATCH_URL_TWITCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/; | ||
exports.MATCH_URL_TWITCH_CHANNEL = MATCH_URL_TWITCH_CHANNEL; | ||
var MATCH_URL_DAILYMOTION = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?$/; | ||
exports.MATCH_URL_DAILYMOTION = MATCH_URL_DAILYMOTION; | ||
var MATCH_URL_MIXCLOUD = /mixcloud\.com\/([^/]+\/[^/]+)/; | ||
exports.MATCH_URL_MIXCLOUD = MATCH_URL_MIXCLOUD; | ||
var MATCH_URL_VIDYARD = /vidyard.com\/(?:watch\/)?([a-zA-Z0-9-]+)/; | ||
exports.MATCH_URL_VIDYARD = MATCH_URL_VIDYARD; | ||
var AUDIO_EXTENSIONS = /\.(m4a|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i; | ||
exports.AUDIO_EXTENSIONS = AUDIO_EXTENSIONS; | ||
var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)($|\?)/i; | ||
exports.VIDEO_EXTENSIONS = VIDEO_EXTENSIONS; | ||
var HLS_EXTENSIONS = /\.(m3u8)($|\?)/i; | ||
exports.HLS_EXTENSIONS = HLS_EXTENSIONS; | ||
var DASH_EXTENSIONS = /\.(mpd)($|\?)/i; | ||
exports.DASH_EXTENSIONS = DASH_EXTENSIONS; | ||
@@ -51,3 +74,3 @@ var canPlayFile = function canPlayFile(url) { | ||
if (isMediaStream(url)) { | ||
if ((0, _utils.isMediaStream)(url)) { | ||
return true; | ||
@@ -59,3 +82,3 @@ } | ||
export var canPlay = { | ||
var canPlay = { | ||
youtube: function youtube(url) { | ||
@@ -98,2 +121,3 @@ if (url instanceof Array) { | ||
file: canPlayFile | ||
}; | ||
}; | ||
exports.canPlay = canPlay; |
@@ -0,1 +1,20 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare")); | ||
var _props = require("./props"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import isEqual from 'react-fast-compare'; | ||
import { propTypes, defaultProps } from './props'; | ||
var SEEK_ON_PLAY_EXPIRY = 5000; | ||
@@ -258,3 +274,3 @@ | ||
if (!isEqual(prevProps.url, url)) { | ||
if (!(0, _reactFastCompare["default"])(prevProps.url, url)) { | ||
if (this.isLoading && !activePlayer.forceLoad) { | ||
@@ -373,3 +389,3 @@ console.warn("ReactPlayer: the attempt to load ".concat(url, " is being deferred until the player has loaded")); | ||
return /*#__PURE__*/React.createElement(Player, _extends({}, this.props, { | ||
return /*#__PURE__*/_react["default"].createElement(Player, _extends({}, this.props, { | ||
onMount: this.handlePlayerMount, | ||
@@ -387,10 +403,10 @@ onReady: this.handleReady, | ||
return Player; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Player; | ||
_defineProperty(Player, "displayName", 'Player'); | ||
_defineProperty(Player, "propTypes", propTypes); | ||
_defineProperty(Player, "propTypes", _props.propTypes); | ||
_defineProperty(Player, "defaultProps", defaultProps); | ||
export { Player as default }; | ||
_defineProperty(Player, "defaultProps", _props.defaultProps); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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); } | ||
@@ -41,5 +58,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK, parseStartTime } from '../utils'; | ||
import { canPlay, MATCH_URL_DAILYMOTION } from '../patterns'; | ||
var SDK_URL = 'https://api.dmcdn.net/all.js'; | ||
@@ -65,3 +79,3 @@ var SDK_GLOBAL = 'DM'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -105,3 +119,3 @@ _defineProperty(_assertThisInitialized(_this), "onDurationChange", function () { | ||
var _url$match = url.match(MATCH_URL_DAILYMOTION), | ||
var _url$match = url.match(_patterns.MATCH_URL_DAILYMOTION), | ||
_url$match2 = _slicedToArray(_url$match, 2), | ||
@@ -112,3 +126,3 @@ id = _url$match2[1]; | ||
this.player.load(id, { | ||
start: parseStartTime(url), | ||
start: (0, _utils.parseStartTime)(url), | ||
autoplay: playing | ||
@@ -119,3 +133,3 @@ }); | ||
getSDK(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (DM) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (DM) { | ||
return DM.player; | ||
@@ -133,3 +147,3 @@ }).then(function (DM) { | ||
mute: _this2.props.muted, | ||
start: parseStartTime(url), | ||
start: (0, _utils.parseStartTime)(url), | ||
origin: window.location.origin | ||
@@ -202,5 +216,5 @@ }, config.params), | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, /*#__PURE__*/React.createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
ref: this.ref | ||
@@ -212,10 +226,10 @@ })); | ||
return DailyMotion; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = DailyMotion; | ||
_defineProperty(DailyMotion, "displayName", 'DailyMotion'); | ||
_defineProperty(DailyMotion, "canPlay", canPlay.dailymotion); | ||
_defineProperty(DailyMotion, "canPlay", _patterns.canPlay.dailymotion); | ||
_defineProperty(DailyMotion, "loopOnEnded", true); | ||
export { DailyMotion as default }; | ||
_defineProperty(DailyMotion, "loopOnEnded", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +42,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK, randomString } from '../utils'; | ||
import { canPlay } from '../patterns'; | ||
var SDK_URL = 'https://connect.facebook.net/en_US/sdk.js'; | ||
@@ -50,5 +64,5 @@ var SDK_GLOBAL = 'FB'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat(randomString())); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat((0, _utils.randomString)())); | ||
@@ -77,3 +91,3 @@ _defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
if (isReady) { | ||
getSDK(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { | ||
return FB.XFBML.parse(); | ||
@@ -84,3 +98,3 @@ }); | ||
getSDK(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { | ||
FB.init({ | ||
@@ -172,3 +186,3 @@ appId: _this2.props.config.appId, | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style, | ||
@@ -186,10 +200,10 @@ id: this.playerID, | ||
return Facebook; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Facebook; | ||
_defineProperty(Facebook, "displayName", 'Facebook'); | ||
_defineProperty(Facebook, "canPlay", canPlay.facebook); | ||
_defineProperty(Facebook, "canPlay", _patterns.canPlay.facebook); | ||
_defineProperty(Facebook, "loopOnEnded", true); | ||
export { Facebook as default }; | ||
_defineProperty(Facebook, "loopOnEnded", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +44,2 @@ | ||
import React, { Component } from 'react'; | ||
import { getSDK, isMediaStream, supportsWebKitPresentationMode } from '../utils'; | ||
import { canPlay, AUDIO_EXTENSIONS, HLS_EXTENSIONS, DASH_EXTENSIONS } from '../patterns'; | ||
var IOS = typeof navigator !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; | ||
@@ -114,3 +128,3 @@ var HLS_SDK_URL = 'https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js'; | ||
_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; | ||
@@ -140,3 +154,3 @@ | ||
if (typeof source === 'string') { | ||
return /*#__PURE__*/React.createElement("source", { | ||
return /*#__PURE__*/_react["default"].createElement("source", { | ||
key: index, | ||
@@ -147,3 +161,3 @@ src: source | ||
return /*#__PURE__*/React.createElement("source", _extends({ | ||
return /*#__PURE__*/_react["default"].createElement("source", _extends({ | ||
key: index | ||
@@ -154,3 +168,3 @@ }, source)); | ||
_defineProperty(_assertThisInitialized(_this), "renderTrack", function (track, index) { | ||
return /*#__PURE__*/React.createElement("track", _extends({ | ||
return /*#__PURE__*/_react["default"].createElement("track", _extends({ | ||
key: index | ||
@@ -248,3 +262,3 @@ }, track)); | ||
return AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio; | ||
return _patterns.AUDIO_EXTENSIONS.test(props.url) || props.config.forceAudio; | ||
} | ||
@@ -254,3 +268,3 @@ }, { | ||
value: function shouldUseHLS(url) { | ||
return HLS_EXTENSIONS.test(url) && !IOS || this.props.config.forceHLS; | ||
return _patterns.HLS_EXTENSIONS.test(url) && !IOS || this.props.config.forceHLS; | ||
} | ||
@@ -260,3 +274,3 @@ }, { | ||
value: function shouldUseDASH(url) { | ||
return DASH_EXTENSIONS.test(url) || this.props.config.forceDASH; | ||
return _patterns.DASH_EXTENSIONS.test(url) || this.props.config.forceDASH; | ||
} | ||
@@ -282,3 +296,3 @@ }, { | ||
if (this.shouldUseHLS(url)) { | ||
getSDK(HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(function (Hls) { | ||
(0, _utils.getSDK)(HLS_SDK_URL.replace('VERSION', hlsVersion), HLS_GLOBAL).then(function (Hls) { | ||
_this2.hls = new Hls(hlsOptions); | ||
@@ -297,3 +311,3 @@ | ||
if (this.shouldUseDASH(url)) { | ||
getSDK(DASH_SDK_URL.replace('VERSION', dashVersion), DASH_GLOBAL).then(function (dashjs) { | ||
(0, _utils.getSDK)(DASH_SDK_URL.replace('VERSION', dashVersion), DASH_GLOBAL).then(function (dashjs) { | ||
_this2.dash = dashjs.MediaPlayer().create(); | ||
@@ -315,3 +329,3 @@ | ||
this.player.load(); | ||
} else if (isMediaStream(url)) { | ||
} else if ((0, _utils.isMediaStream)(url)) { | ||
try { | ||
@@ -362,3 +376,3 @@ this.player.srcObject = url; | ||
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'); | ||
@@ -372,3 +386,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'); | ||
@@ -428,3 +442,3 @@ } | ||
if (url instanceof Array || isMediaStream(url) || useHLS || useDASH) { | ||
if (url instanceof Array || (0, _utils.isMediaStream)(url) || useHLS || useDASH) { | ||
return undefined; | ||
@@ -457,3 +471,3 @@ } | ||
}; | ||
return /*#__PURE__*/React.createElement(Element, _extends({ | ||
return /*#__PURE__*/_react["default"].createElement(Element, _extends({ | ||
ref: this.ref, | ||
@@ -472,8 +486,8 @@ src: this.getSource(url), | ||
return FilePlayer; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = FilePlayer; | ||
_defineProperty(FilePlayer, "displayName", 'FilePlayer'); | ||
_defineProperty(FilePlayer, "canPlay", canPlay.file); | ||
export { FilePlayer as default }; | ||
_defineProperty(FilePlayer, "canPlay", _patterns.canPlay.file); |
@@ -1,9 +0,19 @@ | ||
import { lazy } from 'react'; | ||
import { supportsWebKitPresentationMode } from '../utils'; | ||
import { canPlay, AUDIO_EXTENSIONS } from '../patterns'; | ||
export default [{ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = require("react"); | ||
var _utils = require("../utils"); | ||
var _patterns = require("../patterns"); | ||
var _default = [{ | ||
key: 'youtube', | ||
name: 'YouTube', | ||
canPlay: canPlay.youtube, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.youtube, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -16,4 +26,4 @@ /* webpackChunkName: 'reactPlayerYouTube' */ | ||
name: 'SoundCloud', | ||
canPlay: canPlay.soundcloud, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.soundcloud, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -26,4 +36,4 @@ /* webpackChunkName: 'reactPlayerSoundCloud' */ | ||
name: 'Vimeo', | ||
canPlay: canPlay.vimeo, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.vimeo, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -36,4 +46,4 @@ /* webpackChunkName: 'reactPlayerVimeo' */ | ||
name: 'Facebook', | ||
canPlay: canPlay.facebook, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.facebook, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -46,4 +56,4 @@ /* webpackChunkName: 'reactPlayerFacebook' */ | ||
name: 'Streamable', | ||
canPlay: canPlay.streamable, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.streamable, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -56,4 +66,4 @@ /* webpackChunkName: 'reactPlayerStreamable' */ | ||
name: 'Wistia', | ||
canPlay: canPlay.wistia, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.wistia, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -66,4 +76,4 @@ /* webpackChunkName: 'reactPlayerWistia' */ | ||
name: 'Twitch', | ||
canPlay: canPlay.twitch, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.twitch, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -76,4 +86,4 @@ /* webpackChunkName: 'reactPlayerTwitch' */ | ||
name: 'DailyMotion', | ||
canPlay: canPlay.dailymotion, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.dailymotion, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -86,4 +96,4 @@ /* webpackChunkName: 'reactPlayerDailyMotion' */ | ||
name: 'Mixcloud', | ||
canPlay: canPlay.mixcloud, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.mixcloud, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -96,4 +106,4 @@ /* webpackChunkName: 'reactPlayerMixcloud' */ | ||
name: 'Vidyard', | ||
canPlay: canPlay.vidyard, | ||
lazyPlayer: lazy(function () { | ||
canPlay: _patterns.canPlay.vidyard, | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -106,7 +116,7 @@ /* webpackChunkName: 'reactPlayerVidyard' */ | ||
name: 'FilePlayer', | ||
canPlay: canPlay.file, | ||
canPlay: _patterns.canPlay.file, | ||
canEnablePIP: function canEnablePIP(url) { | ||
return canPlay.file(url) && (document.pictureInPictureEnabled || supportsWebKitPresentationMode()) && !AUDIO_EXTENSIONS.test(url); | ||
return _patterns.canPlay.file(url) && (document.pictureInPictureEnabled || (0, _utils.supportsWebKitPresentationMode)()) && !_patterns.AUDIO_EXTENSIONS.test(url); | ||
}, | ||
lazyPlayer: lazy(function () { | ||
lazyPlayer: (0, _react.lazy)(function () { | ||
return import( | ||
@@ -116,2 +126,3 @@ /* webpackChunkName: 'reactPlayerFilePlayer' */ | ||
}) | ||
}]; | ||
}]; | ||
exports["default"] = _default; |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK, queryString } from '../utils'; | ||
import { canPlay, MATCH_URL_MIXCLOUD } from '../patterns'; | ||
var SDK_URL = 'https://widget.mixcloud.com/media/js/widgetApi.js'; | ||
@@ -52,3 +66,3 @@ var SDK_GLOBAL = 'Mixcloud'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -84,3 +98,3 @@ _defineProperty(_assertThisInitialized(_this), "duration", null); | ||
getSDK(SDK_URL, SDK_GLOBAL).then(function (Mixcloud) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function (Mixcloud) { | ||
_this2.player = Mixcloud.PlayerWidget(_this2.iframe); | ||
@@ -150,3 +164,3 @@ | ||
config = _this$props.config; | ||
var id = url.match(MATCH_URL_MIXCLOUD)[1]; | ||
var id = url.match(_patterns.MATCH_URL_MIXCLOUD)[1]; | ||
var style = { | ||
@@ -156,3 +170,3 @@ width: '100%', | ||
}; | ||
var query = queryString(_objectSpread({}, config.options, { | ||
var query = (0, _utils.queryString)(_objectSpread({}, config.options, { | ||
feed: "/".concat(id, "/") | ||
@@ -162,3 +176,3 @@ })); // We have to give the iframe a key here to prevent a | ||
return /*#__PURE__*/React.createElement("iframe", { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
key: id, | ||
@@ -174,10 +188,10 @@ ref: this.ref, | ||
return Mixcloud; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Mixcloud; | ||
_defineProperty(Mixcloud, "displayName", 'Mixcloud'); | ||
_defineProperty(Mixcloud, "canPlay", canPlay.mixcloud); | ||
_defineProperty(Mixcloud, "canPlay", _patterns.canPlay.mixcloud); | ||
_defineProperty(Mixcloud, "loopOnEnded", true); | ||
export { Mixcloud as default }; | ||
_defineProperty(Mixcloud, "loopOnEnded", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK } from '../utils'; | ||
import { canPlay } from '../patterns'; | ||
var SDK_URL = 'https://w.soundcloud.com/player/api.js'; | ||
@@ -52,3 +66,3 @@ var SDK_GLOBAL = 'SC'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -88,3 +102,3 @@ _defineProperty(_assertThisInitialized(_this), "duration", null); | ||
getSDK(SDK_URL, SDK_GLOBAL).then(function (SC) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function (SC) { | ||
if (!_this2.iframe) return; | ||
@@ -187,3 +201,3 @@ var _SC$Widget$Events = SC.Widget.Events, | ||
}; | ||
return /*#__PURE__*/React.createElement("iframe", { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
ref: this.ref, | ||
@@ -199,10 +213,10 @@ src: "https://w.soundcloud.com/player/?url=".concat(encodeURIComponent(this.props.url)), | ||
return SoundCloud; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = SoundCloud; | ||
_defineProperty(SoundCloud, "displayName", 'SoundCloud'); | ||
_defineProperty(SoundCloud, "canPlay", canPlay.soundcloud); | ||
_defineProperty(SoundCloud, "canPlay", _patterns.canPlay.soundcloud); | ||
_defineProperty(SoundCloud, "loopOnEnded", true); | ||
export { SoundCloud as default }; | ||
_defineProperty(SoundCloud, "loopOnEnded", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +42,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK } from '../utils'; | ||
import { canPlay, MATCH_URL_STREAMABLE } from '../patterns'; | ||
var SDK_URL = 'https://cdn.embed.ly/player-0.1.0.min.js'; | ||
@@ -48,3 +62,3 @@ var SDK_GLOBAL = 'playerjs'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -82,3 +96,3 @@ _defineProperty(_assertThisInitialized(_this), "duration", null); | ||
getSDK(SDK_URL, SDK_GLOBAL).then(function (playerjs) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function (playerjs) { | ||
if (!_this2.iframe) return; | ||
@@ -168,3 +182,3 @@ _this2.player = new playerjs.Player(_this2.iframe); | ||
value: function render() { | ||
var id = this.props.url.match(MATCH_URL_STREAMABLE)[1]; | ||
var id = this.props.url.match(_patterns.MATCH_URL_STREAMABLE)[1]; | ||
var style = { | ||
@@ -174,3 +188,3 @@ width: '100%', | ||
}; | ||
return /*#__PURE__*/React.createElement("iframe", { | ||
return /*#__PURE__*/_react["default"].createElement("iframe", { | ||
ref: this.ref, | ||
@@ -187,8 +201,8 @@ src: "https://streamable.com/o/".concat(id), | ||
return Streamable; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Streamable; | ||
_defineProperty(Streamable, "displayName", 'Streamable'); | ||
_defineProperty(Streamable, "canPlay", canPlay.streamable); | ||
export { Streamable as default }; | ||
_defineProperty(Streamable, "canPlay", _patterns.canPlay.streamable); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK, randomString } from '../utils'; | ||
import { canPlay, MATCH_URL_TWITCH_CHANNEL, MATCH_URL_TWITCH_VIDEO } from '../patterns'; | ||
var SDK_URL = 'https://player.twitch.tv/js/embed/v1.js'; | ||
@@ -53,5 +67,5 @@ var SDK_GLOBAL = 'Twitch'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat(randomString())); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", _this.props.config.playerId || "".concat(PLAYER_ID_PREFIX).concat((0, _utils.randomString)())); | ||
@@ -84,5 +98,7 @@ _defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
controls = _this$props.controls; | ||
var isChannel = MATCH_URL_TWITCH_CHANNEL.test(url); | ||
var id = isChannel ? url.match(MATCH_URL_TWITCH_CHANNEL)[1] : url.match(MATCH_URL_TWITCH_VIDEO)[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) { | ||
@@ -98,3 +114,3 @@ if (isChannel) { | ||
getSDK(SDK_URL, SDK_GLOBAL).then(function (Twitch) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function (Twitch) { | ||
_this2.player = new Twitch.Player(_this2.playerID, _objectSpread({ | ||
@@ -180,3 +196,3 @@ video: isChannel ? '' : id, | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style, | ||
@@ -189,10 +205,10 @@ id: this.playerID | ||
return Twitch; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Twitch; | ||
_defineProperty(Twitch, "displayName", 'Twitch'); | ||
_defineProperty(Twitch, "canPlay", canPlay.twitch); | ||
_defineProperty(Twitch, "canPlay", _patterns.canPlay.twitch); | ||
_defineProperty(Twitch, "loopOnEnded", true); | ||
export { Twitch as default }; | ||
_defineProperty(Twitch, "loopOnEnded", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK } from '../utils'; | ||
import { canPlay, MATCH_URL_VIDYARD } from '../patterns'; | ||
var SDK_URL = 'https://play.vidyard.com/embed/v4.js'; | ||
@@ -53,3 +67,3 @@ var SDK_GLOBAL = 'VidyardV4'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -88,3 +102,3 @@ _defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
onDuration = _this$props.onDuration; | ||
var id = url && url.match(MATCH_URL_VIDYARD)[1]; | ||
var id = url && url.match(_patterns.MATCH_URL_VIDYARD)[1]; | ||
@@ -95,3 +109,3 @@ if (this.player) { | ||
getSDK(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (Vidyard) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (Vidyard) { | ||
if (!_this2.container) return; | ||
@@ -176,5 +190,5 @@ Vidyard.api.addReadyListener(function (data, player) { | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, /*#__PURE__*/React.createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
ref: this.ref | ||
@@ -186,8 +200,8 @@ })); | ||
return Vidyard; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Vidyard; | ||
_defineProperty(Vidyard, "displayName", 'Vidyard'); | ||
_defineProperty(Vidyard, "canPlay", canPlay.vidyard); | ||
export { Vidyard as default }; | ||
_defineProperty(Vidyard, "canPlay", _patterns.canPlay.vidyard); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK } from '../utils'; | ||
import { canPlay } from '../patterns'; | ||
var SDK_URL = 'https://player.vimeo.com/api/player.js'; | ||
@@ -52,3 +66,3 @@ var SDK_GLOBAL = 'Vimeo'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -89,3 +103,3 @@ _defineProperty(_assertThisInitialized(_this), "duration", null); | ||
this.duration = null; | ||
getSDK(SDK_URL, SDK_GLOBAL).then(function (Vimeo) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function (Vimeo) { | ||
if (!_this2.container) return; | ||
@@ -214,3 +228,3 @@ _this2.player = new Vimeo.Player(_this2.container, _objectSpread({ | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: this.props.url, | ||
@@ -224,10 +238,10 @@ ref: this.ref, | ||
return Vimeo; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Vimeo; | ||
_defineProperty(Vimeo, "displayName", 'Vimeo'); | ||
_defineProperty(Vimeo, "canPlay", canPlay.vimeo); | ||
_defineProperty(Vimeo, "canPlay", _patterns.canPlay.vimeo); | ||
_defineProperty(Vimeo, "forceLoad", true); | ||
export { Vimeo as default }; | ||
_defineProperty(Vimeo, "forceLoad", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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,5 +46,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK } from '../utils'; | ||
import { canPlay, MATCH_URL_WISTIA } from '../patterns'; | ||
var SDK_URL = 'https://fast.wistia.com/assets/external/E-v1.js'; | ||
@@ -52,3 +66,3 @@ var SDK_GLOBAL = 'Wistia'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -98,3 +112,3 @@ _defineProperty(_assertThisInitialized(_this), "onPlay", function () { | ||
value: function getID(url) { | ||
return url && url.match(MATCH_URL_WISTIA)[1]; | ||
return url && url.match(_patterns.MATCH_URL_WISTIA)[1]; | ||
} | ||
@@ -113,3 +127,3 @@ }, { | ||
onError = _this$props5.onError; | ||
getSDK(SDK_URL, SDK_GLOBAL).then(function () { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function () { | ||
window._wq = window._wq || []; | ||
@@ -207,3 +221,3 @@ | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: id, | ||
@@ -217,10 +231,10 @@ className: className, | ||
return Wistia; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = Wistia; | ||
_defineProperty(Wistia, "displayName", 'Wistia'); | ||
_defineProperty(Wistia, "canPlay", canPlay.wistia); | ||
_defineProperty(Wistia, "canPlay", _patterns.canPlay.wistia); | ||
_defineProperty(Wistia, "loopOnEnded", true); | ||
export { Wistia as default }; | ||
_defineProperty(Wistia, "loopOnEnded", true); |
@@ -0,1 +1,18 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _utils = require("../utils"); | ||
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; } 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) { "@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); } | ||
@@ -41,5 +58,2 @@ | ||
import React, { Component } from 'react'; | ||
import { callPlayer, getSDK, parseStartTime, parseEndTime } from '../utils'; | ||
import { canPlay, MATCH_URL_YOUTUBE } from '../patterns'; | ||
var SDK_URL = 'https://www.youtube.com/iframe_api'; | ||
@@ -69,3 +83,3 @@ var SDK_GLOBAL = 'YT'; | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
@@ -177,3 +191,3 @@ _defineProperty(_assertThisInitialized(_this), "parsePlaylist", function (url) { | ||
return url.match(MATCH_URL_YOUTUBE)[1]; | ||
return url.match(_patterns.MATCH_URL_YOUTUBE)[1]; | ||
} | ||
@@ -205,4 +219,4 @@ }, { | ||
videoId: id, | ||
startSeconds: parseStartTime(url) || playerVars.start, | ||
endSeconds: parseEndTime(url) || playerVars.end | ||
startSeconds: (0, _utils.parseStartTime)(url) || playerVars.start, | ||
endSeconds: (0, _utils.parseEndTime)(url) || playerVars.end | ||
}); | ||
@@ -212,3 +226,3 @@ return; | ||
getSDK(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (YT) { | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (YT) { | ||
return YT.loaded; | ||
@@ -225,4 +239,4 @@ }).then(function (YT) { | ||
controls: controls ? 1 : 0, | ||
start: parseStartTime(url), | ||
end: parseEndTime(url), | ||
start: (0, _utils.parseStartTime)(url), | ||
end: (0, _utils.parseEndTime)(url), | ||
origin: window.location.origin, | ||
@@ -313,5 +327,5 @@ playsinline: playsinline | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: style | ||
}, /*#__PURE__*/React.createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
ref: this.ref | ||
@@ -323,8 +337,8 @@ })); | ||
return YouTube; | ||
}(Component); | ||
}(_react.Component); | ||
exports["default"] = YouTube; | ||
_defineProperty(YouTube, "displayName", 'YouTube'); | ||
_defineProperty(YouTube, "canPlay", canPlay.youtube); | ||
export { YouTube as default }; | ||
_defineProperty(YouTube, "canPlay", _patterns.canPlay.youtube); |
@@ -0,1 +1,14 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
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; } 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) { "@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,3 +42,2 @@ | ||
import React, { Component } from 'react'; | ||
var ICON_SIZE = '64px'; | ||
@@ -150,10 +162,12 @@ | ||
}; | ||
var defaultPlayIcon = /*#__PURE__*/React.createElement("div", { | ||
var defaultPlayIcon = /*#__PURE__*/_react["default"].createElement("div", { | ||
style: styles.shadow, | ||
className: "react-player__shadow" | ||
}, /*#__PURE__*/React.createElement("div", { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
style: styles.playIcon, | ||
className: "react-player__play-icon" | ||
})); | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
style: styles.preview, | ||
@@ -169,4 +183,4 @@ className: "react-player__preview", | ||
return Preview; | ||
}(Component); | ||
}(_react.Component); | ||
export { Preview as default }; | ||
exports["default"] = Preview; |
@@ -1,12 +0,22 @@ | ||
import PropTypes from 'prop-types'; | ||
var string = PropTypes.string, | ||
bool = PropTypes.bool, | ||
number = PropTypes.number, | ||
array = PropTypes.array, | ||
oneOfType = PropTypes.oneOfType, | ||
shape = PropTypes.shape, | ||
object = PropTypes.object, | ||
func = PropTypes.func, | ||
node = PropTypes.node; | ||
export var propTypes = { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.defaultProps = exports.propTypes = void 0; | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var string = _propTypes["default"].string, | ||
bool = _propTypes["default"].bool, | ||
number = _propTypes["default"].number, | ||
array = _propTypes["default"].array, | ||
oneOfType = _propTypes["default"].oneOfType, | ||
shape = _propTypes["default"].shape, | ||
object = _propTypes["default"].object, | ||
func = _propTypes["default"].func, | ||
node = _propTypes["default"].node; | ||
var propTypes = { | ||
url: oneOfType([string, array, object]), | ||
@@ -89,6 +99,7 @@ playing: bool, | ||
}; | ||
exports.propTypes = propTypes; | ||
var noop = function noop() {}; | ||
export var defaultProps = { | ||
var defaultProps = { | ||
playing: false, | ||
@@ -191,2 +202,3 @@ loop: false, | ||
onDisablePIP: noop | ||
}; | ||
}; | ||
exports.defaultProps = defaultProps; |
@@ -0,1 +1,28 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createReactPlayer = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _deepmerge = _interopRequireDefault(require("deepmerge")); | ||
var _memoizeOne = _interopRequireDefault(require("memoize-one")); | ||
var _reactFastCompare = _interopRequireDefault(require("react-fast-compare")); | ||
var _props = require("./props"); | ||
var _utils = require("./utils"); | ||
var _Player3 = _interopRequireDefault(require("./Player")); | ||
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; } 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) { "@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); } | ||
@@ -43,10 +70,3 @@ | ||
import React, { Component, Suspense, lazy } from 'react'; | ||
import merge from 'deepmerge'; | ||
import memoize from 'memoize-one'; | ||
import isEqual from 'react-fast-compare'; | ||
import { propTypes, defaultProps } from './props'; | ||
import { omit } from './utils'; | ||
import Player from './Player'; | ||
var Preview = lazy(function () { | ||
var Preview = (0, _react.lazy)(function () { | ||
return import( | ||
@@ -57,10 +77,11 @@ /* webpackChunkName: 'reactPlayerPreview' */ | ||
var IS_BROWSER = typeof window !== 'undefined' && window.document; | ||
var SUPPORTED_PROPS = Object.keys(propTypes); // Return null when rendering on the server | ||
var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server | ||
// as Suspense is not supported yet | ||
var UniversalSuspense = IS_BROWSER ? Suspense : function () { | ||
var UniversalSuspense = IS_BROWSER ? _react.Suspense : function () { | ||
return null; | ||
}; | ||
var customPlayers = []; | ||
export var createReactPlayer = function createReactPlayer(players, fallback) { | ||
var createReactPlayer = function createReactPlayer(players, fallback) { | ||
var _class, _temp; | ||
@@ -140,3 +161,3 @@ | ||
_defineProperty(_assertThisInitialized(_this), "getActivePlayer", memoize(function (url) { | ||
_defineProperty(_assertThisInitialized(_this), "getActivePlayer", (0, _memoizeOne["default"])(function (url) { | ||
for (var _i = 0, _arr = [].concat(customPlayers, _toConsumableArray(players)); _i < _arr.length; _i++) { | ||
@@ -157,9 +178,9 @@ var player = _arr[_i]; | ||
_defineProperty(_assertThisInitialized(_this), "getConfig", memoize(function (url, key) { | ||
_defineProperty(_assertThisInitialized(_this), "getConfig", (0, _memoizeOne["default"])(function (url, key) { | ||
var config = _this.props.config; | ||
return merge.all([defaultProps.config, defaultProps.config[key] || {}, config, config[key] || {}]); | ||
return _deepmerge["default"].all([_props.defaultProps.config, _props.defaultProps.config[key] || {}, config, config[key] || {}]); | ||
})); | ||
_defineProperty(_assertThisInitialized(_this), "getAttributes", memoize(function (url) { | ||
return omit(_this.props, SUPPORTED_PROPS); | ||
_defineProperty(_assertThisInitialized(_this), "getAttributes", (0, _memoizeOne["default"])(function (url) { | ||
return (0, _utils.omit)(_this.props, SUPPORTED_PROPS); | ||
})); | ||
@@ -176,3 +197,3 @@ | ||
return /*#__PURE__*/React.createElement(Player, _extends({}, _this.props, { | ||
return /*#__PURE__*/_react["default"].createElement(_Player3["default"], _extends({}, _this.props, { | ||
key: player.key, | ||
@@ -192,3 +213,3 @@ ref: _this.references.player, | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return !isEqual(this.props, nextProps) || !isEqual(this.state, nextState); | ||
return !(0, _reactFastCompare["default"])(this.props, nextProps) || !(0, _reactFastCompare["default"])(this.state, nextState); | ||
} | ||
@@ -219,3 +240,3 @@ }, { | ||
playIcon = _this$props.playIcon; | ||
return /*#__PURE__*/React.createElement(Preview, { | ||
return /*#__PURE__*/_react["default"].createElement(Preview, { | ||
url: url, | ||
@@ -238,3 +259,3 @@ light: light, | ||
var attributes = this.getAttributes(url); | ||
return /*#__PURE__*/React.createElement(Wrapper, _extends({ | ||
return /*#__PURE__*/_react["default"].createElement(Wrapper, _extends({ | ||
ref: this.references.wrapper, | ||
@@ -245,3 +266,3 @@ style: _objectSpread({}, style, { | ||
}) | ||
}, attributes), /*#__PURE__*/React.createElement(UniversalSuspense, { | ||
}, attributes), /*#__PURE__*/_react["default"].createElement(UniversalSuspense, { | ||
fallback: null | ||
@@ -253,3 +274,3 @@ }, showPreview ? this.renderPreview(url) : this.renderActivePlayer(url))); | ||
return ReactPlayer; | ||
}(Component), _defineProperty(_class, "displayName", 'ReactPlayer'), _defineProperty(_class, "propTypes", propTypes), _defineProperty(_class, "defaultProps", defaultProps), _defineProperty(_class, "addCustomPlayer", function (player) { | ||
}(_react.Component), _defineProperty(_class, "displayName", 'ReactPlayer'), _defineProperty(_class, "propTypes", _props.propTypes), _defineProperty(_class, "defaultProps", _props.defaultProps), _defineProperty(_class, "addCustomPlayer", function (player) { | ||
customPlayers.push(player); | ||
@@ -279,2 +300,4 @@ }), _defineProperty(_class, "removeCustomPlayers", function () { | ||
}), _temp; | ||
}; | ||
}; | ||
exports.createReactPlayer = createReactPlayer; |
@@ -1,6 +0,18 @@ | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import ReactPlayer from './index'; | ||
export default function renderReactPlayer(container, props) { | ||
render( /*#__PURE__*/React.createElement(ReactPlayer, props), container); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = renderReactPlayer; | ||
var _react = _interopRequireDefault(require("react")); | ||
var _reactDom = require("react-dom"); | ||
var _index = _interopRequireDefault(require("./index")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function renderReactPlayer(container, props) { | ||
(0, _reactDom.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], props), container); | ||
} |
@@ -0,1 +1,23 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.parseStartTime = parseStartTime; | ||
exports.parseEndTime = parseEndTime; | ||
exports.randomString = randomString; | ||
exports.queryString = queryString; | ||
exports.getSDK = getSDK; | ||
exports.getConfig = getConfig; | ||
exports.omit = omit; | ||
exports.callPlayer = callPlayer; | ||
exports.isMediaStream = isMediaStream; | ||
exports.supportsWebKitPresentationMode = supportsWebKitPresentationMode; | ||
var _loadScript = _interopRequireDefault(require("load-script")); | ||
var _deepmerge = _interopRequireDefault(require("deepmerge")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
@@ -13,4 +35,2 @@ | ||
import loadScript from 'load-script'; | ||
import merge from 'deepmerge'; | ||
var MATCH_START_QUERY = /[?&#](?:start|t)=([0-9hms]+)/; | ||
@@ -63,13 +83,16 @@ var MATCH_END_QUERY = /[?&#]end=([0-9hms]+)/; | ||
export function parseStartTime(url) { | ||
function parseStartTime(url) { | ||
return parseTimeParam(url, MATCH_START_QUERY); | ||
} | ||
export function parseEndTime(url) { | ||
function parseEndTime(url) { | ||
return parseTimeParam(url, MATCH_END_QUERY); | ||
} // http://stackoverflow.com/a/38622545 | ||
export function randomString() { | ||
function randomString() { | ||
return Math.random().toString(36).substr(2, 5); | ||
} | ||
export function queryString(object) { | ||
function queryString(object) { | ||
return Object.keys(object).map(function (key) { | ||
@@ -81,4 +104,6 @@ return "".concat(key, "=").concat(object[key]); | ||
var requests = {}; | ||
export function getSDK(url, sdkGlobal) { | ||
function getSDK(url, sdkGlobal) { | ||
var sdkReady = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
@@ -88,3 +113,3 @@ var isLoaded = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () { | ||
}; | ||
var fetchScript = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : loadScript; | ||
var fetchScript = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _loadScript["default"]; | ||
@@ -141,6 +166,8 @@ if (window[sdkGlobal] && isLoaded(window[sdkGlobal])) { | ||
} | ||
export function getConfig(props, defaultProps) { | ||
return merge(defaultProps.config, props.config); | ||
function getConfig(props, defaultProps) { | ||
return (0, _deepmerge["default"])(defaultProps.config, props.config); | ||
} | ||
export function omit(object) { | ||
function omit(object) { | ||
var _ref; | ||
@@ -167,3 +194,4 @@ | ||
} | ||
export function callPlayer(method) { | ||
function callPlayer(method) { | ||
var _this$player; | ||
@@ -192,6 +220,8 @@ | ||
} | ||
export function isMediaStream(url) { | ||
function isMediaStream(url) { | ||
return typeof window !== 'undefined' && typeof window.MediaStream !== 'undefined' && url instanceof window.MediaStream; | ||
} | ||
export function supportsWebKitPresentationMode() { | ||
function supportsWebKitPresentationMode() { | ||
var video = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.createElement('video'); | ||
@@ -198,0 +228,0 @@ // Check if Safari supports PiP, and is not on mobile (other than iPad) |
{ | ||
"name": "react-player", | ||
"version": "2.2.0-beta.0", | ||
"version": "2.2.0-beta.1", | ||
"description": "A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
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
1376028
8490