Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-player

Package Overview
Dependencies
Maintainers
1
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-player - npm Package Compare versions

Comparing version 2.12.0 to 2.13.0

4

es6/patterns.js
import { isMediaStream, isBlobUrl } from './utils'
export const MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//
export const MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//
export const MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/

@@ -9,3 +9,3 @@ export const MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/

export const MATCH_URL_STREAMABLE = /streamable\.com\/([a-z0-9]+)$/
export const MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?(.*)$/
export const MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/
export const MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/

@@ -12,0 +12,0 @@ export const MATCH_URL_TWITCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/

@@ -147,3 +147,3 @@ import React, { Component } from 'react'

seekTo (amount, type) {
seekTo (amount, type, keepPlaying) {
// When seeking before player is ready, store value and seek later

@@ -165,6 +165,6 @@ if (!this.isReady) {

}
this.player.seekTo(duration * amount)
this.player.seekTo(duration * amount, keepPlaying)
return
}
this.player.seekTo(amount)
this.player.seekTo(amount, keepPlaying)
}

@@ -171,0 +171,0 @@

@@ -76,4 +76,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('seek', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -80,0 +83,0 @@

@@ -74,4 +74,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('seek', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -78,0 +81,0 @@

@@ -27,4 +27,7 @@ import React, { Component } from 'react'

this.addListeners(this.player)
this.player.src = this.getSource(this.props.url) // Ensure src is set in strict mode
if (IS_IOS) {
const src = this.getSource(this.props.url) // Ensure src is set in strict mode
if (src) {
this.player.src = src
}
if (IS_IOS || this.props.config.forceDisableHls) {
this.player.load()

@@ -42,3 +45,4 @@ }

this.props.url !== prevProps.url &&
!isMediaStream(this.props.url)
!isMediaStream(this.props.url) &&
!(this.props.url instanceof Array) // Avoid infinite loop
) {

@@ -50,3 +54,3 @@ this.player.srcObject = null

componentWillUnmount () {
this.player.src = ''
this.player.removeAttribute('src')
this.removeListeners(this.player)

@@ -144,9 +148,6 @@ if (this.hls) {

shouldUseHLS (url) {
if (this.props.config.forceHLS) {
if ((IS_SAFARI && this.props.config.forceSafariHLS) || this.props.config.forceHLS) {
return true
}
if (IS_SAFARI && this.props.config.forceSafariHLS) {
return true
}
if (IS_IOS) {
if (IS_IOS || this.props.config.forceDisableHls) {
return false

@@ -250,4 +251,7 @@ }

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.player.currentTime = seconds
if (!keepPlaying) {
this.pause()
}
}

@@ -254,0 +258,0 @@

@@ -64,4 +64,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('setCurrentTime', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -68,0 +71,0 @@

@@ -51,4 +51,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('seek', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -55,0 +58,0 @@

@@ -68,4 +68,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('seekTo', seconds * 1000)
if (!keepPlaying) {
this.pause()
}
}

@@ -72,0 +75,0 @@

@@ -59,4 +59,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('setCurrentTime', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -63,0 +66,0 @@

@@ -72,4 +72,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('seek', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -76,0 +79,0 @@

@@ -63,4 +63,7 @@ import React, { Component } from 'react'

seekTo (amount) {
seekTo (amount, keepPlaying = true) {
this.callPlayer('seek', amount)
if (!keepPlaying) {
this.pause()
}
}

@@ -67,0 +70,0 @@

@@ -9,2 +9,6 @@ import React, { Component } from 'react'

const cleanUrl = url => {
return url.replace('/manage/videos', '')
}
export default class Vimeo extends Component {

@@ -29,3 +33,3 @@ static displayName = 'Vimeo'

this.player = new Vimeo.Player(this.container, {
url,
url: cleanUrl(url),
autoplay: this.props.playing,

@@ -91,4 +95,7 @@ muted: this.props.muted,

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('setCurrentTime', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -95,0 +102,0 @@

@@ -86,4 +86,7 @@ import React, { Component } from 'react'

seekTo (seconds) {
seekTo (seconds, keepPlaying = true) {
this.callPlayer('time', seconds)
if (!keepPlaying) {
this.pause()
}
}

@@ -90,0 +93,0 @@

@@ -71,2 +71,3 @@ import React, { Component } from 'react'

onPlaybackRateChange: event => this.props.onPlaybackRateChange(event.data),
onPlaybackQualityChange: event => this.props.onPlaybackQualityChange(event),
onStateChange: this.onStateChange,

@@ -147,5 +148,5 @@ onError: event => onError(event.data)

seekTo (amount) {
seekTo (amount, keepPlaying = false) {
this.callPlayer('seekTo', amount)
if (!this.props.playing) {
if (!keepPlaying && !this.props.playing) {
this.pause()

@@ -152,0 +153,0 @@ }

@@ -59,2 +59,3 @@ import PropTypes from 'prop-types'

forceSafariHLS: bool,
forceDisableHls: bool,
forceDASH: bool,

@@ -94,2 +95,3 @@ forceFLV: bool,

onPlaybackRateChange: func,
onPlaybackQualityChange: func,
onProgress: func,

@@ -177,3 +179,4 @@ onClickPreview: func,

dashVersion: '3.1.3',
flvVersion: '1.5.0'
flvVersion: '1.5.0',
forceDisableHls: false
},

@@ -209,2 +212,3 @@ wistia: {

onPlaybackRateChange: noop,
onPlaybackQualityChange: noop,
onProgress: noop,

@@ -211,0 +215,0 @@ onClickPreview: noop,

@@ -101,5 +101,5 @@ import React, { Component, Suspense, lazy } from 'react'

seekTo = (fraction, type) => {
seekTo = (fraction, type, keepPlaying) => {
if (!this.player) return null
this.player.seekTo(fraction, type)
this.player.seekTo(fraction, type, keepPlaying)
}

@@ -106,0 +106,0 @@

@@ -18,2 +18,3 @@ import BaseReactPlayer, { BaseReactPlayerProps } from './base'

forceSafariHLS?: boolean
forceDisableHls?: boolean
forceDASH?: boolean

@@ -20,0 +21,0 @@ forceFLV?: boolean

@@ -16,3 +16,3 @@ "use strict";

var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
exports.MATCH_URL_YOUTUBE = MATCH_URL_YOUTUBE;

@@ -29,3 +29,3 @@ var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/;

exports.MATCH_URL_STREAMABLE = MATCH_URL_STREAMABLE;
var MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?(.*)$/;
var MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/;
exports.MATCH_URL_WISTIA = MATCH_URL_WISTIA;

@@ -32,0 +32,0 @@ var MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/;

@@ -364,3 +364,3 @@ "use strict";

key: "seekTo",
value: function seekTo(amount, type) {
value: function seekTo(amount, type, keepPlaying) {
var _this3 = this;

@@ -391,7 +391,7 @@

this.player.seekTo(duration * amount);
this.player.seekTo(duration * amount, keepPlaying);
return;
}
this.player.seekTo(amount);
this.player.seekTo(amount, keepPlaying);
}

@@ -398,0 +398,0 @@ }, {

@@ -179,3 +179,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -182,0 +187,0 @@ }, {

@@ -156,3 +156,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -159,0 +164,0 @@ }, {

@@ -197,5 +197,9 @@ "use strict";

this.addListeners(this.player);
this.player.src = this.getSource(this.props.url); // Ensure src is set in strict mode
var src = this.getSource(this.props.url); // Ensure src is set in strict mode
if (IS_IOS) {
if (src) {
this.player.src = src;
}
if (IS_IOS || this.props.config.forceDisableHls) {
this.player.load();

@@ -212,5 +216,6 @@ }

if (this.props.url !== prevProps.url && !(0, _utils.isMediaStream)(this.props.url)) {
this.player.srcObject = null;
}
if (this.props.url !== prevProps.url && !(0, _utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array) // Avoid infinite loop
) {
this.player.srcObject = null;
}
}

@@ -220,3 +225,3 @@ }, {

value: function componentWillUnmount() {
this.player.src = '';
this.player.removeAttribute('src');
this.removeListeners(this.player);

@@ -295,11 +300,7 @@

value: function shouldUseHLS(url) {
if (this.props.config.forceHLS) {
if (IS_SAFARI && this.props.config.forceSafariHLS || this.props.config.forceHLS) {
return true;
}
if (IS_SAFARI && this.props.config.forceSafariHLS) {
return true;
}
if (IS_IOS) {
if (IS_IOS || this.props.config.forceDisableHls) {
return false;

@@ -446,3 +447,8 @@ }

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.player.currentTime = seconds;
if (!keepPlaying) {
this.pause();
}
}

@@ -449,0 +455,0 @@ }, {

@@ -150,3 +150,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('setCurrentTime', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -153,0 +158,0 @@ }, {

@@ -134,3 +134,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -137,0 +142,0 @@ }, {

@@ -167,3 +167,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seekTo', seconds * 1000);
if (!keepPlaying) {
this.pause();
}
}

@@ -170,0 +175,0 @@ }, {

@@ -149,3 +149,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('setCurrentTime', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -152,0 +157,0 @@ }, {

@@ -167,3 +167,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -170,0 +175,0 @@ }, {

@@ -154,3 +154,8 @@ "use strict";

value: function seekTo(amount) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', amount);
if (!keepPlaying) {
this.pause();
}
}

@@ -157,0 +162,0 @@ }, {

@@ -49,2 +49,6 @@ "use strict";

var cleanUrl = function cleanUrl(url) {
return url.replace('/manage/videos', '');
};
var Vimeo = /*#__PURE__*/function (_Component) {

@@ -106,3 +110,3 @@ _inherits(Vimeo, _Component);

_this2.player = new Vimeo.Player(_this2.container, _objectSpread({
url: url,
url: cleanUrl(url),
autoplay: _this2.props.playing,

@@ -198,3 +202,8 @@ muted: _this2.props.muted,

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('setCurrentTime', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -201,0 +210,0 @@ }, {

@@ -201,3 +201,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('time', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -204,0 +209,0 @@ }, {

@@ -253,2 +253,5 @@ "use strict";

},
onPlaybackQualityChange: function onPlaybackQualityChange(event) {
return _this2.props.onPlaybackQualityChange(event);
},
onStateChange: _this2.onStateChange,

@@ -286,5 +289,6 @@ onError: function onError(event) {

value: function seekTo(amount) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
this.callPlayer('seekTo', amount);
if (!this.props.playing) {
if (!keepPlaying && !this.props.playing) {
this.pause();

@@ -291,0 +295,0 @@ }

@@ -73,2 +73,3 @@ "use strict";

forceSafariHLS: bool,
forceDisableHls: bool,
forceDASH: bool,

@@ -108,2 +109,3 @@ forceFLV: bool,

onPlaybackRateChange: func,
onPlaybackQualityChange: func,
onProgress: func,

@@ -193,3 +195,4 @@ onClickPreview: func,

dashVersion: '3.1.3',
flvVersion: '1.5.0'
flvVersion: '1.5.0',
forceDisableHls: false
},

@@ -225,2 +228,3 @@ wistia: {

onPlaybackRateChange: noop,
onPlaybackQualityChange: noop,
onProgress: noop,

@@ -227,0 +231,0 @@ onClickPreview: noop,

@@ -152,6 +152,6 @@ "use strict";

_defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type) {
_defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type, keepPlaying) {
if (!_this.player) return null;
_this.player.seekTo(fraction, type);
_this.player.seekTo(fraction, type, keepPlaying);
});

@@ -158,0 +158,0 @@

@@ -16,3 +16,3 @@ "use strict";

var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
var MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
exports.MATCH_URL_YOUTUBE = MATCH_URL_YOUTUBE;

@@ -29,3 +29,3 @@ var MATCH_URL_SOUNDCLOUD = /(?:soundcloud\.com|snd\.sc)\/[^.]+$/;

exports.MATCH_URL_STREAMABLE = MATCH_URL_STREAMABLE;
var MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?(.*)$/;
var MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/;
exports.MATCH_URL_WISTIA = MATCH_URL_WISTIA;

@@ -32,0 +32,0 @@ var MATCH_URL_TWITCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/;

@@ -364,3 +364,3 @@ "use strict";

key: "seekTo",
value: function seekTo(amount, type) {
value: function seekTo(amount, type, keepPlaying) {
var _this3 = this;

@@ -391,7 +391,7 @@

this.player.seekTo(duration * amount);
this.player.seekTo(duration * amount, keepPlaying);
return;
}
this.player.seekTo(amount);
this.player.seekTo(amount, keepPlaying);
}

@@ -398,0 +398,0 @@ }, {

@@ -179,3 +179,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -182,0 +187,0 @@ }, {

@@ -156,3 +156,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -159,0 +164,0 @@ }, {

@@ -197,5 +197,9 @@ "use strict";

this.addListeners(this.player);
this.player.src = this.getSource(this.props.url); // Ensure src is set in strict mode
var src = this.getSource(this.props.url); // Ensure src is set in strict mode
if (IS_IOS) {
if (src) {
this.player.src = src;
}
if (IS_IOS || this.props.config.forceDisableHls) {
this.player.load();

@@ -212,5 +216,6 @@ }

if (this.props.url !== prevProps.url && !(0, _utils.isMediaStream)(this.props.url)) {
this.player.srcObject = null;
}
if (this.props.url !== prevProps.url && !(0, _utils.isMediaStream)(this.props.url) && !(this.props.url instanceof Array) // Avoid infinite loop
) {
this.player.srcObject = null;
}
}

@@ -220,3 +225,3 @@ }, {

value: function componentWillUnmount() {
this.player.src = '';
this.player.removeAttribute('src');
this.removeListeners(this.player);

@@ -295,11 +300,7 @@

value: function shouldUseHLS(url) {
if (this.props.config.forceHLS) {
if (IS_SAFARI && this.props.config.forceSafariHLS || this.props.config.forceHLS) {
return true;
}
if (IS_SAFARI && this.props.config.forceSafariHLS) {
return true;
}
if (IS_IOS) {
if (IS_IOS || this.props.config.forceDisableHls) {
return false;

@@ -446,3 +447,8 @@ }

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.player.currentTime = seconds;
if (!keepPlaying) {
this.pause();
}
}

@@ -449,0 +455,0 @@ }, {

@@ -150,3 +150,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('setCurrentTime', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -153,0 +158,0 @@ }, {

@@ -134,3 +134,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -137,0 +142,0 @@ }, {

@@ -167,3 +167,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seekTo', seconds * 1000);
if (!keepPlaying) {
this.pause();
}
}

@@ -170,0 +175,0 @@ }, {

@@ -149,3 +149,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('setCurrentTime', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -152,0 +157,0 @@ }, {

@@ -167,3 +167,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -170,0 +175,0 @@ }, {

@@ -154,3 +154,8 @@ "use strict";

value: function seekTo(amount) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('seek', amount);
if (!keepPlaying) {
this.pause();
}
}

@@ -157,0 +162,0 @@ }, {

@@ -49,2 +49,6 @@ "use strict";

var cleanUrl = function cleanUrl(url) {
return url.replace('/manage/videos', '');
};
var Vimeo = /*#__PURE__*/function (_Component) {

@@ -106,3 +110,3 @@ _inherits(Vimeo, _Component);

_this2.player = new Vimeo.Player(_this2.container, _objectSpread({
url: url,
url: cleanUrl(url),
autoplay: _this2.props.playing,

@@ -198,3 +202,8 @@ muted: _this2.props.muted,

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('setCurrentTime', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -201,0 +210,0 @@ }, {

@@ -201,3 +201,8 @@ "use strict";

value: function seekTo(seconds) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.callPlayer('time', seconds);
if (!keepPlaying) {
this.pause();
}
}

@@ -204,0 +209,0 @@ }, {

@@ -253,2 +253,5 @@ "use strict";

},
onPlaybackQualityChange: function onPlaybackQualityChange(event) {
return _this2.props.onPlaybackQualityChange(event);
},
onStateChange: _this2.onStateChange,

@@ -286,5 +289,6 @@ onError: function onError(event) {

value: function seekTo(amount) {
var keepPlaying = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
this.callPlayer('seekTo', amount);
if (!this.props.playing) {
if (!keepPlaying && !this.props.playing) {
this.pause();

@@ -291,0 +295,0 @@ }

@@ -73,2 +73,3 @@ "use strict";

forceSafariHLS: bool,
forceDisableHls: bool,
forceDASH: bool,

@@ -108,2 +109,3 @@ forceFLV: bool,

onPlaybackRateChange: func,
onPlaybackQualityChange: func,
onProgress: func,

@@ -193,3 +195,4 @@ onClickPreview: func,

dashVersion: '3.1.3',
flvVersion: '1.5.0'
flvVersion: '1.5.0',
forceDisableHls: false
},

@@ -225,2 +228,3 @@ wistia: {

onPlaybackRateChange: noop,
onPlaybackQualityChange: noop,
onProgress: noop,

@@ -227,0 +231,0 @@ onClickPreview: noop,

@@ -152,6 +152,6 @@ "use strict";

_defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type) {
_defineProperty(_assertThisInitialized(_this), "seekTo", function (fraction, type, keepPlaying) {
if (!_this.player) return null;
_this.player.seekTo(fraction, type);
_this.player.seekTo(fraction, type, keepPlaying);
});

@@ -158,0 +158,0 @@

{
"name": "react-player",
"version": "2.12.0",
"version": "2.13.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/index.js",

@@ -9,5 +9,2 @@ <h1 align='center'>

</a>
<a href='https://travis-ci.org/CookPete/react-player'>
<img src='https://img.shields.io/travis/CookPete/react-player/master.svg' alt='Build Status'>
</a>
<a href='https://codecov.io/gh/CookPete/react-player'>

@@ -25,6 +22,8 @@ <img src='https://img.shields.io/codecov/c/github/cookpete/react-player.svg' alt='Test Coverage'>

### Migrating to ReactPlayer `v2.0`
### ✨ The future of ReactPlayer
ReactPlayer `v2.0` changes single player imports and adds lazy loading players. Support for `preload` has also been removed, plus some other changes. See [`MIGRATING.md`](/MIGRATING.md) for information.
Maintenance of ReactPlayer is being taken over by [Mux](https://www.mux.com). The team at Mux have worked on many highly respected projects and are committed to improving video tooling for developers.
ReactPlayer will remain open source, but with a higher rate of fixes and releases over time. Thanks to everyone in the community for your ongoing support.
### Usage

@@ -41,3 +40,3 @@

// Render a YouTube video player
<ReactPlayer url='https://www.youtube.com/watch?v=ysz5S6PUM-U' />
<ReactPlayer url='https://www.youtube.com/watch?v=LXb3EKWsInQ' />
```

@@ -52,3 +51,3 @@

// Only loads the YouTube player
<ReactPlayer url='https://www.youtube.com/watch?v=ysz5S6PUM-U' />
<ReactPlayer url='https://www.youtube.com/watch?v=LXb3EKWsInQ' />
```

@@ -122,2 +121,3 @@

`onPlaybackRateChange` | Called when playback rate of the player changed<br />&nbsp; ◦ &nbsp;Only supported by YouTube, Vimeo ([if enabled](https://developer.vimeo.com/player/sdk/reference#playbackratechange)), Wistia, and file paths
`onPlaybackQualityChange` | Called when playback quality of the player changed<br />&nbsp; ◦ &nbsp;Only supported by YouTube ([if enabled](https://developers.google.com/youtube/iframe_api_reference#Events))
`onEnded` | Called when media finishes playing<br />&nbsp; ◦ &nbsp;Does not fire when `loop` is set to `true`

@@ -159,3 +159,3 @@ `onError` | Called when an error occurs whilst attempting to play media

`twitch` | `options`: Override the [default player options](https://dev.twitch.tv/docs/embed)<br />`playerId`: Override player ID for consistent server-side rendering (use with [`react-uid`](https://github.com/thearnica/react-uid))
`file` | `attributes`: Apply [element attributes](https://developer.mozilla.org/en/docs/Web/HTML/Element/video#Attributes)<br />`forceVideo`: Always render a `<video>` element<br />`forceAudio`: Always render an `<audio>` element<br />`forceHLS`: Use [hls.js](https://github.com/video-dev/hls.js) for HLS streams<br />`forceSafariHLS`: Use [hls.js](https://github.com/video-dev/hls.js) for HLS streams, [even on Safari](https://github.com/cookpete/react-player/pull/1560)<br />`forceDASH`: Always use [dash.js](https://github.com/Dash-Industry-Forum/dash.js) for DASH streams<br />`forceFLV`: Always use [flv.js](https://github.com/Bilibili/flv.js)<br />`hlsOptions`: Override the [default `hls.js` options](https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning)<br />`hlsVersion`: Override the [`hls.js`](https://github.com/video-dev/hls.js) version loaded from [`jsdelivr`](https://www.jsdelivr.com/package/npm/hls.js), default: `0.13.1`<br />`dashVersion`: Override the [`dash.js`](https://github.com/Dash-Industry-Forum/dash.js) version loaded from [`cdnjs`](https://cdnjs.com/libraries/dashjs), default: `2.9.2`<br />`flvVersion`: Override the [`flv.js`](https://github.com/Bilibili/flv.js) version loaded from [`jsdelivr`](https://www.jsdelivr.com/package/npm/flv.js), default: `1.5.0`
`file` | `attributes`: Apply [element attributes](https://developer.mozilla.org/en/docs/Web/HTML/Element/video#Attributes)<br />`forceVideo`: Always render a `<video>` element<br />`forceAudio`: Always render an `<audio>` element<br />`forceHLS`: Use [hls.js](https://github.com/video-dev/hls.js) for HLS streams<br />`forceSafariHLS`: Use [hls.js](https://github.com/video-dev/hls.js) for HLS streams, [even on Safari](https://github.com/cookpete/react-player/pull/1560)<br />`forceDisableHLS`: Disable usage [hls.js](https://github.com/video-dev/hls.js) for HLS streams<br />`forceDASH`: Always use [dash.js](https://github.com/Dash-Industry-Forum/dash.js) for DASH streams<br />`forceFLV`: Always use [flv.js](https://github.com/Bilibili/flv.js)<br />`hlsOptions`: Override the [default `hls.js` options](https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning)<br />`hlsVersion`: Override the [`hls.js`](https://github.com/video-dev/hls.js) version loaded from [`jsdelivr`](https://www.jsdelivr.com/package/npm/hls.js), default: `0.13.1`<br />`dashVersion`: Override the [`dash.js`](https://github.com/Dash-Industry-Forum/dash.js) version loaded from [`cdnjs`](https://cdnjs.com/libraries/dashjs), default: `2.9.2`<br />`flvVersion`: Override the [`flv.js`](https://github.com/Bilibili/flv.js) version loaded from [`jsdelivr`](https://www.jsdelivr.com/package/npm/flv.js), default: `1.5.0`

@@ -332,2 +332,6 @@ ### Methods

### Migrating to `v2.0`
ReactPlayer `v2.0` changes single player imports and adds lazy loading players. Support for `preload` has also been removed, plus some other changes. See [`MIGRATING.md`](/MIGRATING.md) for information.
### Supported media

@@ -334,0 +338,0 @@

@@ -18,2 +18,3 @@ import BaseReactPlayer, { BaseReactPlayerProps } from './base'

forceSafariHLS?: boolean
forceDisableHls?: boolean
forceDASH?: boolean

@@ -20,0 +21,0 @@ forceFLV?: boolean

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc