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 0.3.4 to 0.3.5

7

CHANGELOG.md

@@ -7,2 +7,9 @@ # Change Log

#### [v0.3.5](https://github.com/CookPete/react-player/compare/v0.3.4...v0.3.5)
> 4 January 2016
* Fix YouTube onReady bugs [`#21`](https://github.com/CookPete/react-player/pull/21)
* Set isReady before setVolume in onReady [`#23`](https://github.com/CookPete/react-player/issues/23)
#### [v0.3.4](https://github.com/CookPete/react-player/compare/v0.3.3...v0.3.4)

@@ -9,0 +16,0 @@ > 3 January 2016

8

lib/players/Base.js

@@ -32,7 +32,11 @@ 'use strict';

this.onReady = function () {
_this.isReady = true;
_this.setVolume(_this.props.volume);
if (_this.props.playing || _this.preloading) {
_this.preloading = false;
_this.isReady = true;
_this.play();
if (_this.loadOnReady) {
_this.load(_this.loadOnReady, _this.props.playing);
} else {
_this.play();
}
}

@@ -39,0 +43,0 @@ };

@@ -33,2 +33,3 @@ 'use strict';

var SDK_GLOBAL = 'YT';
var SDK_GLOBAL_READY = 'onYouTubeIframeAPIReady';
var MATCH_URL = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;

@@ -43,3 +44,3 @@ var PLAYER_ID = 'youtube-player';

var count = 0;
var playerIdCount = 0;

@@ -56,10 +57,16 @@ var YouTube = (function (_Base) {

this.playerId = PLAYER_ID + '-' + count++;
this.playerId = PLAYER_ID + '-' + playerIdCount++;
this.onStateChange = function (state) {
var YT = window[SDK_GLOBAL];
if (state.data === YT.PlayerState.PLAYING) _this.props.onPlay();
if (state.data === YT.PlayerState.PAUSED) _this.props.onPause();
if (state.data === YT.PlayerState.BUFFERING) _this.props.onBuffer();
if (state.data === YT.PlayerState.ENDED) _this.props.onEnded();
this.onStateChange = function (_ref) {
var data = _ref.data;
var _window$SDK_GLOBAL$PlayerState = window[SDK_GLOBAL].PlayerState;
var PLAYING = _window$SDK_GLOBAL$PlayerState.PLAYING;
var PAUSED = _window$SDK_GLOBAL$PlayerState.PAUSED;
var BUFFERING = _window$SDK_GLOBAL$PlayerState.BUFFERING;
var ENDED = _window$SDK_GLOBAL$PlayerState.ENDED;
if (data === PLAYING) _this.props.onPlay();
if (data === PAUSED) _this.props.onPause();
if (data === BUFFERING) _this.props.onBuffer();
if (data === ENDED) _this.props.onEnded();
};

@@ -84,4 +91,4 @@ }

return new Promise(function (resolve, reject) {
var previousOnReady = window.onYouTubeIframeAPIReady;
window.onYouTubeIframeAPIReady = function () {
var previousOnReady = window[SDK_GLOBAL_READY];
window[SDK_GLOBAL_READY] = function () {
if (previousOnReady) previousOnReady();

@@ -110,2 +117,7 @@ resolve(window[SDK_GLOBAL]);

}
if (this.loadingSDK) {
this.loadOnReady = url;
return;
}
this.loadingSDK = true;
this.getSDK().then(function (YT) {

@@ -118,3 +130,6 @@ _this2.player = new YT.Player(_this2.playerId, {

events: {
onReady: _this2.onReady,
onReady: function onReady() {
_this2.loadingSDK = false;
_this2.onReady();
},
onStateChange: _this2.onStateChange,

@@ -121,0 +136,0 @@ onError: _this2.props.onError

{
"name": "react-player",
"version": "0.3.4",
"version": "0.3.5",
"description": "A react component for playing a variety of URLs, including file paths, YouTube, SoundCloud and Vimeo",

@@ -14,2 +14,3 @@ "main": "lib/ReactPlayer.js",

"postpublish": "npm run clean",
"preversion": "npm run lint && npm run test",
"version": "auto-changelog --package --template compact; git add CHANGELOG.md"

@@ -16,0 +17,0 @@ },

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