react-player
Advanced tools
Comparing version 1.9.3 to 1.10.0
@@ -7,2 +7,14 @@ ### Changelog | ||
#### [v1.10.0](https://github.com/CookPete/react-player/compare/v1.9.3...v1.10.0) | ||
> 24 March 2019 | ||
- Add playsinline support to vimeo [`#574`](https://github.com/CookPete/react-player/issues/574) | ||
- Use normal wrapper for light mode [`#584`](https://github.com/CookPete/react-player/issues/584) | ||
- Pass controls prop through to preload players [`#587`](https://github.com/CookPete/react-player/issues/587) | ||
- Add Soundcloud preload to props files [`#588`](https://github.com/CookPete/react-player/issues/588) | ||
- Add type parameter to seekTo method [`#591`](https://github.com/CookPete/react-player/issues/591) | ||
- Set isLoading to false after error [`#595`](https://github.com/CookPete/react-player/issues/595) | ||
- Unbind wistia player events correctly [`#594`](https://github.com/CookPete/react-player/issues/594) | ||
#### [v1.9.3](https://github.com/CookPete/react-player/compare/v1.9.2...v1.9.3) | ||
@@ -9,0 +21,0 @@ |
@@ -18,2 +18,3 @@ import * as React from 'react'; | ||
options?: Object; | ||
preload?: boolean; | ||
} | ||
@@ -20,0 +21,0 @@ |
@@ -129,2 +129,5 @@ 'use strict'; | ||
} | ||
}, _this.onError = function (e) { | ||
_this.isLoading = false; | ||
_this.props.onError(e); | ||
}, _this.onDurationCheck = function () { | ||
@@ -254,3 +257,3 @@ clearTimeout(_this.durationCheckTimeout); | ||
key: 'seekTo', | ||
value: function seekTo(amount) { | ||
value: function seekTo(amount, type) { | ||
var _this3 = this; | ||
@@ -266,3 +269,4 @@ | ||
} | ||
if (amount > 0 && amount < 1) { | ||
var isFraction = !type ? amount > 0 && amount < 1 : type === 'fraction'; | ||
if (isFraction) { | ||
// Convert fraction to seconds based on duration | ||
@@ -292,3 +296,4 @@ var duration = this.player.getDuration(); | ||
onEnded: this.onEnded, | ||
onLoaded: this.onLoaded | ||
onLoaded: this.onLoaded, | ||
onError: this.onError | ||
})); | ||
@@ -295,0 +300,0 @@ } |
@@ -68,8 +68,9 @@ 'use strict'; | ||
if (!_this2.container) return; | ||
_this2.player = new Vimeo.Player(_this2.container, _extends({}, _this2.props.config.vimeo.playerOptions, { | ||
_this2.player = new Vimeo.Player(_this2.container, _extends({ | ||
url: url, | ||
autoplay: _this2.props.playing, | ||
muted: _this2.props.muted, | ||
loop: _this2.props.loop | ||
})); | ||
loop: _this2.props.loop, | ||
playsinline: _this2.props.playsinline | ||
}, _this2.props.config.vimeo.playerOptions)); | ||
_this2.player.ready().then(function () { | ||
@@ -76,0 +77,0 @@ var iframe = _this2.container.querySelector('iframe'); |
@@ -88,2 +88,3 @@ 'use strict'; | ||
_this2.player = player; | ||
_this2.unbind(); | ||
_this2.player.bind('play', onPlay); | ||
@@ -109,4 +110,19 @@ _this2.player.bind('pause', onPause); | ||
}, { | ||
key: 'unbind', | ||
value: function unbind() { | ||
var _props2 = this.props, | ||
onPlay = _props2.onPlay, | ||
onPause = _props2.onPause, | ||
onSeek = _props2.onSeek, | ||
onEnded = _props2.onEnded; | ||
this.player.unbind('play', onPlay); | ||
this.player.unbind('pause', onPause); | ||
this.player.unbind('seek', onSeek); | ||
this.player.unbind('end', onEnded); | ||
} | ||
}, { | ||
key: 'stop', | ||
value: function stop() { | ||
this.unbind(); | ||
this.callPlayer('remove'); | ||
@@ -113,0 +129,0 @@ } |
@@ -44,3 +44,3 @@ 'use strict'; | ||
function renderPreloadPlayers(url, config) { | ||
function renderPreloadPlayers(url, controls, config) { | ||
var players = []; | ||
@@ -61,2 +61,3 @@ | ||
url: player.url, | ||
controls: controls, | ||
playing: true, | ||
@@ -63,0 +64,0 @@ muted: true, |
@@ -40,3 +40,4 @@ 'use strict'; | ||
soundcloud: shape({ | ||
options: object | ||
options: object, | ||
preload: bool | ||
}), | ||
@@ -43,0 +44,0 @@ youtube: shape({ |
@@ -172,5 +172,5 @@ 'use strict'; | ||
return _this.player.getInternalPlayer(key); | ||
}, _this.seekTo = function (fraction) { | ||
}, _this.seekTo = function (fraction, type) { | ||
if (!_this.player) return null; | ||
_this.player.seekTo(fraction); | ||
_this.player.seekTo(fraction, type); | ||
}, _this.onReady = function () { | ||
@@ -246,2 +246,3 @@ _this.props.onReady(_this); | ||
url = _props.url, | ||
controls = _props.controls, | ||
style = _props.style, | ||
@@ -252,20 +253,14 @@ width = _props.width, | ||
Wrapper = _props.wrapper; | ||
var showPreview = this.state.showPreview; | ||
var showPreview = this.state.showPreview && url; | ||
var otherProps = (0, _utils.omit)(this.props, SUPPORTED_PROPS, _props2.DEPRECATED_CONFIG_PROPS); | ||
var activePlayer = this.getActivePlayer(url); | ||
var renderedActivePlayer = this.renderActivePlayer(url, activePlayer); | ||
var preloadPlayers = (0, _preload2['default'])(url, this.config); | ||
var preloadPlayers = (0, _preload2['default'])(url, controls, this.config); | ||
var players = [renderedActivePlayer].concat(_toConsumableArray(preloadPlayers)).sort(this.sortPlayers); | ||
if (showPreview && url) { | ||
return _react2['default'].createElement(_Preview2['default'], { | ||
url: url, | ||
light: light, | ||
onClick: this.onClickPreview | ||
}); | ||
} | ||
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), | ||
players | ||
showPreview ? preview : players | ||
); | ||
@@ -272,0 +267,0 @@ } |
@@ -66,5 +66,5 @@ 'use strict'; | ||
return _this.player.getInternalPlayer(key); | ||
}, _this.seekTo = function (fraction) { | ||
}, _this.seekTo = function (fraction, type) { | ||
if (!_this.player) return null; | ||
_this.player.seekTo(fraction); | ||
_this.player.seekTo(fraction, type); | ||
}, _this.ref = function (player) { | ||
@@ -71,0 +71,0 @@ _this.player = player; |
{ | ||
"name": "react-player", | ||
"version": "1.9.3", | ||
"version": "1.10.0", | ||
"description": "A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion", | ||
@@ -5,0 +5,0 @@ "main": "lib/ReactPlayer.js", |
@@ -164,3 +164,3 @@ <h1 align='center'> | ||
------ | ----------- | ||
`seekTo(amount)` | Seek to the given number of seconds, or fraction if `amount` is between `0` and `1` | ||
`seekTo(amount, type)` | Seek to the given number of seconds, or fraction if `amount` is between `0` and `1`<br /> ◦ `type` parameter lets you specify `'seconds'` or `'fraction'` to override deault behaviour | ||
`getCurrentTime()` | Returns the number of seconds that have been played<br /> ◦ Returns `null` if unavailable | ||
@@ -167,0 +167,0 @@ `getSecondsLoaded()` | Returns the number of seconds that have been loaded<br /> ◦ Returns `null` if unavailable or unsupported |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1733007
4049