react-player
Advanced tools
Comparing version 1.11.2 to 1.12.0
@@ -7,2 +7,12 @@ ### Changelog | ||
#### [v1.12.0](https://github.com/CookPete/react-player/compare/v1.11.2...v1.12.0) | ||
> 18 August 2019 | ||
- Migrate to componentDidUpdate [`#651`](https://github.com/CookPete/react-player/issues/651) [`#696`](https://github.com/CookPete/react-player/issues/696) [`#692`](https://github.com/CookPete/react-player/pull/692) [`#693`](https://github.com/CookPete/react-player/pull/693) | ||
- Overhaul development config [`#695`](https://github.com/CookPete/react-player/issues/695) | ||
- Lint fixes [`ae0f230`](https://github.com/CookPete/react-player/commit/ae0f230dbe36cb95c3fe39e22687d69599185ad5) | ||
- Do not always call setPlaybackRate on play [`2b59631`](https://github.com/CookPete/react-player/commit/2b59631fedc9acbb9ce685d28b04a8125b60071a) | ||
- Remove old testing config from travis [`f91c737`](https://github.com/CookPete/react-player/commit/f91c7371b09013148409ada569280865bf9d3cc4) | ||
#### [v1.11.2](https://github.com/CookPete/react-player/compare/v1.11.1...v1.11.2) | ||
@@ -428,4 +438,4 @@ | ||
- Use callPlayer util for player methods [`c760655`](https://github.com/CookPete/react-player/commit/c760655b26fbf3c01a129665861dc25661d91f7d) | ||
- Clean up tests [`717397e`](https://github.com/CookPete/react-player/commit/717397e2010a7c2a9d2bbb543e3390ee9be94e9c) | ||
- Refactor progress logic [`f1b12e2`](https://github.com/CookPete/react-player/commit/f1b12e22262236b6c514c13de3534b8e4ede3f67) | ||
- Clean up tests [`717397e`](https://github.com/CookPete/react-player/commit/717397e2010a7c2a9d2bbb543e3390ee9be94e9c) | ||
@@ -432,0 +442,0 @@ #### [v0.24.2](https://github.com/CookPete/react-player/compare/v0.24.1...v0.24.2) |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,46 +6,226 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _props = require("./props"); | ||
var _react = require('react'); | ||
var _utils = require("./utils"); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _props6 = require('./props'); | ||
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); } | ||
var _utils = require('./utils'); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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 SEEK_ON_PLAY_EXPIRY = 5000; | ||
var Player = function (_Component) { | ||
var Player = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Player, _Component); | ||
function Player() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Player); | ||
for (var _len = arguments.length, args = 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]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Player.__proto__ || Object.getPrototypeOf(Player)).call.apply(_ref, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), _possibleConstructorReturn(_this, _ret); | ||
} // Track playing state internally to prevent bugs | ||
// Use isLoading to prevent onPause when switching URL | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Player)).call.apply(_getPrototypeOf2, [this].concat(_args))); | ||
_defineProperty(_assertThisInitialized(_this), "mounted", false); | ||
_defineProperty(_assertThisInitialized(_this), "isReady", false); | ||
_defineProperty(_assertThisInitialized(_this), "isPlaying", false); | ||
_defineProperty(_assertThisInitialized(_this), "isLoading", true); | ||
_defineProperty(_assertThisInitialized(_this), "loadOnReady", null); | ||
_defineProperty(_assertThisInitialized(_this), "startOnPlay", true); | ||
_defineProperty(_assertThisInitialized(_this), "seekOnPlay", null); | ||
_defineProperty(_assertThisInitialized(_this), "onDurationCalled", false); | ||
_defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function (key) { | ||
if (!_this.player) return null; | ||
return _this.player[key]; | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "progress", function () { | ||
if (_this.props.url && _this.player && _this.isReady) { | ||
var playedSeconds = _this.getCurrentTime() || 0; | ||
var loadedSeconds = _this.getSecondsLoaded(); | ||
var duration = _this.getDuration(); | ||
if (duration) { | ||
var progress = { | ||
playedSeconds: playedSeconds, | ||
played: playedSeconds / duration | ||
}; | ||
if (loadedSeconds !== null) { | ||
progress.loadedSeconds = loadedSeconds; | ||
progress.loaded = loadedSeconds / duration; | ||
} // Only call onProgress if values have changed | ||
if (progress.playedSeconds !== _this.prevPlayed || progress.loadedSeconds !== _this.prevLoaded) { | ||
_this.props.onProgress(progress); | ||
} | ||
_this.prevPlayed = progress.playedSeconds; | ||
_this.prevLoaded = progress.loadedSeconds; | ||
} | ||
} | ||
_this.progressTimeout = setTimeout(_this.progress, _this.props.progressFrequency || _this.props.progressInterval); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleReady", function () { | ||
if (!_this.mounted) return; | ||
_this.isReady = true; | ||
_this.isLoading = false; | ||
var _this$props = _this.props, | ||
onReady = _this$props.onReady, | ||
playing = _this$props.playing, | ||
volume = _this$props.volume, | ||
muted = _this$props.muted; | ||
onReady(); | ||
if (!muted && volume !== null) { | ||
_this.player.setVolume(volume); | ||
} | ||
if (_this.loadOnReady) { | ||
_this.player.load(_this.loadOnReady, true); | ||
_this.loadOnReady = null; | ||
} else if (playing) { | ||
_this.player.play(); | ||
} | ||
_this.handleDurationCheck(); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handlePlay", function () { | ||
_this.isPlaying = true; | ||
_this.isLoading = false; | ||
var _this$props2 = _this.props, | ||
onStart = _this$props2.onStart, | ||
onPlay = _this$props2.onPlay, | ||
playbackRate = _this$props2.playbackRate; | ||
if (_this.startOnPlay) { | ||
if (_this.player.setPlaybackRate && playbackRate !== 1) { | ||
_this.player.setPlaybackRate(playbackRate); | ||
} | ||
onStart(); | ||
_this.startOnPlay = false; | ||
} | ||
onPlay(); | ||
if (_this.seekOnPlay) { | ||
_this.seekTo(_this.seekOnPlay); | ||
_this.seekOnPlay = null; | ||
} | ||
_this.handleDurationCheck(); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handlePause", function (e) { | ||
_this.isPlaying = false; | ||
if (!_this.isLoading) { | ||
_this.props.onPause(e); | ||
} | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleEnded", function () { | ||
var _this$props3 = _this.props, | ||
activePlayer = _this$props3.activePlayer, | ||
loop = _this$props3.loop, | ||
onEnded = _this$props3.onEnded; | ||
if (activePlayer.loopOnEnded && loop) { | ||
_this.seekTo(0); | ||
} | ||
if (!loop) { | ||
_this.isPlaying = false; | ||
onEnded(); | ||
} | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleError", function () { | ||
var _this$props4; | ||
_this.isLoading = false; | ||
(_this$props4 = _this.props).onError.apply(_this$props4, arguments); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleDurationCheck", function () { | ||
clearTimeout(_this.durationCheckTimeout); | ||
var duration = _this.getDuration(); | ||
if (duration) { | ||
if (!_this.onDurationCalled) { | ||
_this.props.onDuration(duration); | ||
_this.onDurationCalled = true; | ||
} | ||
} else { | ||
_this.durationCheckTimeout = setTimeout(_this.handleDurationCheck, 100); | ||
} | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleLoaded", function () { | ||
// Sometimes we know loading has stopped but onReady/onPlay are never called | ||
// so this provides a way for players to avoid getting stuck | ||
_this.isLoading = false; | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (player) { | ||
if (player) { | ||
_this.player = player; | ||
} | ||
}); | ||
return _this; | ||
} | ||
_createClass(Player, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -57,64 +237,76 @@ this.mounted = true; | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
clearTimeout(this.progressTimeout); | ||
clearTimeout(this.durationCheckTimeout); | ||
if (this.isReady) { | ||
this.player.stop(); | ||
} | ||
if (this.player.disablePIP) { | ||
this.player.disablePIP(); | ||
} | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
var _this2 = this; | ||
// Invoke player methods based on incoming props | ||
var _props = this.props, | ||
url = _props.url, | ||
playing = _props.playing, | ||
volume = _props.volume, | ||
muted = _props.muted, | ||
playbackRate = _props.playbackRate, | ||
pip = _props.pip, | ||
loop = _props.loop, | ||
activePlayer = _props.activePlayer; | ||
// Invoke player methods based on changed props | ||
var _this$props5 = this.props, | ||
url = _this$props5.url, | ||
playing = _this$props5.playing, | ||
volume = _this$props5.volume, | ||
muted = _this$props5.muted, | ||
playbackRate = _this$props5.playbackRate, | ||
pip = _this$props5.pip, | ||
loop = _this$props5.loop, | ||
activePlayer = _this$props5.activePlayer; | ||
if (!(0, _utils.isEqual)(url, nextProps.url)) { | ||
if (!(0, _utils.isEqual)(prevProps.url, url)) { | ||
if (this.isLoading && !activePlayer.forceLoad) { | ||
console.warn('ReactPlayer: the attempt to load ' + nextProps.url + ' is being deferred until the player has loaded'); | ||
this.loadOnReady = nextProps.url; | ||
console.warn("ReactPlayer: the attempt to load ".concat(url, " is being deferred until the player has loaded")); | ||
this.loadOnReady = url; | ||
return; | ||
} | ||
this.isLoading = true; | ||
this.startOnPlay = true; | ||
this.onDurationCalled = false; | ||
this.player.load(nextProps.url, this.isReady); | ||
this.player.load(url, this.isReady); | ||
} | ||
if (!playing && nextProps.playing && !this.isPlaying) { | ||
if (!prevProps.playing && playing && !this.isPlaying) { | ||
this.player.play(); | ||
} | ||
if (playing && !nextProps.playing && this.isPlaying) { | ||
if (prevProps.playing && !playing && this.isPlaying) { | ||
this.player.pause(); | ||
} | ||
if (!pip && nextProps.pip && this.player.enablePIP) { | ||
if (!prevProps.pip && pip && this.player.enablePIP) { | ||
this.player.enablePIP(); | ||
} else if (pip && !nextProps.pip && this.player.disablePIP) { | ||
} | ||
if (prevProps.pip && !pip && this.player.disablePIP) { | ||
this.player.disablePIP(); | ||
} | ||
if (volume !== nextProps.volume && nextProps.volume !== null) { | ||
this.player.setVolume(nextProps.volume); | ||
if (prevProps.volume !== volume && volume !== null) { | ||
this.player.setVolume(volume); | ||
} | ||
if (muted !== nextProps.muted) { | ||
if (nextProps.muted) { | ||
if (prevProps.muted !== muted) { | ||
if (muted) { | ||
this.player.mute(); | ||
} else { | ||
this.player.unmute(); | ||
if (nextProps.volume !== null) { | ||
if (volume !== null) { | ||
// Set volume next tick to fix a bug with DailyMotion | ||
setTimeout(function () { | ||
return _this2.player.setVolume(nextProps.volume); | ||
return _this2.player.setVolume(volume); | ||
}); | ||
@@ -124,11 +316,13 @@ } | ||
} | ||
if (playbackRate !== nextProps.playbackRate && this.player.setPlaybackRate) { | ||
this.player.setPlaybackRate(nextProps.playbackRate); | ||
if (prevProps.playbackRate !== playbackRate && this.player.setPlaybackRate) { | ||
this.player.setPlaybackRate(playbackRate); | ||
} | ||
if (loop !== nextProps.loop && this.player.setLoop) { | ||
this.player.setLoop(nextProps.loop); | ||
if (prevProps.loop !== loop && this.player.setLoop) { | ||
this.player.setLoop(loop); | ||
} | ||
} | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -139,3 +333,3 @@ if (!this.isReady) return null; | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -146,3 +340,3 @@ if (!this.isReady) return null; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -153,3 +347,3 @@ if (!this.isReady) return null; | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(amount, type) { | ||
@@ -166,6 +360,9 @@ var _this3 = this; | ||
} | ||
var isFraction = !type ? amount > 0 && amount < 1 : type === 'fraction'; | ||
if (isFraction) { | ||
// Convert fraction to seconds based on duration | ||
var duration = this.player.getDuration(); | ||
if (!duration) { | ||
@@ -175,22 +372,26 @@ console.warn('ReactPlayer: could not seek using fraction – duration not yet available'); | ||
} | ||
this.player.seekTo(duration * amount); | ||
return; | ||
} | ||
this.player.seekTo(amount); | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var Player = this.props.activePlayer; | ||
if (!Player) { | ||
return null; | ||
} | ||
return _react2['default'].createElement(Player, _extends({}, this.props, { | ||
return _react["default"].createElement(Player, _extends({}, this.props, { | ||
ref: this.ref, | ||
onReady: this.onReady, | ||
onPlay: this.onPlay, | ||
onPause: this.onPause, | ||
onEnded: this.onEnded, | ||
onLoaded: this.onLoaded, | ||
onError: this.onError | ||
onReady: this.handleReady, | ||
onPlay: this.handlePlay, | ||
onPause: this.handlePause, | ||
onEnded: this.handleEnded, | ||
onLoaded: this.handleLoaded, | ||
onError: this.handleError | ||
})); | ||
@@ -203,149 +404,8 @@ } | ||
Player.displayName = 'Player'; | ||
Player.propTypes = _props6.propTypes; | ||
Player.defaultProps = _props6.defaultProps; | ||
exports["default"] = Player; | ||
var _initialiseProps = function _initialiseProps() { | ||
var _this4 = this; | ||
_defineProperty(Player, "displayName", 'Player'); | ||
this.mounted = false; | ||
this.isReady = false; | ||
this.isPlaying = false; | ||
this.isLoading = true; | ||
this.loadOnReady = null; | ||
this.startOnPlay = true; | ||
this.seekOnPlay = null; | ||
this.onDurationCalled = false; | ||
_defineProperty(Player, "propTypes", _props.propTypes); | ||
this.getInternalPlayer = function (key) { | ||
if (!_this4.player) return null; | ||
return _this4.player[key]; | ||
}; | ||
this.progress = function () { | ||
if (_this4.props.url && _this4.player && _this4.isReady) { | ||
var playedSeconds = _this4.getCurrentTime() || 0; | ||
var loadedSeconds = _this4.getSecondsLoaded(); | ||
var duration = _this4.getDuration(); | ||
if (duration) { | ||
var progress = { | ||
playedSeconds: playedSeconds, | ||
played: playedSeconds / duration | ||
}; | ||
if (loadedSeconds !== null) { | ||
progress.loadedSeconds = loadedSeconds; | ||
progress.loaded = loadedSeconds / duration; | ||
} | ||
// Only call onProgress if values have changed | ||
if (progress.playedSeconds !== _this4.prevPlayed || progress.loadedSeconds !== _this4.prevLoaded) { | ||
_this4.props.onProgress(progress); | ||
} | ||
_this4.prevPlayed = progress.playedSeconds; | ||
_this4.prevLoaded = progress.loadedSeconds; | ||
} | ||
} | ||
_this4.progressTimeout = setTimeout(_this4.progress, _this4.props.progressFrequency || _this4.props.progressInterval); | ||
}; | ||
this.onReady = function () { | ||
if (!_this4.mounted) return; | ||
_this4.isReady = true; | ||
_this4.isLoading = false; | ||
var _props2 = _this4.props, | ||
onReady = _props2.onReady, | ||
playing = _props2.playing, | ||
volume = _props2.volume, | ||
muted = _props2.muted; | ||
onReady(); | ||
if (!muted && volume !== null) { | ||
_this4.player.setVolume(volume); | ||
} | ||
if (_this4.loadOnReady) { | ||
_this4.player.load(_this4.loadOnReady, true); | ||
_this4.loadOnReady = null; | ||
} else if (playing) { | ||
_this4.player.play(); | ||
} | ||
_this4.onDurationCheck(); | ||
}; | ||
this.onPlay = function () { | ||
_this4.isPlaying = true; | ||
_this4.isLoading = false; | ||
var _props3 = _this4.props, | ||
onStart = _props3.onStart, | ||
onPlay = _props3.onPlay, | ||
playbackRate = _props3.playbackRate; | ||
if (_this4.startOnPlay) { | ||
if (_this4.player.setPlaybackRate) { | ||
_this4.player.setPlaybackRate(playbackRate); | ||
} | ||
onStart(); | ||
_this4.startOnPlay = false; | ||
} | ||
onPlay(); | ||
if (_this4.seekOnPlay) { | ||
_this4.seekTo(_this4.seekOnPlay); | ||
_this4.seekOnPlay = null; | ||
} | ||
_this4.onDurationCheck(); | ||
}; | ||
this.onPause = function (e) { | ||
_this4.isPlaying = false; | ||
if (!_this4.isLoading) { | ||
_this4.props.onPause(e); | ||
} | ||
}; | ||
this.onEnded = function () { | ||
var _props4 = _this4.props, | ||
activePlayer = _props4.activePlayer, | ||
loop = _props4.loop, | ||
onEnded = _props4.onEnded; | ||
if (activePlayer.loopOnEnded && loop) { | ||
_this4.seekTo(0); | ||
} | ||
if (!loop) { | ||
_this4.isPlaying = false; | ||
onEnded(); | ||
} | ||
}; | ||
this.onError = function () { | ||
var _props5; | ||
_this4.isLoading = false; | ||
(_props5 = _this4.props).onError.apply(_props5, arguments); | ||
}; | ||
this.onDurationCheck = function () { | ||
clearTimeout(_this4.durationCheckTimeout); | ||
var duration = _this4.getDuration(); | ||
if (duration) { | ||
if (!_this4.onDurationCalled) { | ||
_this4.props.onDuration(duration); | ||
_this4.onDurationCalled = true; | ||
} | ||
} else { | ||
_this4.durationCheckTimeout = setTimeout(_this4.onDurationCheck, 100); | ||
} | ||
}; | ||
this.onLoaded = function () { | ||
// Sometimes we know loading has stopped but onReady/onPlay are never called | ||
// so this provides a way for players to avoid getting stuck | ||
_this4.isLoading = false; | ||
}; | ||
this.ref = function (player) { | ||
if (player) { | ||
_this4.player = player; | ||
} | ||
}; | ||
}; | ||
exports['default'] = Player; | ||
_defineProperty(Player, "defaultProps", _props.defaultProps); |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,28 +6,46 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.DailyMotion = undefined; | ||
exports["default"] = exports.DailyMotion = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _utils = require("../utils"); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _utils = require('../utils'); | ||
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); } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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; } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { 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; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = 'https://api.dmcdn.net/all.js'; | ||
@@ -38,38 +56,53 @@ var SDK_GLOBAL = 'DM'; | ||
var DailyMotion = exports.DailyMotion = function (_Component) { | ||
var DailyMotion = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(DailyMotion, _Component); | ||
function DailyMotion() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, DailyMotion); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DailyMotion.__proto__ || Object.getPrototypeOf(DailyMotion)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.onDurationChange = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DailyMotion)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "onDurationChange", function () { | ||
var duration = _this.getDuration(); | ||
_this.props.onDuration(duration); | ||
}, _this.mute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.callPlayer('setMuted', true); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.callPlayer('setMuted', false); | ||
}, _this.ref = function (container) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (container) { | ||
_this.container = container; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(DailyMotion, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url) { | ||
var _this2 = this; | ||
var _props = this.props, | ||
controls = _props.controls, | ||
config = _props.config, | ||
onError = _props.onError, | ||
playing = _props.playing; | ||
var _this$props = this.props, | ||
controls = _this$props.controls, | ||
config = _this$props.config, | ||
onError = _this$props.onError, | ||
playing = _this$props.playing; | ||
@@ -87,2 +120,3 @@ var _url$match = url.match(MATCH_URL), | ||
} | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (DM) { | ||
@@ -97,3 +131,3 @@ return DM.player; | ||
video: id, | ||
params: _extends({ | ||
params: _objectSpread({ | ||
controls: controls, | ||
@@ -123,3 +157,3 @@ autoplay: _this2.props.playing, | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -129,3 +163,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -135,8 +169,7 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
value: function stop() { | ||
// Nothing to do | ||
key: "stop", | ||
value: function stop() {// Nothing to do | ||
} | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -146,3 +179,3 @@ this.callPlayer('seek', seconds); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -152,3 +185,3 @@ this.callPlayer('setVolume', fraction); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -158,3 +191,3 @@ return this.player.duration || null; | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -164,3 +197,3 @@ return this.player.currentTime; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -170,6 +203,5 @@ return this.player.bufferedTime; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var display = this.props.display; | ||
var style = { | ||
@@ -181,7 +213,7 @@ width: '100%', | ||
}; | ||
return _react2['default'].createElement( | ||
'div', | ||
{ style: style }, | ||
_react2['default'].createElement('div', { ref: this.ref }) | ||
); | ||
return _react["default"].createElement("div", { | ||
style: style | ||
}, _react["default"].createElement("div", { | ||
ref: this.ref | ||
})); | ||
} | ||
@@ -193,9 +225,14 @@ }]); | ||
DailyMotion.displayName = 'DailyMotion'; | ||
exports.DailyMotion = DailyMotion; | ||
DailyMotion.canPlay = function (url) { | ||
_defineProperty(DailyMotion, "displayName", 'DailyMotion'); | ||
_defineProperty(DailyMotion, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
DailyMotion.loopOnEnded = true; | ||
exports['default'] = (0, _singlePlayer2['default'])(DailyMotion); | ||
_defineProperty(DailyMotion, "loopOnEnded", true); | ||
var _default = (0, _singlePlayer["default"])(DailyMotion); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,24 +6,34 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Facebook = undefined; | ||
exports["default"] = exports.Facebook = void 0; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _react = require('react'); | ||
var _utils = require("../utils"); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _utils = require('../utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _singlePlayer = require('../singlePlayer'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = '//connect.facebook.net/en_US/sdk.js'; | ||
@@ -35,25 +45,37 @@ var SDK_GLOBAL = 'FB'; | ||
var Facebook = exports.Facebook = function (_Component) { | ||
var Facebook = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Facebook, _Component); | ||
function Facebook() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Facebook); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Facebook.__proto__ || Object.getPrototypeOf(Facebook)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.playerID = PLAYER_ID_PREFIX + (0, _utils.randomString)(), _this.mute = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Facebook)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", PLAYER_ID_PREFIX + (0, _utils.randomString)()); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.callPlayer('mute'); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.callPlayer('unmute'); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(Facebook, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url, isReady) { | ||
@@ -68,2 +90,3 @@ var _this2 = this; | ||
} | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY).then(function (FB) { | ||
@@ -83,8 +106,15 @@ FB.init({ | ||
_this2.player = msg.instance; | ||
_this2.player.subscribe('startedPlaying', _this2.props.onPlay); | ||
_this2.player.subscribe('paused', _this2.props.onPause); | ||
_this2.player.subscribe('finishedPlaying', _this2.props.onEnded); | ||
_this2.player.subscribe('startedBuffering', _this2.props.onBuffer); | ||
_this2.player.subscribe('finishedBuffering', _this2.props.onBufferEnd); | ||
_this2.player.subscribe('error', _this2.props.onError); | ||
if (!_this2.props.muted) { | ||
@@ -94,6 +124,7 @@ // Player is muted by default | ||
} | ||
_this2.props.onReady(); | ||
// For some reason Facebook have added `visibility: hidden` | ||
_this2.props.onReady(); // For some reason Facebook have added `visibility: hidden` | ||
// to the iframe when autoplay fails, so here we set it back | ||
document.getElementById(_this2.playerID).querySelector('iframe').style.visibility = 'visible'; | ||
@@ -105,3 +136,3 @@ } | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -111,3 +142,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -117,8 +148,7 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
value: function stop() { | ||
// Nothing to do | ||
key: "stop", | ||
value: function stop() {// Nothing to do | ||
} | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -128,3 +158,3 @@ this.callPlayer('seek', seconds); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -134,3 +164,3 @@ this.callPlayer('setVolume', fraction); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -140,3 +170,3 @@ return this.callPlayer('getDuration'); | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -146,3 +176,3 @@ return this.callPlayer('getCurrentPosition'); | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -152,3 +182,3 @@ return null; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -160,10 +190,10 @@ var style = { | ||
}; | ||
return _react2['default'].createElement('div', { | ||
return _react["default"].createElement("div", { | ||
style: style, | ||
id: this.playerID, | ||
className: 'fb-video', | ||
'data-href': this.props.url, | ||
'data-autoplay': this.props.playing ? 'true' : 'false', | ||
'data-allowfullscreen': 'true', | ||
'data-controls': this.props.controls ? 'true' : 'false' | ||
className: "fb-video", | ||
"data-href": this.props.url, | ||
"data-autoplay": this.props.playing ? 'true' : 'false', | ||
"data-allowfullscreen": "true", | ||
"data-controls": this.props.controls ? 'true' : 'false' | ||
}); | ||
@@ -176,9 +206,14 @@ } | ||
Facebook.displayName = 'Facebook'; | ||
exports.Facebook = Facebook; | ||
Facebook.canPlay = function (url) { | ||
_defineProperty(Facebook, "displayName", 'Facebook'); | ||
_defineProperty(Facebook, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
Facebook.loopOnEnded = true; | ||
exports['default'] = (0, _singlePlayer2['default'])(Facebook); | ||
_defineProperty(Facebook, "loopOnEnded", true); | ||
var _default = (0, _singlePlayer["default"])(Facebook); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,36 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.FilePlayer = undefined; | ||
exports["default"] = exports.FilePlayer = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _react = require('react'); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _utils = require('../utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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); } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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; | ||
@@ -55,2 +65,3 @@ var AUDIO_EXTENSIONS = /\.(m4a|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i; | ||
} | ||
if (canPlay(item.src)) { | ||
@@ -65,4 +76,4 @@ return true; | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator['return']) { | ||
_iterator['return'](); | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
@@ -78,5 +89,7 @@ } finally { | ||
} | ||
if ((0, _utils.isMediaStream)(url)) { | ||
return true; | ||
} | ||
return AUDIO_EXTENSIONS.test(url) || VIDEO_EXTENSIONS.test(url) || HLS_EXTENSIONS.test(url) || DASH_EXTENSIONS.test(url); | ||
@@ -89,47 +102,79 @@ } | ||
var FilePlayer = exports.FilePlayer = function (_Component) { | ||
var FilePlayer = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(FilePlayer, _Component); | ||
function FilePlayer() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, FilePlayer); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = FilePlayer.__proto__ || Object.getPrototypeOf(FilePlayer)).call.apply(_ref, [this].concat(args))), _this), _this.onDisablePIP = function (e) { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(FilePlayer)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "onDisablePIP", function (e) { | ||
var _this$props = _this.props, | ||
onDisablePIP = _this$props.onDisablePIP, | ||
playing = _this$props.playing; | ||
onDisablePIP(e); | ||
onDisablePIP(e); | ||
if (playing) { | ||
_this.play(); | ||
} | ||
}, _this.onSeek = function (e) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "onSeek", function (e) { | ||
_this.props.onSeek(e.target.currentTime); | ||
}, _this.mute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.player.muted = true; | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.player.muted = false; | ||
}, _this.renderSourceElement = function (source, index) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "renderSourceElement", function (source, index) { | ||
if (typeof source === 'string') { | ||
return _react2['default'].createElement('source', { key: index, src: source }); | ||
return _react["default"].createElement("source", { | ||
key: index, | ||
src: source | ||
}); | ||
} | ||
return _react2['default'].createElement('source', _extends({ key: index }, source)); | ||
}, _this.renderTrack = function (track, index) { | ||
return _react2['default'].createElement('track', _extends({ key: index }, track)); | ||
}, _this.ref = function (player) { | ||
return _react["default"].createElement("source", _extends({ | ||
key: index | ||
}, source)); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "renderTrack", function (track, index) { | ||
return _react["default"].createElement("track", _extends({ | ||
key: index | ||
}, track)); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (player) { | ||
if (_this.player) { | ||
// Store previous player to be used by removeListeners() | ||
_this.prevPlayer = _this.player; | ||
} | ||
_this.player = player; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(FilePlayer, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.addListeners(); | ||
this.addListeners(this.player); | ||
if (IOS) { | ||
@@ -140,76 +185,69 @@ this.player.load(); | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(nextProps)) { | ||
this.removeListeners(); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
if (this.shouldUseAudio(this.props) !== this.shouldUseAudio(prevProps)) { | ||
this.addListeners(); | ||
this.removeListeners(this.prevPlayer); | ||
this.addListeners(this.player); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.removeListeners(); | ||
this.removeListeners(this.player); | ||
} | ||
}, { | ||
key: 'addListeners', | ||
value: function addListeners() { | ||
var _props = this.props, | ||
onReady = _props.onReady, | ||
onPlay = _props.onPlay, | ||
onBuffer = _props.onBuffer, | ||
onBufferEnd = _props.onBufferEnd, | ||
onPause = _props.onPause, | ||
onEnded = _props.onEnded, | ||
onError = _props.onError, | ||
playsinline = _props.playsinline, | ||
onEnablePIP = _props.onEnablePIP; | ||
key: "addListeners", | ||
value: function addListeners(player) { | ||
var _this$props2 = this.props, | ||
onReady = _this$props2.onReady, | ||
onPlay = _this$props2.onPlay, | ||
onBuffer = _this$props2.onBuffer, | ||
onBufferEnd = _this$props2.onBufferEnd, | ||
onPause = _this$props2.onPause, | ||
onEnded = _this$props2.onEnded, | ||
onError = _this$props2.onError, | ||
playsinline = _this$props2.playsinline, | ||
onEnablePIP = _this$props2.onEnablePIP; | ||
player.addEventListener('canplay', onReady); | ||
player.addEventListener('play', onPlay); | ||
player.addEventListener('waiting', onBuffer); | ||
player.addEventListener('playing', onBufferEnd); | ||
player.addEventListener('pause', onPause); | ||
player.addEventListener('seeked', this.onSeek); | ||
player.addEventListener('ended', onEnded); | ||
player.addEventListener('error', onError); | ||
player.addEventListener('enterpictureinpicture', onEnablePIP); | ||
player.addEventListener('leavepictureinpicture', this.onDisablePIP); | ||
this.player.addEventListener('canplay', onReady); | ||
this.player.addEventListener('play', onPlay); | ||
this.player.addEventListener('waiting', onBuffer); | ||
this.player.addEventListener('playing', onBufferEnd); | ||
this.player.addEventListener('pause', onPause); | ||
this.player.addEventListener('seeked', this.onSeek); | ||
this.player.addEventListener('ended', onEnded); | ||
this.player.addEventListener('error', onError); | ||
this.player.addEventListener('enterpictureinpicture', onEnablePIP); | ||
this.player.addEventListener('leavepictureinpicture', this.onDisablePIP); | ||
if (playsinline) { | ||
this.player.setAttribute('playsinline', ''); | ||
this.player.setAttribute('webkit-playsinline', ''); | ||
this.player.setAttribute('x5-playsinline', ''); | ||
player.setAttribute('playsinline', ''); | ||
player.setAttribute('webkit-playsinline', ''); | ||
player.setAttribute('x5-playsinline', ''); | ||
} | ||
} | ||
}, { | ||
key: 'removeListeners', | ||
value: function removeListeners() { | ||
var _props2 = this.props, | ||
onReady = _props2.onReady, | ||
onPlay = _props2.onPlay, | ||
onBuffer = _props2.onBuffer, | ||
onBufferEnd = _props2.onBufferEnd, | ||
onPause = _props2.onPause, | ||
onEnded = _props2.onEnded, | ||
onError = _props2.onError, | ||
onEnablePIP = _props2.onEnablePIP; | ||
this.player.removeEventListener('canplay', onReady); | ||
this.player.removeEventListener('play', onPlay); | ||
this.player.removeEventListener('waiting', onBuffer); | ||
this.player.removeEventListener('playing', onBufferEnd); | ||
this.player.removeEventListener('pause', onPause); | ||
this.player.removeEventListener('seeked', this.onSeek); | ||
this.player.removeEventListener('ended', onEnded); | ||
this.player.removeEventListener('error', onError); | ||
this.player.removeEventListener('enterpictureinpicture', onEnablePIP); | ||
this.player.removeEventListener('leavepictureinpicture', this.onDisablePIP); | ||
key: "removeListeners", | ||
value: function removeListeners(player) { | ||
var _this$props3 = this.props, | ||
onReady = _this$props3.onReady, | ||
onPlay = _this$props3.onPlay, | ||
onBuffer = _this$props3.onBuffer, | ||
onBufferEnd = _this$props3.onBufferEnd, | ||
onPause = _this$props3.onPause, | ||
onEnded = _this$props3.onEnded, | ||
onError = _this$props3.onError, | ||
onEnablePIP = _this$props3.onEnablePIP; | ||
player.removeEventListener('canplay', onReady); | ||
player.removeEventListener('play', onPlay); | ||
player.removeEventListener('waiting', onBuffer); | ||
player.removeEventListener('playing', onBufferEnd); | ||
player.removeEventListener('pause', onPause); | ||
player.removeEventListener('seeked', this.onSeek); | ||
player.removeEventListener('ended', onEnded); | ||
player.removeEventListener('error', onError); | ||
player.removeEventListener('enterpictureinpicture', onEnablePIP); | ||
player.removeEventListener('leavepictureinpicture', this.onDisablePIP); | ||
} | ||
}, { | ||
key: 'shouldUseAudio', | ||
key: "shouldUseAudio", | ||
value: function shouldUseAudio(props) { | ||
@@ -219,9 +257,11 @@ if (props.config.file.forceVideo) { | ||
} | ||
if (props.config.file.attributes.poster) { | ||
return false; // Use <video> so that poster is shown | ||
} | ||
return AUDIO_EXTENSIONS.test(props.url) || props.config.file.forceAudio; | ||
} | ||
}, { | ||
key: 'shouldUseHLS', | ||
key: "shouldUseHLS", | ||
value: function shouldUseHLS(url) { | ||
@@ -231,3 +271,3 @@ return HLS_EXTENSIONS.test(url) && !IOS || this.props.config.file.forceHLS; | ||
}, { | ||
key: 'shouldUseDASH', | ||
key: "shouldUseDASH", | ||
value: function shouldUseDASH(url) { | ||
@@ -237,9 +277,9 @@ return DASH_EXTENSIONS.test(url) || this.props.config.file.forceDASH; | ||
}, { | ||
key: 'load', | ||
key: "load", | ||
value: function load(url) { | ||
var _this2 = this; | ||
var _props$config$file = this.props.config.file, | ||
hlsVersion = _props$config$file.hlsVersion, | ||
dashVersion = _props$config$file.dashVersion; | ||
var _this$props$config$fi = this.props.config.file, | ||
hlsVersion = _this$props$config$fi.hlsVersion, | ||
dashVersion = _this$props$config$fi.dashVersion; | ||
@@ -249,13 +289,19 @@ if (this.shouldUseHLS(url)) { | ||
_this2.hls = new Hls(_this2.props.config.file.hlsOptions); | ||
_this2.hls.on(Hls.Events.ERROR, function (e, data) { | ||
_this2.props.onError(e, data, _this2.hls, Hls); | ||
}); | ||
_this2.hls.loadSource(url); | ||
_this2.hls.attachMedia(_this2.player); | ||
}); | ||
} | ||
if (this.shouldUseDASH(url)) { | ||
(0, _utils.getSDK)(DASH_SDK_URL.replace('VERSION', dashVersion), DASH_GLOBAL).then(function (dashjs) { | ||
_this2.dash = dashjs.MediaPlayer().create(); | ||
_this2.dash.initialize(_this2.player, url, _this2.props.playing); | ||
_this2.dash.getDebug().setLogToBrowserConsole(false); | ||
@@ -280,11 +326,12 @@ }); | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
var promise = this.player.play(); | ||
if (promise) { | ||
promise['catch'](this.props.onError); | ||
promise["catch"](this.props.onError); | ||
} | ||
} | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -294,8 +341,10 @@ this.player.pause(); | ||
}, { | ||
key: 'stop', | ||
key: "stop", | ||
value: function stop() { | ||
this.player.removeAttribute('src'); | ||
if (this.hls) { | ||
this.hls.destroy(); | ||
} | ||
if (this.dash) { | ||
@@ -306,3 +355,3 @@ this.dash.reset(); | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -312,3 +361,3 @@ this.player.currentTime = seconds; | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -318,3 +367,3 @@ this.player.volume = fraction; | ||
}, { | ||
key: 'enablePIP', | ||
key: "enablePIP", | ||
value: function enablePIP() { | ||
@@ -326,3 +375,3 @@ if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) { | ||
}, { | ||
key: 'disablePIP', | ||
key: "disablePIP", | ||
value: function disablePIP() { | ||
@@ -334,3 +383,3 @@ if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) { | ||
}, { | ||
key: 'setPlaybackRate', | ||
key: "setPlaybackRate", | ||
value: function setPlaybackRate(rate) { | ||
@@ -340,9 +389,8 @@ this.player.playbackRate = rate; | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
if (!this.player) return null; | ||
var _player = this.player, | ||
duration = _player.duration, | ||
seekable = _player.seekable; | ||
// on iOS, live streams return Infinity for the duration | ||
var _this$player = this.player, | ||
duration = _this$player.duration, | ||
seekable = _this$player.seekable; // on iOS, live streams return Infinity for the duration | ||
// so instead we use the end of the seekable timerange | ||
@@ -353,6 +401,7 @@ | ||
} | ||
return duration; | ||
} | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -363,3 +412,3 @@ if (!this.player) return null; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -372,35 +421,40 @@ if (!this.player) return null; | ||
} | ||
var end = buffered.end(buffered.length - 1); | ||
var duration = this.getDuration(); | ||
if (end > duration) { | ||
return duration; | ||
} | ||
return end; | ||
} | ||
}, { | ||
key: 'getSource', | ||
key: "getSource", | ||
value: function getSource(url) { | ||
var useHLS = this.shouldUseHLS(url); | ||
var useDASH = this.shouldUseDASH(url); | ||
if (url instanceof Array || (0, _utils.isMediaStream)(url) || useHLS || useDASH) { | ||
return undefined; | ||
} | ||
if (MATCH_DROPBOX_URL.test(url)) { | ||
return url.replace('www.dropbox.com', 'dl.dropboxusercontent.com'); | ||
} | ||
return url; | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _props3 = this.props, | ||
url = _props3.url, | ||
playing = _props3.playing, | ||
loop = _props3.loop, | ||
controls = _props3.controls, | ||
muted = _props3.muted, | ||
config = _props3.config, | ||
width = _props3.width, | ||
height = _props3.height; | ||
var _this$props4 = this.props, | ||
url = _this$props4.url, | ||
playing = _this$props4.playing, | ||
loop = _this$props4.loop, | ||
controls = _this$props4.controls, | ||
muted = _this$props4.muted, | ||
config = _this$props4.config, | ||
width = _this$props4.width, | ||
height = _this$props4.height; | ||
var useAudio = this.shouldUseAudio(this.props); | ||
@@ -412,17 +466,12 @@ var Element = useAudio ? 'audio' : 'video'; | ||
}; | ||
return _react2['default'].createElement( | ||
Element, | ||
_extends({ | ||
ref: this.ref, | ||
src: this.getSource(url), | ||
style: style, | ||
preload: 'auto', | ||
autoPlay: playing || undefined, | ||
controls: controls, | ||
muted: muted, | ||
loop: loop | ||
}, config.file.attributes), | ||
url instanceof Array && url.map(this.renderSourceElement), | ||
config.file.tracks.map(this.renderTrack) | ||
); | ||
return _react["default"].createElement(Element, _extends({ | ||
ref: this.ref, | ||
src: this.getSource(url), | ||
style: style, | ||
preload: "auto", | ||
autoPlay: playing || undefined, | ||
controls: controls, | ||
muted: muted, | ||
loop: loop | ||
}, config.file.attributes), url instanceof Array && url.map(this.renderSourceElement), config.file.tracks.map(this.renderTrack)); | ||
} | ||
@@ -434,5 +483,12 @@ }]); | ||
FilePlayer.displayName = 'FilePlayer'; | ||
FilePlayer.canPlay = canPlay; | ||
FilePlayer.canEnablePIP = canEnablePIP; | ||
exports['default'] = (0, _singlePlayer2['default'])(FilePlayer); | ||
exports.FilePlayer = FilePlayer; | ||
_defineProperty(FilePlayer, "displayName", 'FilePlayer'); | ||
_defineProperty(FilePlayer, "canPlay", canPlay); | ||
_defineProperty(FilePlayer, "canEnablePIP", canEnablePIP); | ||
var _default = (0, _singlePlayer["default"])(FilePlayer); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,23 +6,25 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = void 0; | ||
var _YouTube = require('./YouTube'); | ||
var _YouTube = require("./YouTube"); | ||
var _SoundCloud = require('./SoundCloud'); | ||
var _SoundCloud = require("./SoundCloud"); | ||
var _Vimeo = require('./Vimeo'); | ||
var _Vimeo = require("./Vimeo"); | ||
var _Facebook = require('./Facebook'); | ||
var _Facebook = require("./Facebook"); | ||
var _Streamable = require('./Streamable'); | ||
var _Streamable = require("./Streamable"); | ||
var _Wistia = require('./Wistia'); | ||
var _Wistia = require("./Wistia"); | ||
var _Twitch = require('./Twitch'); | ||
var _Twitch = require("./Twitch"); | ||
var _DailyMotion = require('./DailyMotion'); | ||
var _DailyMotion = require("./DailyMotion"); | ||
var _Mixcloud = require('./Mixcloud'); | ||
var _Mixcloud = require("./Mixcloud"); | ||
var _FilePlayer = require('./FilePlayer'); | ||
var _FilePlayer = require("./FilePlayer"); | ||
exports['default'] = [_YouTube.YouTube, _SoundCloud.SoundCloud, _Vimeo.Vimeo, _Facebook.Facebook, _Streamable.Streamable, _Wistia.Wistia, _Twitch.Twitch, _DailyMotion.DailyMotion, _Mixcloud.Mixcloud, _FilePlayer.FilePlayer]; | ||
var _default = [_YouTube.YouTube, _SoundCloud.SoundCloud, _Vimeo.Vimeo, _Facebook.Facebook, _Streamable.Streamable, _Wistia.Wistia, _Twitch.Twitch, _DailyMotion.DailyMotion, _Mixcloud.Mixcloud, _FilePlayer.FilePlayer]; | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,38 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Mixcloud = undefined; | ||
exports["default"] = exports.Mixcloud = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _react = require('react'); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _utils = require('../utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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); } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = '//widget.mixcloud.com/media/js/widgetApi.js'; | ||
@@ -35,27 +47,43 @@ var SDK_GLOBAL = 'Mixcloud'; | ||
var Mixcloud = exports.Mixcloud = function (_Component) { | ||
var Mixcloud = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Mixcloud, _Component); | ||
function Mixcloud() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Mixcloud); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Mixcloud.__proto__ || Object.getPrototypeOf(Mixcloud)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.duration = null, _this.currentTime = null, _this.secondsLoaded = null, _this.mute = function () { | ||
// No volume support | ||
}, _this.unmute = function () { | ||
// No volume support | ||
}, _this.ref = function (iframe) { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Mixcloud)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "duration", null); | ||
_defineProperty(_assertThisInitialized(_this), "currentTime", null); | ||
_defineProperty(_assertThisInitialized(_this), "secondsLoaded", null); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () {// No volume support | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () {// No volume support | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (iframe) { | ||
_this.iframe = iframe; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(Mixcloud, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url) { | ||
@@ -66,7 +94,12 @@ var _this2 = this; | ||
_this2.player = Mixcloud.PlayerWidget(_this2.iframe); | ||
_this2.player.ready.then(function () { | ||
_this2.player.events.play.on(_this2.props.onPlay); | ||
_this2.player.events.pause.on(_this2.props.onPause); | ||
_this2.player.events.ended.on(_this2.props.onEnded); | ||
_this2.player.events.error.on(_this2.props.error); | ||
_this2.player.events.progress.on(function (seconds, duration) { | ||
@@ -76,2 +109,3 @@ _this2.currentTime = seconds; | ||
}); | ||
_this2.props.onReady(); | ||
@@ -82,3 +116,3 @@ }); | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -88,3 +122,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -94,8 +128,7 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
value: function stop() { | ||
// Nothing to do | ||
key: "stop", | ||
value: function stop() {// Nothing to do | ||
} | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -105,8 +138,7 @@ this.callPlayer('seek', seconds); | ||
}, { | ||
key: 'setVolume', | ||
value: function setVolume(fraction) { | ||
// No volume support | ||
key: "setVolume", | ||
value: function setVolume(fraction) {// No volume support | ||
} | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -116,3 +148,3 @@ return this.duration; | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -122,3 +154,3 @@ return this.currentTime; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -128,8 +160,7 @@ return null; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
url = _props.url, | ||
config = _props.config; | ||
var _this$props = this.props, | ||
url = _this$props.url, | ||
config = _this$props.config; | ||
var id = url.match(MATCH_URL)[1]; | ||
@@ -140,13 +171,13 @@ var style = { | ||
}; | ||
var query = (0, _utils.queryString)(_extends({}, config.mixcloud.options, { | ||
feed: '/' + id + '/' | ||
})); | ||
// We have to give the iframe a key here to prevent a | ||
var query = (0, _utils.queryString)(_objectSpread({}, config.mixcloud.options, { | ||
feed: "/".concat(id, "/") | ||
})); // We have to give the iframe a key here to prevent a | ||
// weird dialog appearing when loading a new track | ||
return _react2['default'].createElement('iframe', { | ||
return _react["default"].createElement("iframe", { | ||
key: id, | ||
ref: this.ref, | ||
style: style, | ||
src: 'https://www.mixcloud.com/widget/iframe/?' + query, | ||
frameBorder: '0' | ||
src: "https://www.mixcloud.com/widget/iframe/?".concat(query), | ||
frameBorder: "0" | ||
}); | ||
@@ -159,9 +190,14 @@ } | ||
Mixcloud.displayName = 'Mixcloud'; | ||
exports.Mixcloud = Mixcloud; | ||
Mixcloud.canPlay = function (url) { | ||
_defineProperty(Mixcloud, "displayName", 'Mixcloud'); | ||
_defineProperty(Mixcloud, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
Mixcloud.loopOnEnded = true; | ||
exports['default'] = (0, _singlePlayer2['default'])(Mixcloud); | ||
_defineProperty(Mixcloud, "loopOnEnded", true); | ||
var _default = (0, _singlePlayer["default"])(Mixcloud); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,38 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.SoundCloud = undefined; | ||
exports["default"] = exports.SoundCloud = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _react = require('react'); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _utils = require('../utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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); } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = 'https://w.soundcloud.com/player/api.js'; | ||
@@ -35,29 +47,47 @@ var SDK_GLOBAL = 'SC'; | ||
var SoundCloud = exports.SoundCloud = function (_Component) { | ||
var SoundCloud = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(SoundCloud, _Component); | ||
function SoundCloud() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, SoundCloud); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = SoundCloud.__proto__ || Object.getPrototypeOf(SoundCloud)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.duration = null, _this.currentTime = null, _this.fractionLoaded = null, _this.mute = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SoundCloud)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "duration", null); | ||
_defineProperty(_assertThisInitialized(_this), "currentTime", null); | ||
_defineProperty(_assertThisInitialized(_this), "fractionLoaded", null); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.setVolume(0); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
if (_this.props.volume !== null) { | ||
_this.setVolume(_this.props.volume); | ||
} | ||
}, _this.ref = function (iframe) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (iframe) { | ||
_this.iframe = iframe; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(SoundCloud, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url, isReady) { | ||
@@ -77,4 +107,7 @@ var _this2 = this; | ||
_this2.player = SC.Widget(_this2.iframe); | ||
_this2.player.bind(PLAY, _this2.props.onPlay); | ||
_this2.player.bind(PAUSE, _this2.props.onPause); | ||
_this2.player.bind(PLAY_PROGRESS, function (e) { | ||
@@ -84,5 +117,7 @@ _this2.currentTime = e.currentPosition / 1000; | ||
}); | ||
_this2.player.bind(FINISH, function () { | ||
return _this2.props.onEnded(); | ||
}); | ||
_this2.player.bind(ERROR, function (e) { | ||
@@ -92,6 +127,8 @@ return _this2.props.onError(e); | ||
} | ||
_this2.player.load(url, _extends({}, _this2.props.config.soundcloud.options, { | ||
_this2.player.load(url, _objectSpread({}, _this2.props.config.soundcloud.options, { | ||
callback: function callback() { | ||
_this2.player.getDuration(function (duration) { | ||
_this2.duration = duration / 1000; | ||
_this2.props.onReady(); | ||
@@ -104,3 +141,3 @@ }); | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -110,3 +147,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -116,8 +153,7 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
value: function stop() { | ||
// Nothing to do | ||
key: "stop", | ||
value: function stop() {// Nothing to do | ||
} | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -127,3 +163,3 @@ this.callPlayer('seekTo', seconds * 1000); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -133,3 +169,3 @@ this.callPlayer('setVolume', fraction * 100); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -139,3 +175,3 @@ return this.duration; | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -145,3 +181,3 @@ return this.currentTime; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -151,6 +187,5 @@ return this.fractionLoaded * this.duration; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var display = this.props.display; | ||
var style = { | ||
@@ -161,8 +196,8 @@ width: '100%', | ||
}; | ||
return _react2['default'].createElement('iframe', { | ||
return _react["default"].createElement("iframe", { | ||
ref: this.ref, | ||
src: 'https://w.soundcloud.com/player/?url=' + encodeURIComponent(this.props.url), | ||
src: "https://w.soundcloud.com/player/?url=".concat(encodeURIComponent(this.props.url)), | ||
style: style, | ||
frameBorder: 0, | ||
allow: 'autoplay' | ||
allow: "autoplay" | ||
}); | ||
@@ -175,9 +210,14 @@ } | ||
SoundCloud.displayName = 'SoundCloud'; | ||
exports.SoundCloud = SoundCloud; | ||
SoundCloud.canPlay = function (url) { | ||
_defineProperty(SoundCloud, "displayName", 'SoundCloud'); | ||
_defineProperty(SoundCloud, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
SoundCloud.loopOnEnded = true; | ||
exports['default'] = (0, _singlePlayer2['default'])(SoundCloud); | ||
_defineProperty(SoundCloud, "loopOnEnded", true); | ||
var _default = (0, _singlePlayer["default"])(SoundCloud); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,24 +6,34 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Streamable = undefined; | ||
exports["default"] = exports.Streamable = void 0; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _react = require('react'); | ||
var _utils = require("../utils"); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _utils = require('../utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _singlePlayer = require('../singlePlayer'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = '//cdn.embed.ly/player-0.1.0.min.js'; | ||
@@ -33,27 +43,45 @@ var SDK_GLOBAL = 'playerjs'; | ||
var Streamable = exports.Streamable = function (_Component) { | ||
var Streamable = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Streamable, _Component); | ||
function Streamable() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Streamable); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Streamable.__proto__ || Object.getPrototypeOf(Streamable)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.duration = null, _this.currentTime = null, _this.secondsLoaded = null, _this.mute = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Streamable)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "duration", null); | ||
_defineProperty(_assertThisInitialized(_this), "currentTime", null); | ||
_defineProperty(_assertThisInitialized(_this), "secondsLoaded", null); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.callPlayer('mute'); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.callPlayer('unmute'); | ||
}, _this.ref = function (iframe) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (iframe) { | ||
_this.iframe = iframe; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(Streamable, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url) { | ||
@@ -65,19 +93,27 @@ var _this2 = this; | ||
_this2.player = new playerjs.Player(_this2.iframe); | ||
_this2.player.setLoop(_this2.props.loop); | ||
_this2.player.on('ready', _this2.props.onReady); | ||
_this2.player.on('play', _this2.props.onPlay); | ||
_this2.player.on('pause', _this2.props.onPause); | ||
_this2.player.on('seeked', _this2.props.onSeek); | ||
_this2.player.on('ended', _this2.props.onEnded); | ||
_this2.player.on('error', _this2.props.onError); | ||
_this2.player.on('timeupdate', function (_ref2) { | ||
var duration = _ref2.duration, | ||
seconds = _ref2.seconds; | ||
_this2.player.on('timeupdate', function (_ref) { | ||
var duration = _ref.duration, | ||
seconds = _ref.seconds; | ||
_this2.duration = duration; | ||
_this2.currentTime = seconds; | ||
}); | ||
_this2.player.on('buffered', function (_ref3) { | ||
var percent = _ref3.percent; | ||
_this2.player.on('buffered', function (_ref2) { | ||
var percent = _ref2.percent; | ||
if (_this2.duration) { | ||
@@ -87,2 +123,3 @@ _this2.secondsLoaded = _this2.duration * percent; | ||
}); | ||
if (_this2.props.muted) { | ||
@@ -94,3 +131,3 @@ _this2.player.mute(); | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -100,3 +137,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -106,8 +143,7 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
value: function stop() { | ||
// Nothing to do | ||
key: "stop", | ||
value: function stop() {// Nothing to do | ||
} | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -117,3 +153,3 @@ this.callPlayer('setCurrentTime', seconds); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -123,3 +159,3 @@ this.callPlayer('setVolume', fraction * 100); | ||
}, { | ||
key: 'setLoop', | ||
key: "setLoop", | ||
value: function setLoop(loop) { | ||
@@ -129,3 +165,3 @@ this.callPlayer('setLoop', loop); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -135,3 +171,3 @@ return this.duration; | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -141,3 +177,3 @@ return this.currentTime; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -147,3 +183,3 @@ return this.secondsLoaded; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -155,7 +191,7 @@ var id = this.props.url.match(MATCH_URL)[1]; | ||
}; | ||
return _react2['default'].createElement('iframe', { | ||
return _react["default"].createElement("iframe", { | ||
ref: this.ref, | ||
src: 'https://streamable.com/o/' + id, | ||
frameBorder: '0', | ||
scrolling: 'no', | ||
src: "https://streamable.com/o/".concat(id), | ||
frameBorder: "0", | ||
scrolling: "no", | ||
style: style, | ||
@@ -170,8 +206,12 @@ allowFullScreen: true | ||
Streamable.displayName = 'Streamable'; | ||
exports.Streamable = Streamable; | ||
Streamable.canPlay = function (url) { | ||
_defineProperty(Streamable, "displayName", 'Streamable'); | ||
_defineProperty(Streamable, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
exports['default'] = (0, _singlePlayer2['default'])(Streamable); | ||
var _default = (0, _singlePlayer["default"])(Streamable); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,38 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Twitch = undefined; | ||
exports["default"] = exports.Twitch = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _react = require('react'); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _utils = require('../utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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); } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = 'https://player.twitch.tv/js/embed/v1.js'; | ||
@@ -37,35 +49,47 @@ var SDK_GLOBAL = 'Twitch'; | ||
var Twitch = exports.Twitch = function (_Component) { | ||
var Twitch = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Twitch, _Component); | ||
function Twitch() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Twitch); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Twitch.__proto__ || Object.getPrototypeOf(Twitch)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.playerID = PLAYER_ID_PREFIX + (0, _utils.randomString)(), _this.mute = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Twitch)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "playerID", PLAYER_ID_PREFIX + (0, _utils.randomString)()); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.callPlayer('setMuted', true); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.callPlayer('setMuted', false); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(Twitch, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url, isReady) { | ||
var _this2 = this; | ||
var _props = this.props, | ||
playsinline = _props.playsinline, | ||
onError = _props.onError, | ||
config = _props.config; | ||
var _this$props = this.props, | ||
playsinline = _this$props.playsinline, | ||
onError = _this$props.onError, | ||
config = _this$props.config; | ||
var isChannel = MATCH_CHANNEL_URL.test(url); | ||
var id = isChannel ? url.match(MATCH_CHANNEL_URL)[1] : url.match(MATCH_VIDEO_URL)[1]; | ||
if (isReady) { | ||
@@ -77,6 +101,8 @@ if (isChannel) { | ||
} | ||
return; | ||
} | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function (Twitch) { | ||
_this2.player = new Twitch.Player(_this2.playerID, _extends({ | ||
_this2.player = new Twitch.Player(_this2.playerID, _objectSpread({ | ||
video: isChannel ? '' : id, | ||
@@ -99,8 +125,12 @@ channel: isChannel ? id : '', | ||
_this2.player.addEventListener(READY, _this2.props.onReady); | ||
_this2.player.addEventListener(PLAYING, _this2.props.onPlay); | ||
_this2.player.addEventListener(PAUSE, _this2.props.onPause); | ||
_this2.player.addEventListener(ENDED, _this2.props.onEnded); | ||
// Prevent weird isLoading behaviour when streams are offline | ||
_this2.player.addEventListener(ENDED, _this2.props.onEnded); // Prevent weird isLoading behaviour when streams are offline | ||
_this2.player.addEventListener(ONLINE, _this2.props.onLoaded); | ||
_this2.player.addEventListener(OFFLINE, _this2.props.onLoaded); | ||
@@ -110,3 +140,3 @@ }, onError); | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -116,3 +146,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -122,3 +152,3 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
key: "stop", | ||
value: function stop() { | ||
@@ -128,3 +158,3 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -134,3 +164,3 @@ this.callPlayer('seek', seconds); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -140,3 +170,3 @@ this.callPlayer('setVolume', fraction); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -146,3 +176,3 @@ return this.callPlayer('getDuration'); | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -152,3 +182,3 @@ return this.callPlayer('getCurrentTime'); | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -158,3 +188,3 @@ return null; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
@@ -165,3 +195,6 @@ var style = { | ||
}; | ||
return _react2['default'].createElement('div', { style: style, id: this.playerID }); | ||
return _react["default"].createElement("div", { | ||
style: style, | ||
id: this.playerID | ||
}); | ||
} | ||
@@ -173,9 +206,14 @@ }]); | ||
Twitch.displayName = 'Twitch'; | ||
exports.Twitch = Twitch; | ||
Twitch.canPlay = function (url) { | ||
_defineProperty(Twitch, "displayName", 'Twitch'); | ||
_defineProperty(Twitch, "canPlay", function (url) { | ||
return MATCH_VIDEO_URL.test(url) || MATCH_CHANNEL_URL.test(url); | ||
}; | ||
}); | ||
Twitch.loopOnEnded = true; | ||
exports['default'] = (0, _singlePlayer2['default'])(Twitch); | ||
_defineProperty(Twitch, "loopOnEnded", true); | ||
var _default = (0, _singlePlayer["default"])(Twitch); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,38 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Vimeo = undefined; | ||
exports["default"] = exports.Vimeo = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _react = require('react'); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _utils = require('../utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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); } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = 'https://player.vimeo.com/api/player.js'; | ||
@@ -36,30 +48,47 @@ var SDK_GLOBAL = 'Vimeo'; | ||
var Vimeo = exports.Vimeo = function (_Component) { | ||
var Vimeo = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Vimeo, _Component); | ||
function Vimeo() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Vimeo); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Vimeo.__proto__ || Object.getPrototypeOf(Vimeo)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.duration = null, _this.currentTime = null, _this.secondsLoaded = null, _this.mute = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Vimeo)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "duration", null); | ||
_defineProperty(_assertThisInitialized(_this), "currentTime", null); | ||
_defineProperty(_assertThisInitialized(_this), "secondsLoaded", null); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.setVolume(0); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
if (_this.props.volume !== null) { | ||
_this.setVolume(_this.props.volume); | ||
} | ||
}, _this.ref = function (container) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (container) { | ||
_this.container = container; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} // Prevent checking isLoading when URL changes | ||
}); | ||
return _this; | ||
} | ||
_createClass(Vimeo, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url) { | ||
@@ -71,3 +100,3 @@ var _this2 = this; | ||
if (!_this2.container) return; | ||
_this2.player = new Vimeo.Player(_this2.container, _extends({ | ||
_this2.player = new Vimeo.Player(_this2.container, _objectSpread({ | ||
url: url, | ||
@@ -79,29 +108,39 @@ autoplay: _this2.props.playing, | ||
}, _this2.props.config.vimeo.playerOptions)); | ||
_this2.player.ready().then(function () { | ||
var iframe = _this2.container.querySelector('iframe'); | ||
iframe.style.width = '100%'; | ||
iframe.style.height = '100%'; | ||
})['catch'](_this2.props.onError); | ||
})["catch"](_this2.props.onError); | ||
_this2.player.on('loaded', function () { | ||
_this2.props.onReady(); | ||
_this2.refreshDuration(); | ||
}); | ||
_this2.player.on('play', function () { | ||
_this2.props.onPlay(); | ||
_this2.refreshDuration(); | ||
}); | ||
_this2.player.on('pause', _this2.props.onPause); | ||
_this2.player.on('seeked', function (e) { | ||
return _this2.props.onSeek(e.seconds); | ||
}); | ||
_this2.player.on('ended', _this2.props.onEnded); | ||
_this2.player.on('error', _this2.props.onError); | ||
_this2.player.on('timeupdate', function (_ref2) { | ||
var seconds = _ref2.seconds; | ||
_this2.player.on('timeupdate', function (_ref) { | ||
var seconds = _ref.seconds; | ||
_this2.currentTime = seconds; | ||
}); | ||
_this2.player.on('progress', function (_ref3) { | ||
var seconds = _ref3.seconds; | ||
_this2.player.on('progress', function (_ref2) { | ||
var seconds = _ref2.seconds; | ||
_this2.secondsLoaded = seconds; | ||
@@ -112,3 +151,3 @@ }); | ||
}, { | ||
key: 'refreshDuration', | ||
key: "refreshDuration", | ||
value: function refreshDuration() { | ||
@@ -122,11 +161,12 @@ var _this3 = this; | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
var promise = this.callPlayer('play'); | ||
if (promise) { | ||
promise['catch'](this.props.onError); | ||
promise["catch"](this.props.onError); | ||
} | ||
} | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -136,3 +176,3 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'stop', | ||
key: "stop", | ||
value: function stop() { | ||
@@ -142,3 +182,3 @@ this.callPlayer('unload'); | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -148,3 +188,3 @@ this.callPlayer('setCurrentTime', seconds); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -154,3 +194,3 @@ this.callPlayer('setVolume', fraction); | ||
}, { | ||
key: 'setLoop', | ||
key: "setLoop", | ||
value: function setLoop(loop) { | ||
@@ -160,3 +200,3 @@ this.callPlayer('setLoop', loop); | ||
}, { | ||
key: 'setPlaybackRate', | ||
key: "setPlaybackRate", | ||
value: function setPlaybackRate(rate) { | ||
@@ -166,3 +206,3 @@ this.callPlayer('setPlaybackRate', rate); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -172,3 +212,3 @@ return this.duration; | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -178,3 +218,3 @@ return this.currentTime; | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -184,6 +224,5 @@ return this.secondsLoaded; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var display = this.props.display; | ||
var style = { | ||
@@ -196,3 +235,3 @@ width: '100%', | ||
}; | ||
return _react2['default'].createElement('div', { | ||
return _react["default"].createElement("div", { | ||
key: this.props.url, | ||
@@ -208,12 +247,18 @@ ref: this.ref, | ||
Vimeo.displayName = 'Vimeo'; | ||
Vimeo.forceLoad = true; | ||
exports.Vimeo = Vimeo; | ||
Vimeo.canPlay = function (url) { | ||
_defineProperty(Vimeo, "displayName", 'Vimeo'); | ||
_defineProperty(Vimeo, "forceLoad", true); | ||
_defineProperty(Vimeo, "canPlay", function (url) { | ||
if (MATCH_FILE_URL.test(url)) { | ||
return false; | ||
} | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
exports['default'] = (0, _singlePlayer2['default'])(Vimeo); | ||
var _default = (0, _singlePlayer["default"])(Vimeo); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,26 +6,38 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Wistia = undefined; | ||
exports["default"] = exports.Wistia = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _react = require('react'); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _utils = require('../utils'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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); } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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_URL = '//fast.wistia.com/assets/external/E-v1.js'; | ||
@@ -35,25 +47,35 @@ var SDK_GLOBAL = 'Wistia'; | ||
var Wistia = exports.Wistia = function (_Component) { | ||
var Wistia = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Wistia, _Component); | ||
function Wistia() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Wistia); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Wistia.__proto__ || Object.getPrototypeOf(Wistia)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.mute = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Wistia)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.callPlayer('mute'); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.callPlayer('unmute'); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(Wistia, [{ | ||
key: 'getID', | ||
key: "getID", | ||
value: function getID(url) { | ||
@@ -63,23 +85,23 @@ return url && url.match(MATCH_URL)[1]; | ||
}, { | ||
key: 'load', | ||
key: "load", | ||
value: function load(url) { | ||
var _this2 = this; | ||
var _props = this.props, | ||
playing = _props.playing, | ||
muted = _props.muted, | ||
controls = _props.controls, | ||
_onReady = _props.onReady, | ||
onPlay = _props.onPlay, | ||
onPause = _props.onPause, | ||
onSeek = _props.onSeek, | ||
onEnded = _props.onEnded, | ||
config = _props.config, | ||
onError = _props.onError; | ||
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; | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL).then(function () { | ||
window._wq = window._wq || []; | ||
window._wq.push({ | ||
id: _this2.getID(url), | ||
options: _extends({ | ||
options: _objectSpread({ | ||
autoPlay: playing, | ||
@@ -92,7 +114,13 @@ silentAutoPlay: 'allow', | ||
_this2.player = player; | ||
_this2.unbind(); | ||
_this2.player.bind('play', onPlay); | ||
_this2.player.bind('pause', onPause); | ||
_this2.player.bind('seek', onSeek); | ||
_this2.player.bind('end', onEnded); | ||
_onReady(); | ||
@@ -104,3 +132,3 @@ } | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -110,3 +138,3 @@ this.callPlayer('play'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -116,10 +144,9 @@ this.callPlayer('pause'); | ||
}, { | ||
key: 'unbind', | ||
key: "unbind", | ||
value: function unbind() { | ||
var _props2 = this.props, | ||
onPlay = _props2.onPlay, | ||
onPause = _props2.onPause, | ||
onSeek = _props2.onSeek, | ||
onEnded = _props2.onEnded; | ||
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); | ||
@@ -131,3 +158,3 @@ this.player.unbind('pause', onPause); | ||
}, { | ||
key: 'stop', | ||
key: "stop", | ||
value: function stop() { | ||
@@ -138,3 +165,3 @@ this.unbind(); | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(seconds) { | ||
@@ -144,3 +171,3 @@ this.callPlayer('time', seconds); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -150,3 +177,3 @@ this.callPlayer('volume', fraction); | ||
}, { | ||
key: 'setPlaybackRate', | ||
key: "setPlaybackRate", | ||
value: function setPlaybackRate(rate) { | ||
@@ -156,3 +183,3 @@ this.callPlayer('playbackRate', rate); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -162,3 +189,3 @@ return this.callPlayer('duration'); | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -168,3 +195,3 @@ return this.callPlayer('time'); | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -174,6 +201,6 @@ return null; | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var id = this.getID(this.props.url); | ||
var className = 'wistia_embed wistia_async_' + id; | ||
var className = "wistia_embed wistia_async_".concat(id); | ||
var style = { | ||
@@ -183,3 +210,7 @@ width: '100%', | ||
}; | ||
return _react2['default'].createElement('div', { key: id, className: className, style: style }); | ||
return _react["default"].createElement("div", { | ||
key: id, | ||
className: className, | ||
style: style | ||
}); | ||
} | ||
@@ -191,9 +222,14 @@ }]); | ||
Wistia.displayName = 'Wistia'; | ||
exports.Wistia = Wistia; | ||
Wistia.canPlay = function (url) { | ||
_defineProperty(Wistia, "displayName", 'Wistia'); | ||
_defineProperty(Wistia, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
Wistia.loopOnEnded = true; | ||
exports['default'] = (0, _singlePlayer2['default'])(Wistia); | ||
_defineProperty(Wistia, "loopOnEnded", true); | ||
var _default = (0, _singlePlayer["default"])(Wistia); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,28 +6,46 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.YouTube = undefined; | ||
exports["default"] = exports.YouTube = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _utils = require("../utils"); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _singlePlayer = _interopRequireDefault(require("../singlePlayer")); | ||
var _react = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _utils = require('../utils'); | ||
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); } | ||
var _singlePlayer = require('../singlePlayer'); | ||
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; } | ||
var _singlePlayer2 = _interopRequireDefault(_singlePlayer); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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 _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { 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; } | ||
var SDK_URL = 'https://www.youtube.com/iframe_api'; | ||
@@ -50,21 +68,28 @@ var SDK_GLOBAL = 'YT'; | ||
} | ||
return {}; | ||
} | ||
var YouTube = exports.YouTube = function (_Component) { | ||
var YouTube = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(YouTube, _Component); | ||
function YouTube() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, YouTube); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = YouTube.__proto__ || Object.getPrototypeOf(YouTube)).call.apply(_ref, [this].concat(args))), _this), _this.callPlayer = _utils.callPlayer, _this.onStateChange = function (_ref2) { | ||
var data = _ref2.data; | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(YouTube)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "callPlayer", _utils.callPlayer); | ||
_defineProperty(_assertThisInitialized(_this), "onStateChange", function (_ref) { | ||
var data = _ref.data; | ||
var _this$props = _this.props, | ||
@@ -89,39 +114,53 @@ onPlay = _this$props.onPlay, | ||
} | ||
if (data === PAUSED) onPause(); | ||
if (data === BUFFERING) onBuffer(); | ||
if (data === ENDED) { | ||
var isPlaylist = !!_this.callPlayer('getPlaylist'); | ||
if (loop && !isPlaylist) { | ||
_this.play(); // Only loop manually if not playing a playlist | ||
} | ||
onEnded(); | ||
} | ||
if (data === CUED) onReady(); | ||
}, _this.mute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "mute", function () { | ||
_this.callPlayer('mute'); | ||
}, _this.unmute = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "unmute", function () { | ||
_this.callPlayer('unMute'); | ||
}, _this.ref = function (container) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (container) { | ||
_this.container = container; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(YouTube, [{ | ||
key: 'load', | ||
key: "load", | ||
value: function load(url, isReady) { | ||
var _this2 = this; | ||
var _props = this.props, | ||
playing = _props.playing, | ||
muted = _props.muted, | ||
playsinline = _props.playsinline, | ||
controls = _props.controls, | ||
loop = _props.loop, | ||
config = _props.config, | ||
_onError = _props.onError; | ||
var _this$props2 = this.props, | ||
playing = _this$props2.playing, | ||
muted = _this$props2.muted, | ||
playsinline = _this$props2.playsinline, | ||
controls = _this$props2.controls, | ||
loop = _this$props2.loop, | ||
config = _this$props2.config, | ||
_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 id = url && url.match(MATCH_URL)[1]; | ||
if (isReady) { | ||
@@ -132,2 +171,3 @@ if (MATCH_PLAYLIST.test(url)) { | ||
} | ||
this.player.cueVideoById({ | ||
@@ -140,2 +180,3 @@ videoId: id, | ||
} | ||
(0, _utils.getSDK)(SDK_URL, SDK_GLOBAL, SDK_GLOBAL_READY, function (YT) { | ||
@@ -145,7 +186,7 @@ return YT.loaded; | ||
if (!_this2.container) return; | ||
_this2.player = new YT.Player(_this2.container, _extends({ | ||
_this2.player = new YT.Player(_this2.container, _objectSpread({ | ||
width: '100%', | ||
height: '100%', | ||
videoId: id, | ||
playerVars: _extends({ | ||
playerVars: _objectSpread({ | ||
autoplay: playing ? 1 : 0, | ||
@@ -158,3 +199,3 @@ mute: muted ? 1 : 0, | ||
playsinline: playsinline | ||
}, parsePlaylist(url), playerVars), | ||
}, parsePlaylist(url), {}, playerVars), | ||
events: { | ||
@@ -164,3 +205,5 @@ onReady: function onReady() { | ||
_this2.player.setLoop(true); // Enable playlist looping | ||
} | ||
_this2.props.onReady(); | ||
@@ -177,3 +220,3 @@ }, | ||
}, { | ||
key: 'play', | ||
key: "play", | ||
value: function play() { | ||
@@ -183,3 +226,3 @@ this.callPlayer('playVideo'); | ||
}, { | ||
key: 'pause', | ||
key: "pause", | ||
value: function pause() { | ||
@@ -189,3 +232,3 @@ this.callPlayer('pauseVideo'); | ||
}, { | ||
key: 'stop', | ||
key: "stop", | ||
value: function stop() { | ||
@@ -196,5 +239,6 @@ if (!document.body.contains(this.callPlayer('getIframe'))) return; | ||
}, { | ||
key: 'seekTo', | ||
key: "seekTo", | ||
value: function seekTo(amount) { | ||
this.callPlayer('seekTo', amount); | ||
if (!this.props.playing) { | ||
@@ -205,3 +249,3 @@ this.pause(); | ||
}, { | ||
key: 'setVolume', | ||
key: "setVolume", | ||
value: function setVolume(fraction) { | ||
@@ -211,3 +255,3 @@ this.callPlayer('setVolume', fraction * 100); | ||
}, { | ||
key: 'setPlaybackRate', | ||
key: "setPlaybackRate", | ||
value: function setPlaybackRate(rate) { | ||
@@ -217,3 +261,3 @@ this.callPlayer('setPlaybackRate', rate); | ||
}, { | ||
key: 'setLoop', | ||
key: "setLoop", | ||
value: function setLoop(loop) { | ||
@@ -223,3 +267,3 @@ this.callPlayer('setLoop', loop); | ||
}, { | ||
key: 'getDuration', | ||
key: "getDuration", | ||
value: function getDuration() { | ||
@@ -229,3 +273,3 @@ return this.callPlayer('getDuration'); | ||
}, { | ||
key: 'getCurrentTime', | ||
key: "getCurrentTime", | ||
value: function getCurrentTime() { | ||
@@ -235,3 +279,3 @@ return this.callPlayer('getCurrentTime'); | ||
}, { | ||
key: 'getSecondsLoaded', | ||
key: "getSecondsLoaded", | ||
value: function getSecondsLoaded() { | ||
@@ -241,6 +285,5 @@ return this.callPlayer('getVideoLoadedFraction') * this.getDuration(); | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var display = this.props.display; | ||
var style = { | ||
@@ -251,7 +294,7 @@ width: '100%', | ||
}; | ||
return _react2['default'].createElement( | ||
'div', | ||
{ style: style }, | ||
_react2['default'].createElement('div', { ref: this.ref }) | ||
); | ||
return _react["default"].createElement("div", { | ||
style: style | ||
}, _react["default"].createElement("div", { | ||
ref: this.ref | ||
})); | ||
} | ||
@@ -263,8 +306,12 @@ }]); | ||
YouTube.displayName = 'YouTube'; | ||
exports.YouTube = YouTube; | ||
YouTube.canPlay = function (url) { | ||
_defineProperty(YouTube, "displayName", 'YouTube'); | ||
_defineProperty(YouTube, "canPlay", function (url) { | ||
return MATCH_URL.test(url); | ||
}; | ||
}); | ||
exports['default'] = (0, _singlePlayer2['default'])(YouTube); | ||
var _default = (0, _singlePlayer["default"])(YouTube); | ||
exports["default"] = _default; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,22 +6,18 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports['default'] = renderPreloadPlayers; | ||
exports["default"] = renderPreloadPlayers; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _Player = _interopRequireDefault(require("./Player")); | ||
var _Player = require('./Player'); | ||
var _YouTube = require("./players/YouTube"); | ||
var _Player2 = _interopRequireDefault(_Player); | ||
var _SoundCloud = require("./players/SoundCloud"); | ||
var _YouTube = require('./players/YouTube'); | ||
var _Vimeo = require("./players/Vimeo"); | ||
var _SoundCloud = require('./players/SoundCloud'); | ||
var _DailyMotion = require("./players/DailyMotion"); | ||
var _Vimeo = require('./players/Vimeo'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _DailyMotion = require('./players/DailyMotion'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var PRELOAD_PLAYERS = [{ | ||
@@ -48,35 +44,16 @@ Player: _YouTube.YouTube, | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _i = 0, _PRELOAD_PLAYERS = PRELOAD_PLAYERS; _i < _PRELOAD_PLAYERS.length; _i++) { | ||
var player = _PRELOAD_PLAYERS[_i]; | ||
try { | ||
for (var _iterator = PRELOAD_PLAYERS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var player = _step.value; | ||
if (!player.Player.canPlay(url) && config[player.configKey].preload) { | ||
players.push(_react2['default'].createElement(_Player2['default'], { | ||
key: player.Player.displayName, | ||
activePlayer: player.Player, | ||
url: player.url, | ||
controls: controls, | ||
playing: true, | ||
muted: true, | ||
display: 'none' | ||
})); | ||
} | ||
if (!player.Player.canPlay(url) && config[player.configKey].preload) { | ||
players.push(_react["default"].createElement(_Player["default"], { | ||
key: player.Player.displayName, | ||
activePlayer: player.Player, | ||
url: player.url, | ||
controls: controls, | ||
playing: true, | ||
muted: true, | ||
display: "none" | ||
})); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator['return']) { | ||
_iterator['return'](); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -83,0 +60,0 @@ |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,42 +6,63 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = void 0; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _react = require('react'); | ||
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); } | ||
var _react2 = _interopRequireDefault(_react); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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 ICON_SIZE = '64px'; | ||
var Preview = function (_Component) { | ||
var Preview = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Preview, _Component); | ||
function Preview() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, Preview); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Preview.__proto__ || Object.getPrototypeOf(Preview)).call.apply(_ref, [this].concat(args))), _this), _this.mounted = false, _this.state = { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Preview)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "mounted", false); | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
image: null | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(Preview, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -52,14 +73,14 @@ this.mounted = true; | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
var _props = this.props, | ||
url = _props.url, | ||
light = _props.light; | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
var _this$props = this.props, | ||
url = _this$props.url, | ||
light = _this$props.light; | ||
if (url !== nextProps.url || light !== nextProps.light) { | ||
this.fetchImage(nextProps); | ||
if (prevProps.url !== url || prevProps.light !== light) { | ||
this.fetchImage(this.props); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
@@ -69,15 +90,20 @@ this.mounted = false; | ||
}, { | ||
key: 'fetchImage', | ||
value: function fetchImage(_ref2) { | ||
key: "fetchImage", | ||
value: function fetchImage(_ref) { | ||
var _this2 = this; | ||
var url = _ref2.url, | ||
light = _ref2.light; | ||
var url = _ref.url, | ||
light = _ref.light; | ||
if (typeof light === 'string') { | ||
this.setState({ image: light }); | ||
this.setState({ | ||
image: light | ||
}); | ||
return; | ||
} | ||
this.setState({ image: null }); | ||
return window.fetch('https://noembed.com/embed?url=' + url).then(function (response) { | ||
this.setState({ | ||
image: null | ||
}); | ||
return window.fetch("https://noembed.com/embed?url=".concat(url)).then(function (response) { | ||
return response.json(); | ||
@@ -87,3 +113,6 @@ }).then(function (data) { | ||
var image = data.thumbnail_url.replace('height=100', 'height=480'); | ||
_this2.setState({ image: image }); | ||
_this2.setState({ | ||
image: image | ||
}); | ||
} | ||
@@ -93,7 +122,6 @@ }); | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var onClick = this.props.onClick; | ||
var image = this.state.image; | ||
var flexCenter = { | ||
@@ -105,6 +133,6 @@ display: 'flex', | ||
var styles = { | ||
preview: _extends({ | ||
preview: _objectSpread({ | ||
width: '100%', | ||
height: '100%', | ||
backgroundImage: image ? 'url(' + image + ')' : undefined, | ||
backgroundImage: image ? "url(".concat(image, ")") : undefined, | ||
backgroundSize: 'cover', | ||
@@ -114,3 +142,3 @@ backgroundPosition: 'center', | ||
}, flexCenter), | ||
shadow: _extends({ | ||
shadow: _objectSpread({ | ||
background: 'radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)', | ||
@@ -128,11 +156,13 @@ borderRadius: ICON_SIZE, | ||
}; | ||
return _react2['default'].createElement( | ||
'div', | ||
{ style: styles.preview, className: 'react-player__preview', onClick: onClick }, | ||
_react2['default'].createElement( | ||
'div', | ||
{ style: styles.shadow, className: 'react-player__shadow' }, | ||
_react2['default'].createElement('div', { style: styles.playIcon, className: 'react-player__play-icon' }) | ||
) | ||
); | ||
return _react["default"].createElement("div", { | ||
style: styles.preview, | ||
className: "react-player__preview", | ||
onClick: onClick | ||
}, _react["default"].createElement("div", { | ||
style: styles.shadow, | ||
className: "react-player__shadow" | ||
}, _react["default"].createElement("div", { | ||
style: styles.playIcon, | ||
className: "react-player__play-icon" | ||
}))); | ||
} | ||
@@ -144,2 +174,2 @@ }]); | ||
exports['default'] = Preview; | ||
exports["default"] = Preview; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,19 +6,17 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.DEPRECATED_CONFIG_PROPS = exports.defaultProps = exports.propTypes = undefined; | ||
exports.DEPRECATED_CONFIG_PROPS = exports.defaultProps = exports.propTypes = void 0; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var string = _propTypes2['default'].string, | ||
bool = _propTypes2['default'].bool, | ||
number = _propTypes2['default'].number, | ||
array = _propTypes2['default'].array, | ||
oneOfType = _propTypes2['default'].oneOfType, | ||
shape = _propTypes2['default'].shape, | ||
object = _propTypes2['default'].object, | ||
func = _propTypes2['default'].func; | ||
var propTypes = exports.propTypes = { | ||
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; | ||
var propTypes = { | ||
url: oneOfType([string, array, object]), | ||
@@ -38,3 +36,5 @@ playing: bool, | ||
light: oneOfType([bool, string]), | ||
wrapper: oneOfType([string, func, shape({ render: func.isRequired })]), | ||
wrapper: oneOfType([string, func, shape({ | ||
render: func.isRequired | ||
})]), | ||
config: shape({ | ||
@@ -96,4 +96,4 @@ soundcloud: shape({ | ||
}; | ||
var defaultProps = exports.defaultProps = { | ||
exports.propTypes = propTypes; | ||
var defaultProps = { | ||
playing: false, | ||
@@ -116,3 +116,4 @@ loop: false, | ||
options: { | ||
visual: true, // Undocumented, but makes player fill container and look better | ||
visual: true, | ||
// Undocumented, but makes player fill container and look better | ||
buying: false, | ||
@@ -193,3 +194,4 @@ liking: false, | ||
}; | ||
var DEPRECATED_CONFIG_PROPS = exports.DEPRECATED_CONFIG_PROPS = ['soundcloudConfig', 'youtubeConfig', 'facebookConfig', 'dailymotionConfig', 'vimeoConfig', 'fileConfig', 'wistiaConfig']; | ||
exports.defaultProps = defaultProps; | ||
var DEPRECATED_CONFIG_PROPS = ['soundcloudConfig', 'youtubeConfig', 'facebookConfig', 'dailymotionConfig', 'vimeoConfig', 'fileConfig', 'wistiaConfig']; | ||
exports.DEPRECATED_CONFIG_PROPS = DEPRECATED_CONFIG_PROPS; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,184 +6,219 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.FilePlayer = exports.Mixcloud = exports.DailyMotion = exports.Twitch = exports.Wistia = exports.Streamable = exports.Facebook = exports.Vimeo = exports.SoundCloud = exports.YouTube = undefined; | ||
var _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; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _YouTube = require('./players/YouTube'); | ||
Object.defineProperty(exports, 'YouTube', { | ||
Object.defineProperty(exports, "FilePlayer", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_YouTube)['default']; | ||
return _FilePlayer["default"]; | ||
} | ||
}); | ||
var _SoundCloud = require('./players/SoundCloud'); | ||
Object.defineProperty(exports, 'SoundCloud', { | ||
Object.defineProperty(exports, "YouTube", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_SoundCloud)['default']; | ||
return _YouTube["default"]; | ||
} | ||
}); | ||
var _Vimeo = require('./players/Vimeo'); | ||
Object.defineProperty(exports, 'Vimeo', { | ||
Object.defineProperty(exports, "SoundCloud", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Vimeo)['default']; | ||
return _SoundCloud["default"]; | ||
} | ||
}); | ||
var _Facebook = require('./players/Facebook'); | ||
Object.defineProperty(exports, 'Facebook', { | ||
Object.defineProperty(exports, "Vimeo", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Facebook)['default']; | ||
return _Vimeo["default"]; | ||
} | ||
}); | ||
var _Streamable = require('./players/Streamable'); | ||
Object.defineProperty(exports, 'Streamable', { | ||
Object.defineProperty(exports, "Facebook", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Streamable)['default']; | ||
return _Facebook["default"]; | ||
} | ||
}); | ||
var _Wistia = require('./players/Wistia'); | ||
Object.defineProperty(exports, 'Wistia', { | ||
Object.defineProperty(exports, "Streamable", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Wistia)['default']; | ||
return _Streamable["default"]; | ||
} | ||
}); | ||
var _Twitch = require('./players/Twitch'); | ||
Object.defineProperty(exports, 'Twitch', { | ||
Object.defineProperty(exports, "Wistia", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Twitch)['default']; | ||
return _Wistia["default"]; | ||
} | ||
}); | ||
var _DailyMotion = require('./players/DailyMotion'); | ||
Object.defineProperty(exports, 'DailyMotion', { | ||
Object.defineProperty(exports, "Twitch", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_DailyMotion)['default']; | ||
return _Twitch["default"]; | ||
} | ||
}); | ||
var _Mixcloud = require('./players/Mixcloud'); | ||
Object.defineProperty(exports, 'Mixcloud', { | ||
Object.defineProperty(exports, "DailyMotion", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_Mixcloud)['default']; | ||
return _DailyMotion["default"]; | ||
} | ||
}); | ||
var _FilePlayer = require('./players/FilePlayer'); | ||
Object.defineProperty(exports, 'FilePlayer', { | ||
Object.defineProperty(exports, "Mixcloud", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_FilePlayer)['default']; | ||
return _Mixcloud["default"]; | ||
} | ||
}); | ||
exports["default"] = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _props = require("./props"); | ||
var _props2 = require('./props'); | ||
var _utils = require("./utils"); | ||
var _utils = require('./utils'); | ||
var _players = _interopRequireDefault(require("./players")); | ||
var _players = require('./players'); | ||
var _Player4 = _interopRequireDefault(require("./Player")); | ||
var _players2 = _interopRequireDefault(_players); | ||
var _Preview = _interopRequireDefault(require("./Preview")); | ||
var _Player4 = require('./Player'); | ||
var _FilePlayer = _interopRequireWildcard(require("./players/FilePlayer")); | ||
var _Player5 = _interopRequireDefault(_Player4); | ||
var _preload = _interopRequireDefault(require("./preload")); | ||
var _Preview = require('./Preview'); | ||
var _YouTube = _interopRequireDefault(require("./players/YouTube")); | ||
var _Preview2 = _interopRequireDefault(_Preview); | ||
var _SoundCloud = _interopRequireDefault(require("./players/SoundCloud")); | ||
var _preload = require('./preload'); | ||
var _Vimeo = _interopRequireDefault(require("./players/Vimeo")); | ||
var _preload2 = _interopRequireDefault(_preload); | ||
var _Facebook = _interopRequireDefault(require("./players/Facebook")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Streamable = _interopRequireDefault(require("./players/Streamable")); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
var _Wistia = _interopRequireDefault(require("./players/Wistia")); | ||
var _Twitch = _interopRequireDefault(require("./players/Twitch")); | ||
var _DailyMotion = _interopRequireDefault(require("./players/DailyMotion")); | ||
var _Mixcloud = _interopRequireDefault(require("./players/Mixcloud")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; 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 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 _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 _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
var SUPPORTED_PROPS = Object.keys(_props2.propTypes); | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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 SUPPORTED_PROPS = Object.keys(_props.propTypes); | ||
var customPlayers = []; | ||
var ReactPlayer = function (_Component) { | ||
var ReactPlayer = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(ReactPlayer, _Component); | ||
function ReactPlayer() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, ReactPlayer); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ReactPlayer.__proto__ || Object.getPrototypeOf(ReactPlayer)).call.apply(_ref, [this].concat(args))), _this), _this.config = (0, _utils.getConfig)(_this.props, _props2.defaultProps, true), _this.state = { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ReactPlayer)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "config", (0, _utils.getConfig)(_this.props, _props.defaultProps, true)); | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
showPreview: !!_this.props.light | ||
}, _this.onClickPreview = function () { | ||
_this.setState({ showPreview: false }); | ||
}, _this.showPreview = function () { | ||
_this.setState({ showPreview: true }); | ||
}, _this.getDuration = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleClickPreview", function () { | ||
_this.setState({ | ||
showPreview: false | ||
}); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "showPreview", function () { | ||
_this.setState({ | ||
showPreview: true | ||
}); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getDuration", function () { | ||
if (!_this.player) return null; | ||
return _this.player.getDuration(); | ||
}, _this.getCurrentTime = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getCurrentTime", function () { | ||
if (!_this.player) return null; | ||
return _this.player.getCurrentTime(); | ||
}, _this.getSecondsLoaded = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getSecondsLoaded", function () { | ||
if (!_this.player) return null; | ||
return _this.player.getSecondsLoaded(); | ||
}, _this.getInternalPlayer = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function () { | ||
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'player'; | ||
if (!_this.player) return null; | ||
return _this.player.getInternalPlayer(key); | ||
}, _this.seekTo = function (fraction, type) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type) { | ||
if (!_this.player) return null; | ||
_this.player.seekTo(fraction, type); | ||
}, _this.onReady = function () { | ||
_this.props.onReady(_this); | ||
}, _this.wrapperRef = function (wrapper) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "handleReady", function () { | ||
_this.props.onReady(_assertThisInitialized(_this)); | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "wrapperRef", function (wrapper) { | ||
_this.wrapper = wrapper; | ||
}, _this.activePlayerRef = function (player) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "activePlayerRef", function (player) { | ||
_this.player = player; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(ReactPlayer, [{ | ||
key: 'componentDidMount', | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
@@ -196,3 +231,3 @@ if (this.props.progressFrequency) { | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
@@ -202,33 +237,38 @@ return !(0, _utils.isEqual)(this.props, nextProps) || !(0, _utils.isEqual)(this.state, nextState); | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate(nextProps) { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
var light = this.props.light; | ||
this.config = (0, _utils.getConfig)(this.props, _props.defaultProps); | ||
this.config = (0, _utils.getConfig)(nextProps, _props2.defaultProps); | ||
if (!light && nextProps.light) { | ||
this.setState({ showPreview: true }); | ||
if (!prevProps.light && light) { | ||
this.setState({ | ||
showPreview: true | ||
}); | ||
} | ||
if (light && !nextProps.light) { | ||
this.setState({ showPreview: false }); | ||
if (prevProps.light && !light) { | ||
this.setState({ | ||
showPreview: false | ||
}); | ||
} | ||
} | ||
}, { | ||
key: 'getActivePlayer', | ||
key: "getActivePlayer", | ||
value: function getActivePlayer(url) { | ||
var _arr = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players2['default'])); | ||
for (var _i = 0, _arr = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players["default"])); _i < _arr.length; _i++) { | ||
var _Player = _arr[_i]; | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var _Player = _arr[_i]; | ||
if (_Player.canPlay(url)) { | ||
return _Player; | ||
} | ||
} | ||
// Fall back to FilePlayer if nothing else can play the URL | ||
} // Fall back to FilePlayer if nothing else can play the URL | ||
return _FilePlayer.FilePlayer; | ||
} | ||
}, { | ||
key: 'renderActivePlayer', | ||
key: "renderActivePlayer", | ||
value: function renderActivePlayer(url, activePlayer) { | ||
if (!url) return null; | ||
return _react2['default'].createElement(_Player5['default'], _extends({}, this.props, { | ||
return _react["default"].createElement(_Player4["default"], _extends({}, this.props, { | ||
key: activePlayer.displayName, | ||
@@ -238,7 +278,7 @@ ref: this.activePlayerRef, | ||
activePlayer: activePlayer, | ||
onReady: this.onReady | ||
onReady: this.handleReady | ||
})); | ||
} | ||
}, { | ||
key: 'sortPlayers', | ||
key: "sortPlayers", | ||
value: function sortPlayers(a, b) { | ||
@@ -249,28 +289,36 @@ // Retain player order to prevent weird iframe behaviour when switching players | ||
} | ||
return 0; | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
url = _props.url, | ||
controls = _props.controls, | ||
style = _props.style, | ||
width = _props.width, | ||
height = _props.height, | ||
light = _props.light, | ||
Wrapper = _props.wrapper; | ||
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, | ||
Wrapper = _this$props.wrapper; | ||
var showPreview = this.state.showPreview && url; | ||
var otherProps = (0, _utils.omit)(this.props, SUPPORTED_PROPS, _props2.DEPRECATED_CONFIG_PROPS); | ||
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, _preload2['default'])(url, controls, this.config); | ||
var preloadPlayers = (0, _preload["default"])(url, controls, this.config); | ||
var players = [renderedActivePlayer].concat(_toConsumableArray(preloadPlayers)).sort(this.sortPlayers); | ||
var preview = _react2['default'].createElement(_Preview2['default'], { url: url, light: light, onClick: this.onClickPreview }); | ||
return _react2['default'].createElement( | ||
Wrapper, | ||
_extends({ ref: this.wrapperRef, style: _extends({}, style, { width: width, height: height }) }, otherProps), | ||
showPreview ? preview : players | ||
); | ||
var preview = _react["default"].createElement(_Preview["default"], { | ||
url: url, | ||
light: light, | ||
onClick: this.handleClickPreview | ||
}); | ||
return _react["default"].createElement(Wrapper, _extends({ | ||
ref: this.wrapperRef, | ||
style: _objectSpread({}, style, { | ||
width: width, | ||
height: height | ||
}) | ||
}, otherProps), showPreview ? preview : players); | ||
} | ||
@@ -282,19 +330,22 @@ }]); | ||
ReactPlayer.addCustomPlayer = function (player) { | ||
exports["default"] = ReactPlayer; | ||
_defineProperty(ReactPlayer, "addCustomPlayer", function (player) { | ||
customPlayers.push(player); | ||
}; | ||
}); | ||
ReactPlayer.removeCustomPlayers = function () { | ||
_defineProperty(ReactPlayer, "removeCustomPlayers", function () { | ||
customPlayers = []; | ||
}; | ||
}); | ||
ReactPlayer.displayName = 'ReactPlayer'; | ||
ReactPlayer.propTypes = _props2.propTypes; | ||
ReactPlayer.defaultProps = _props2.defaultProps; | ||
_defineProperty(ReactPlayer, "displayName", 'ReactPlayer'); | ||
ReactPlayer.canPlay = function (url) { | ||
var _arr2 = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players2['default'])); | ||
_defineProperty(ReactPlayer, "propTypes", _props.propTypes); | ||
for (var _i2 = 0; _i2 < _arr2.length; _i2++) { | ||
_defineProperty(ReactPlayer, "defaultProps", _props.defaultProps); | ||
_defineProperty(ReactPlayer, "canPlay", function (url) { | ||
for (var _i2 = 0, _arr2 = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players["default"])); _i2 < _arr2.length; _i2++) { | ||
var _Player2 = _arr2[_i2]; | ||
if (_Player2.canPlay(url)) { | ||
@@ -304,10 +355,10 @@ return true; | ||
} | ||
return false; | ||
}; | ||
}); | ||
ReactPlayer.canEnablePIP = function (url) { | ||
var _arr3 = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players2['default'])); | ||
_defineProperty(ReactPlayer, "canEnablePIP", function (url) { | ||
for (var _i3 = 0, _arr3 = [].concat(_toConsumableArray(customPlayers), _toConsumableArray(_players["default"])); _i3 < _arr3.length; _i3++) { | ||
var _Player3 = _arr3[_i3]; | ||
for (var _i3 = 0; _i3 < _arr3.length; _i3++) { | ||
var _Player3 = _arr3[_i3]; | ||
if (_Player3.canEnablePIP && _Player3.canEnablePIP(url)) { | ||
@@ -317,5 +368,4 @@ return true; | ||
} | ||
return false; | ||
}; | ||
exports['default'] = ReactPlayer; | ||
}); |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,72 +6,103 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = createSinglePlayer; | ||
var _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; }; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _props = require("./props"); | ||
exports['default'] = createSinglePlayer; | ||
var _utils = require("./utils"); | ||
var _react = require('react'); | ||
var _Player = _interopRequireDefault(require("./Player")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _props2 = require('./props'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
var _utils = require('./utils'); | ||
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); } | ||
var _Player = require('./Player'); | ||
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); } | ||
var _Player2 = _interopRequireDefault(_Player); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
var SUPPORTED_PROPS = Object.keys(_props2.propTypes); | ||
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
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 SUPPORTED_PROPS = Object.keys(_props.propTypes); | ||
function createSinglePlayer(activePlayer) { | ||
var _class, _temp2; | ||
var _class, _temp; | ||
return _temp2 = _class = function (_Component) { | ||
return _temp = _class = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(SinglePlayer, _Component); | ||
function SinglePlayer() { | ||
var _ref; | ||
var _getPrototypeOf2; | ||
var _temp, _this, _ret; | ||
var _this; | ||
_classCallCheck(this, SinglePlayer); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = SinglePlayer.__proto__ || Object.getPrototypeOf(SinglePlayer)).call.apply(_ref, [this].concat(args))), _this), _this.config = (0, _utils.getConfig)(_this.props, _props2.defaultProps, true), _this.getDuration = function () { | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SinglePlayer)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_defineProperty(_assertThisInitialized(_this), "config", (0, _utils.getConfig)(_this.props, _props.defaultProps, true)); | ||
_defineProperty(_assertThisInitialized(_this), "getDuration", function () { | ||
if (!_this.player) return null; | ||
return _this.player.getDuration(); | ||
}, _this.getCurrentTime = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getCurrentTime", function () { | ||
if (!_this.player) return null; | ||
return _this.player.getCurrentTime(); | ||
}, _this.getSecondsLoaded = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getSecondsLoaded", function () { | ||
if (!_this.player) return null; | ||
return _this.player.getSecondsLoaded(); | ||
}, _this.getInternalPlayer = function () { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "getInternalPlayer", function () { | ||
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'player'; | ||
if (!_this.player) return null; | ||
return _this.player.getInternalPlayer(key); | ||
}, _this.seekTo = function (fraction, type) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type) { | ||
if (!_this.player) return null; | ||
_this.player.seekTo(fraction, type); | ||
}, _this.ref = function (player) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "ref", function (player) { | ||
_this.player = player; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
}); | ||
return _this; | ||
} | ||
_createClass(SinglePlayer, [{ | ||
key: 'shouldComponentUpdate', | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
@@ -81,35 +112,36 @@ return !(0, _utils.isEqual)(this.props, nextProps); | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate(nextProps) { | ||
this.config = (0, _utils.getConfig)(nextProps, _props2.defaultProps); | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate() { | ||
this.config = (0, _utils.getConfig)(this.props, _props.defaultProps); | ||
} | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _config$file = this.config.file, | ||
forceVideo = _config$file.forceVideo, | ||
forceAudio = _config$file.forceAudio, | ||
forceHLS = _config$file.forceHLS, | ||
forceDASH = _config$file.forceDASH; | ||
var _this$config$file = this.config.file, | ||
forceVideo = _this$config$file.forceVideo, | ||
forceAudio = _this$config$file.forceAudio, | ||
forceHLS = _this$config$file.forceHLS, | ||
forceDASH = _this$config$file.forceDASH; | ||
var skipCanPlay = forceVideo || forceAudio || forceHLS || forceDASH; | ||
var skipCanPlay = forceVideo || forceAudio || forceHLS || forceDASH; | ||
if (!activePlayer.canPlay(this.props.url) && !skipCanPlay) { | ||
return null; | ||
} | ||
var _props = this.props, | ||
style = _props.style, | ||
width = _props.width, | ||
height = _props.height, | ||
Wrapper = _props.wrapper; | ||
var otherProps = (0, _utils.omit)(this.props, SUPPORTED_PROPS, _props2.DEPRECATED_CONFIG_PROPS); | ||
return _react2['default'].createElement( | ||
Wrapper, | ||
_extends({ style: _extends({}, style, { width: width, height: height }) }, otherProps), | ||
_react2['default'].createElement(_Player2['default'], _extends({}, this.props, { | ||
ref: this.ref, | ||
activePlayer: activePlayer, | ||
config: this.config | ||
})) | ||
); | ||
var _this$props = this.props, | ||
style = _this$props.style, | ||
width = _this$props.width, | ||
height = _this$props.height, | ||
Wrapper = _this$props.wrapper; | ||
var otherProps = (0, _utils.omit)(this.props, SUPPORTED_PROPS, _props.DEPRECATED_CONFIG_PROPS); | ||
return _react["default"].createElement(Wrapper, _extends({ | ||
style: _objectSpread({}, style, { | ||
width: width, | ||
height: height | ||
}) | ||
}, otherProps), _react["default"].createElement(_Player["default"], _extends({}, this.props, { | ||
ref: this.ref, | ||
activePlayer: activePlayer, | ||
config: this.config | ||
}))); | ||
} | ||
@@ -119,3 +151,3 @@ }]); | ||
return SinglePlayer; | ||
}(_react.Component), _class.displayName = activePlayer.displayName + 'Player', _class.propTypes = _props2.propTypes, _class.defaultProps = _props2.defaultProps, _class.canPlay = activePlayer.canPlay, _temp2; | ||
}(_react.Component), _defineProperty(_class, "displayName", "".concat(activePlayer.displayName, "Player")), _defineProperty(_class, "propTypes", _props.propTypes), _defineProperty(_class, "defaultProps", _props.defaultProps), _defineProperty(_class, "canPlay", activePlayer.canPlay), _temp; | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,18 +6,14 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports['default'] = renderReactPlayer; | ||
exports["default"] = renderReactPlayer; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _reactDom = require("react-dom"); | ||
var _reactDom = require('react-dom'); | ||
var _ReactPlayer = _interopRequireDefault(require("./ReactPlayer")); | ||
var _ReactPlayer = require('./ReactPlayer'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _ReactPlayer2 = _interopRequireDefault(_ReactPlayer); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function renderReactPlayer(container, props) { | ||
(0, _reactDom.render)(_react2['default'].createElement(_ReactPlayer2['default'], props), container); | ||
(0, _reactDom.render)(_react["default"].createElement(_ReactPlayer["default"], props), container); | ||
} |
149
lib/utils.js
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,7 +6,2 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { 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"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.parseStartTime = parseStartTime; | ||
@@ -24,30 +19,38 @@ exports.parseEndTime = parseEndTime; | ||
var _loadScript = require('load-script'); | ||
var _loadScript = _interopRequireDefault(require("load-script")); | ||
var _loadScript2 = _interopRequireDefault(_loadScript); | ||
var _deepmerge = _interopRequireDefault(require("deepmerge")); | ||
var _deepmerge = require('deepmerge'); | ||
var _props = require("./props"); | ||
var _deepmerge2 = _interopRequireDefault(_deepmerge); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _props = require('./props'); | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
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 _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { 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; } | ||
var MATCH_START_QUERY = /[?&#](?:start|t)=([0-9hms]+)/; | ||
var MATCH_END_QUERY = /[?&#]end=([0-9hms]+)/; | ||
var MATCH_START_STAMP = /(\d+)(h|m|s)/g; | ||
var MATCH_NUMERIC = /^\d+$/; | ||
var MATCH_NUMERIC = /^\d+$/; // Parse YouTube URL for a start time param, ie ?t=1h14m30s | ||
// and return the start time in seconds | ||
// Parse YouTube URL for a start time param, ie ?t=1h14m30s | ||
// and return the start time in seconds | ||
function parseTimeParam(url, pattern) { | ||
var match = url.match(pattern); | ||
if (match) { | ||
var stamp = match[1]; | ||
if (stamp.match(MATCH_START_STAMP)) { | ||
return parseTimeString(stamp); | ||
} | ||
if (MATCH_NUMERIC.test(stamp)) { | ||
@@ -57,2 +60,3 @@ return parseInt(stamp); | ||
} | ||
return undefined; | ||
@@ -64,2 +68,3 @@ } | ||
var array = MATCH_START_STAMP.exec(stamp); | ||
while (array !== null) { | ||
@@ -76,2 +81,3 @@ var _array = array, | ||
} | ||
return seconds; | ||
@@ -86,5 +92,5 @@ } | ||
return parseTimeParam(url, MATCH_END_QUERY); | ||
} | ||
} // http://stackoverflow.com/a/38622545 | ||
// http://stackoverflow.com/a/38622545 | ||
function randomString() { | ||
@@ -96,9 +102,10 @@ return Math.random().toString(36).substr(2, 5); | ||
return Object.keys(object).map(function (key) { | ||
return key + '=' + object[key]; | ||
return "".concat(key, "=").concat(object[key]); | ||
}).join('&'); | ||
} | ||
} // Util function to load an external SDK | ||
// or return the SDK if it is already loaded | ||
// Util function to load an external SDK | ||
// or return the SDK if it is already loaded | ||
var resolves = {}; | ||
function getSDK(url, sdkGlobal) { | ||
@@ -109,3 +116,3 @@ var sdkReady = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
}; | ||
var fetchScript = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _loadScript2['default']; | ||
var fetchScript = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _loadScript["default"]; | ||
@@ -115,2 +122,3 @@ if (window[sdkGlobal] && isLoaded(window[sdkGlobal])) { | ||
} | ||
return new Promise(function (resolve, reject) { | ||
@@ -123,3 +131,5 @@ // If we are already loading the SDK, add the resolve | ||
} | ||
resolves[url] = [resolve]; | ||
var onLoaded = function onLoaded(sdk) { | ||
@@ -131,4 +141,6 @@ // When loaded, resolve all pending promises | ||
}; | ||
if (sdkReady) { | ||
var previousOnReady = window[sdkReady]; | ||
window[sdkReady] = function () { | ||
@@ -139,4 +151,6 @@ if (previousOnReady) previousOnReady(); | ||
} | ||
fetchScript(url, function (err) { | ||
if (err) reject(err); | ||
if (!sdkReady) { | ||
@@ -150,3 +164,3 @@ onLoaded(window[sdkGlobal]); | ||
function getConfig(props, defaultProps, showWarning) { | ||
var config = (0, _deepmerge2['default'])(defaultProps.config, props.config); | ||
var config = (0, _deepmerge["default"])(defaultProps.config, props.config); | ||
var _iteratorNormalCompletion = true; | ||
@@ -162,6 +176,7 @@ var _didIteratorError = false; | ||
var key = p.replace(/Config$/, ''); | ||
config = (0, _deepmerge2['default'])(config, _defineProperty({}, key, props[p])); | ||
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' + p + ' %cis deprecated, please use the config prop instead \u2013 ' + link; | ||
var message = "ReactPlayer: %c".concat(p, " %cis deprecated, please use the config prop instead \u2013 ").concat(link); | ||
console.warn(message, 'font-weight: bold', ''); | ||
@@ -176,4 +191,4 @@ } | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator['return']) { | ||
_iterator['return'](); | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
@@ -193,3 +208,3 @@ } finally { | ||
for (var _len = arguments.length, arrays = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
for (var _len = arguments.length, arrays = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
arrays[_key - 1] = arguments[_key]; | ||
@@ -199,29 +214,12 @@ } | ||
var omitKeys = (_ref = []).concat.apply(_ref, arrays); | ||
var output = {}; | ||
var keys = Object.keys(object); | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var key = _step2.value; | ||
for (var _i2 = 0, _keys = keys; _i2 < _keys.length; _i2++) { | ||
var key = _keys[_i2]; | ||
if (omitKeys.indexOf(key) === -1) { | ||
output[key] = object[key]; | ||
} | ||
if (omitKeys.indexOf(key) === -1) { | ||
output[key] = object[key]; | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2['return']) { | ||
_iterator2['return'](); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
@@ -233,3 +231,3 @@ | ||
function callPlayer(method) { | ||
var _player; | ||
var _this$player; | ||
@@ -239,3 +237,4 @@ // Util method for calling a method on this.player | ||
if (!this.player || !this.player[method]) { | ||
var message = 'ReactPlayer: ' + this.constructor.displayName + ' player could not call %c' + method + '%c \u2013 '; | ||
var message = "ReactPlayer: ".concat(this.constructor.displayName, " player could not call %c").concat(method, "%c \u2013 "); | ||
if (!this.player) { | ||
@@ -246,2 +245,3 @@ message += 'The player was not available'; | ||
} | ||
console.warn(message, 'font-weight: bold', ''); | ||
@@ -251,15 +251,15 @@ return null; | ||
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
} | ||
return (_player = this.player)[method].apply(_player, args); | ||
return (_this$player = this.player)[method].apply(_this$player, args); | ||
} | ||
function isObject(val) { | ||
return val !== null && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object'; | ||
} | ||
return val !== null && _typeof(val) === 'object'; | ||
} // Deep comparison of two objects but ignoring | ||
// functions, for use in shouldComponentUpdate | ||
// Deep comparison of two objects but ignoring | ||
// functions, for use in shouldComponentUpdate | ||
function isEqual(a, b) { | ||
@@ -269,2 +269,3 @@ if (typeof a === 'function' && typeof b === 'function') { | ||
} | ||
if (a instanceof Array && b instanceof Array) { | ||
@@ -274,2 +275,3 @@ if (a.length !== b.length) { | ||
} | ||
for (var i = 0; i !== a.length; i++) { | ||
@@ -280,4 +282,6 @@ if (!isEqual(a[i], b[i])) { | ||
} | ||
return true; | ||
} | ||
if (isObject(a) && isObject(b)) { | ||
@@ -287,27 +291,9 @@ if (Object.keys(a).length !== Object.keys(b).length) { | ||
} | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator3 = Object.keys(a)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var key = _step3.value; | ||
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; | ||
} | ||
if (!isEqual(a[key], b[key])) { | ||
return false; | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3['return']) { | ||
_iterator3['return'](); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
} | ||
@@ -317,2 +303,3 @@ | ||
} | ||
return a === b; | ||
@@ -319,0 +306,0 @@ } |
122
package.json
{ | ||
"name": "react-player", | ||
"version": "1.11.2", | ||
"version": "1.12.0", | ||
"description": "A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion", | ||
@@ -9,4 +9,5 @@ "main": "lib/ReactPlayer.js", | ||
"clean": "rimraf lib demo coverage", | ||
"start": "webpack-dev-server", | ||
"start": "webpack-dev-server --config webpack/config.babel.js", | ||
"lint": "standard --verbose | snazzy", | ||
"lint:fix": "standard --fix", | ||
"test": "cross-env NODE_ENV=test ava", | ||
@@ -16,5 +17,5 @@ "test:coverage": "cross-env NODE_ENV=test nyc ava", | ||
"build:lib": "cross-env NODE_ENV=production babel src -d lib --ignore src/demo", | ||
"build:demo": "cross-env NODE_ENV=production webpack --config webpack.demo.babel.js", | ||
"build:dist": "cross-env NODE_ENV=production webpack --config webpack.dist.babel.js", | ||
"build:standalone": "cross-env NODE_ENV=production webpack --config webpack.standalone.babel.js", | ||
"build:demo": "cross-env NODE_ENV=production webpack --config webpack/production.babel.js", | ||
"build:dist": "cross-env NODE_ENV=production webpack --config webpack/dist.babel.js", | ||
"build:standalone": "cross-env NODE_ENV=production webpack --config webpack/standalone.babel.js", | ||
"preversion": "npm run lint && npm run test", | ||
@@ -57,44 +58,46 @@ "version": "auto-changelog -p && npm run build:dist && npm run build:standalone && git add CHANGELOG.md dist", | ||
"devDependencies": { | ||
"auto-changelog": "^1.11.0", | ||
"ava": "^0.25.0", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.16.0", | ||
"babel-eslint": "^8.2.1", | ||
"babel-loader": "^7.0.0", | ||
"babel-plugin-istanbul": "^4.1.4", | ||
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0", | ||
"babel-plugin-transform-es3-property-literals": "^6.8.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-preset-stage-0": "^6.16.0", | ||
"codecov": "^3.0.0", | ||
"cross-env": "^5.1.3", | ||
"css-loader": "^0.28.9", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"exports-loader": "^0.6.3", | ||
"extract-text-webpack-plugin": "^3.0.2", | ||
"html-webpack-plugin": "^2.30.1", | ||
"nyc": "^11.7.1", | ||
"postcss-automath": "^1.0.1", | ||
"postcss-loader": "^2.0.10", | ||
"postcss-nested": "^3.0.0", | ||
"postcss-sassy-mixins": "^2.1.0", | ||
"postcss-simple-vars": "^4.1.0", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"react-hot-loader": "^4.0.0-beta.15", | ||
"rimraf": "^2.5.4", | ||
"screenfull": "^4.0.0", | ||
"sinon": "^5.0.3", | ||
"snazzy": "^7.0.0", | ||
"standard": "^11.0.0-beta.0", | ||
"style-loader": "^0.19.1", | ||
"webpack": "^3.10.0", | ||
"webpack-dev-server": "^2.11.0", | ||
"whatwg-fetch": "^2.0.1" | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@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.2.0", | ||
"babel-eslint": "^10.0.2", | ||
"babel-loader": "^8.0.6", | ||
"babel-plugin-istanbul": "^5.2.0", | ||
"codecov": "^3.5.0", | ||
"cross-env": "^5.2.0", | ||
"css-loader": "^3.2.0", | ||
"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", | ||
"optimize-css-assets-webpack-plugin": "^5.0.3", | ||
"postcss-advanced-variables": "^3.0.0", | ||
"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", | ||
"sanitize.css": "^11.0.0", | ||
"screenfull": "^4.2.1", | ||
"sinon": "^7.4.1", | ||
"snazzy": "^8.0.0", | ||
"standard": "^14.0.0-1", | ||
"style-loader": "^1.0.0", | ||
"uglifyjs-webpack-plugin": "^2.2.0", | ||
"webpack": "^4.39.2", | ||
"webpack-cli": "^3.3.6", | ||
"webpack-dev-server": "^3.8.0" | ||
}, | ||
"dependencies": { | ||
"deepmerge": "^3.0.0", | ||
"deepmerge": "^4.0.0", | ||
"load-script": "^1.0.0", | ||
@@ -105,16 +108,10 @@ "prop-types": "^15.5.6" | ||
"presets": [ | ||
"env", | ||
"stage-0", | ||
"react" | ||
"@babel/preset-env", | ||
"@babel/preset-react" | ||
], | ||
"plugins": [ | ||
"react-hot-loader/babel" | ||
"react-hot-loader/babel", | ||
"@babel/plugin-proposal-class-properties" | ||
], | ||
"env": { | ||
"production": { | ||
"plugins": [ | ||
"transform-es3-member-expression-literals", | ||
"transform-es3-property-literals" | ||
] | ||
}, | ||
"test": { | ||
@@ -129,6 +126,5 @@ "plugins": [ | ||
"plugins": { | ||
"postcss-nested": {}, | ||
"postcss-sassy-mixins": {}, | ||
"postcss-simple-vars": {}, | ||
"postcss-automath": {} | ||
"autoprefixer": {}, | ||
"postcss-advanced-variables": {}, | ||
"postcss-nested": {} | ||
} | ||
@@ -143,6 +139,8 @@ }, | ||
"ava": { | ||
"babel": "inherit", | ||
"require": [ | ||
"babel-register", | ||
"babel-polyfill" | ||
"@babel/register", | ||
"@babel/polyfill" | ||
], | ||
"helpers": [ | ||
"test/helpers/*" | ||
] | ||
@@ -149,0 +147,0 @@ }, |
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
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
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
1756110
36
5320
41
1
+ Addeddeepmerge@4.3.1(transitive)
- Removeddeepmerge@3.3.0(transitive)
Updateddeepmerge@^4.0.0