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.6.0 to 0.7.0

8

CHANGELOG.md

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

#### [v0.7.0](https://github.com/CookPete/react-player/compare/v0.6.0...v0.7.0)
> 21 May 2016
* Use filePlayer for SoundCloud tracks [`#64`](https://github.com/CookPete/react-player/issues/64)
* Tidy up filePlayer [`79c2d5a`](https://github.com/CookPete/react-player/commit/79c2d5a16f999628493c3ac7ce052960ae5be67a)
* Add controls prop [`9a2ae22`](https://github.com/CookPete/react-player/commit/9a2ae229283e0c41ceea62ba01cdac243cf2bb82)
#### [v0.6.0](https://github.com/CookPete/react-player/compare/v0.5.8...v0.6.0)

@@ -9,0 +17,0 @@ > 19 May 2016

4

dist/ReactPlayer.js

@@ -1,3 +0,3 @@

var ReactPlayer=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(11);var c=n(1),p=r(c),f=n(3),y=n(9),d=r(y),h=function(e){function t(){var e,n,r,u;i(this,t);for(var l=arguments.length,c=Array(l),f=0;l>f;f++)c[f]=arguments[f];return n=r=a(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),r.seekTo=function(e){var t=r.refs.player;t&&t.seekTo(e)},r.progress=function(){if(r.props.url&&r.refs.player){var e={},t=r.refs.player.getFractionLoaded(),n=r.refs.player.getFractionPlayed();null!==t&&t!==r.prevLoaded&&(e.loaded=r.prevLoaded=t),null!==n&&n!==r.prevPlayed&&r.props.playing&&(e.played=r.prevPlayed=n),(e.loaded||e.played)&&r.props.onProgress(e)}r.progressTimeout=setTimeout(r.progress,r.props.progressFrequency)},r.renderPlayer=function(e){var t=e.canPlay(r.props.url),n=r.props,i=n.youtubeConfig,a=n.soundcloudConfig,u=n.vimeoConfig,l=o(n,["youtubeConfig","soundcloudConfig","vimeoConfig"]),c=t?s({},l,{ref:"player"}):{};return p["default"].createElement(e,s({key:e.displayName,youtubeConfig:i,soundcloudConfig:a,vimeoConfig:u},c))},u=n,a(r,u)}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.progress()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.progressTimeout)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url||this.props.playing!==e.playing||this.props.volume!==e.volume}},{key:"render",value:function(){var e={width:this.props.width,height:this.props.height};return p["default"].createElement("div",{style:e,className:this.props.className},d["default"].map(this.renderPlayer))}}],[{key:"canPlay",value:function(e){return d["default"].some(function(t){return t.canPlay(e)})}}]),t}(c.Component);h.displayName="ReactPlayer",h.propTypes=f.propTypes,h.defaultProps=f.defaultProps,t["default"]=h,e.exports=t["default"]},function(e,t){e.exports=React},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(1),s=n(3),l=5e3,c=function(e){function t(){var e,n,i,a;r(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=i=o(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),i.isReady=!1,i.startOnPlay=!0,i.onPlay=function(){i.startOnPlay&&(i.props.onStart(),i.startOnPlay=!1),i.props.onPlay(),i.setVolume(i.props.volume),i.seekOnReady&&(i.seekTo(i.seekOnReady),i.seekOnReady=null),i.props.onDuration(i.getDuration())},i.onReady=function(){i.isReady=!0,(i.props.playing||i.preloading)&&(i.preloading=!1,i.loadOnReady?(i.load(i.loadOnReady),i.loadOnReady=null):i.play())},i.onEnded=function(){i.props.loop&&i.seekTo(0),i.props.onEnded()},a=n,o(i,a)}return i(t,e),a(t,[{key:"componentDidMount",value:function(){this.props.url&&this.load(this.props.url)}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"componentWillReceiveProps",value:function(e){this.props.url!==e.url&&e.url?(this.seekOnReady=null,this.startOnPlay=!0,this.load(e.url)):this.props.url&&!e.url?(this.stop(),clearTimeout(this.updateTimeout)):!this.props.playing&&e.playing?this.play():this.props.playing&&!e.playing?this.pause():this.props.volume!==e.volume&&this.setVolume(e.volume)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url}},{key:"seekTo",value:function(e){var t=this;this.isReady||0===e||(this.seekOnReady=e,setTimeout(function(){t.seekOnReady=null},l))}}]),t}(u.Component);c.propTypes=s.propTypes,c.defaultProps=s.defaultProps,t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultProps=t.propTypes=void 0;var r=n(1);t.propTypes={url:r.PropTypes.string,playing:r.PropTypes.bool,loop:r.PropTypes.bool,volume:r.PropTypes.number,width:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.number]),height:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.number]),className:r.PropTypes.string,progressFrequency:r.PropTypes.number,soundcloudConfig:r.PropTypes.shape({clientId:r.PropTypes.string}),youtubeConfig:r.PropTypes.shape({playerVars:r.PropTypes.object,preload:r.PropTypes.bool}),vimeoConfig:r.PropTypes.shape({iframeParams:r.PropTypes.object,preload:r.PropTypes.bool}),fileConfig:r.PropTypes.shape({attributes:r.PropTypes.object}),onStart:r.PropTypes.func,onPlay:r.PropTypes.func,onPause:r.PropTypes.func,onBuffer:r.PropTypes.func,onEnded:r.PropTypes.func,onError:r.PropTypes.func,onDuration:r.PropTypes.func,onProgress:r.PropTypes.func},t.defaultProps={playing:!1,loop:!1,volume:.8,width:640,height:360,progressFrequency:1e3,soundcloudConfig:{clientId:"e8b6f84fbcad14c301ca1355cae1dea2"},youtubeConfig:{playerVars:{},preload:!1},vimeoConfig:{iframeParams:{},preload:!1},fileConfig:{attributes:{}},onStart:function(){},onPlay:function(){},onPause:function(){},onBuffer:function(){},onEnded:function(){},onError:function(){},onDuration:function(){},onProgress:function(){}}},function(e,t){function n(e,t){for(var n in t)e.setAttribute(n,t[n])}function r(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function o(e,t){e.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||(this.onreadystatechange=null,t(null,e))}}e.exports=function(e,t,i){var a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("script");"function"==typeof t&&(i=t,t={}),t=t||{},i=i||function(){},u.type=t.type||"text/javascript",u.charset=t.charset||"utf8",u.async="async"in t?!!t.async:!0,u.src=e,t.attrs&&n(u,t.attrs),t.text&&(u.text=""+t.text);var s="onload"in u?r:o;s(u,i),u.onload||r(u,i),a.appendChild(u)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function g(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:g(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},c=n(1),p=r(c),f=n(2),y=r(f),d=/\.(mp4|og[gv]|webm)($|\?)/,h=/\.(mp3|wav)($|\?)/,v=function(e){function t(){return o(this,t),i(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this;this.player=this.refs.player,this.player.oncanplay=this.onReady,this.player.onplay=this.onPlay,this.player.onpause=function(){return e.props.onPause()},this.player.onended=function(){return e.onEnded()},this.player.onerror=function(t){return e.props.onError(t)},this.player.setAttribute("webkit-playsinline",""),l(Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this)}},{key:"load",value:function(e){this.player.src=e}},{key:"play",value:function(){this.player.play()}},{key:"pause",value:function(){this.player.pause()}},{key:"stop",value:function(){this.player.src=""}},{key:"seekTo",value:function(e){l(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.player.currentTime=this.getDuration()*e}},{key:"setVolume",value:function(e){this.player.volume=e}},{key:"getDuration",value:function(){return this.isReady?this.player.duration:null}},{key:"getFractionPlayed",value:function(){return this.isReady?this.player.currentTime/this.getDuration():null}},{key:"getFractionLoaded",value:function(){return this.isReady&&0!==this.player.buffered.length?this.player.buffered.end(0)/this.getDuration():null}},{key:"render",value:function(){var e=h.test(this.props.url)?"audio":"video",t={display:this.props.url?"block":"none"},n=this.props.fileConfig.attributes;return p["default"].createElement(e,u({ref:"player",style:t,width:"100%",height:"100%",preload:"auto"},n))}}],[{key:"canPlay",value:function(e){return d.test(e)||h.test(e)}}]),t}(y["default"]);v.displayName="FilePlayer",t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function O(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:O(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},l=n(1),c=r(l),p=n(4),f=r(p),y=n(12),d=r(y),h=n(2),v=r(h),g="//connect.soundcloud.com/sdk-2.0.0.js",m="SC",b="//api.soundcloud.com/resolve.json",w=/^https?:\/\/(soundcloud.com|snd.sc)\/([a-z0-9-_]+\/[a-z0-9-_]+)$/,P={},_=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.state={image:null},r.onStateChange=function(e){"playing"===e&&r.onPlay(),"paused"===e&&r.props.onPause(),"loading"===e&&r.props.onBuffer(),"ended"===e&&r.onEnded()},a=n,i(r,a)}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e,n){return s(Object.getPrototypeOf(t.prototype),"shouldComponentUpdate",this).call(this,e,n)||this.state.image!==n.image}},{key:"getSDK",value:function(){var e=this;return window[m]?Promise.resolve(window[m]):new Promise(function(t,n){(0,f["default"])(g,function(r){r?n(r):(window[m].initialize({client_id:e.props.soundcloudConfig.clientId}),t(window[m]))})})}},{key:"getSongData",value:function(e){var t=this;return P[e]?Promise.resolve(P[e]):(0,d["default"])(b+"?url="+e+"&client_id="+this.props.soundcloudConfig.clientId).then(function(n){return n.ok?(P[e]=n.json(),P[e]):void t.props.onError(new Error("SoundCloud track could not be resolved"))})}},{key:"load",value:function(e){var t=this;this.stop(),this.getSDK().then(function(n){t.getSongData(e).then(function(r){if(e===t.props.url){if(!r.streamable)return void t.props.onError(new Error("SoundCloud track is not streamable"));var o=r.artwork_url||r.user.avatar_url;o&&t.setState({image:o.replace("-large","-t500x500")}),n.stream(r.uri,function(e){t.player=e,e._player.on("stateChange",t.onStateChange),t.onReady()})}},t.props.onError)},this.props.onError)}},{key:"play",value:function(){this.isReady&&this.player.play()}},{key:"pause",value:function(){this.isReady&&this.player.pause()}},{key:"stop",value:function(){this.isReady&&(this.player._player.off("stateChange",this.onStateChange),this.player.stop())}},{key:"seekTo",value:function(e){s(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.isReady&&this.player.seek(this.getDuration(!0)*e)}},{key:"setVolume",value:function(e){this.isReady&&this.player.setVolume(e)}},{key:"getDuration",value:function(e){return this.isReady?e?this.player.getDuration():this.player.getDuration()/1e3:null}},{key:"getFractionPlayed",value:function(){return this.isReady?this.player.getCurrentPosition()/this.getDuration(!0):null}},{key:"getFractionLoaded",value:function(){return this.isReady?this.player.getLoadedPosition()/this.getDuration(!0):null}},{key:"render",value:function(){var e={display:this.props.url?"block":"none",height:"100%",backgroundImage:this.state.image?"url("+this.state.image+")":null,backgroundSize:"cover",backgroundPosition:"center"};return c["default"].createElement("div",{style:e})}}],[{key:"canPlay",value:function(e){return w.test(e)}}]),t}(v["default"]);_.displayName="SoundCloud",t["default"]=_,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function P(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:P(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},c=n(1),p=r(c),f=n(14),y=n(2),d=r(y),h="https://player.vimeo.com/video/",v=/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/,g=/^https?:\/\/player.vimeo.com/,m="https://vimeo.com/127250231",b={api:1,autoplay:0,badge:0,byline:0,fullscreen:1,portrait:0,title:0},w=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.onMessage=function(e){if(g.test(e.origin)){r.origin=r.origin||e.origin;var t=JSON.parse(e.data);"ready"===t.event&&(r.postMessage("getDuration"),r.postMessage("addEventListener","playProgress"),r.postMessage("addEventListener","loadProgress"),r.postMessage("addEventListener","play"),r.postMessage("addEventListener","pause"),r.postMessage("addEventListener","finish")),"playProgress"===t.event&&(r.fractionPlayed=t.data.percent),"loadProgress"===t.event&&(r.fractionLoaded=t.data.percent),"play"===t.event&&r.onPlay(),"pause"===t.event&&r.props.onPause(),"finish"===t.event&&r.onEnded(),"getDuration"===t.method&&(r.duration=t.value,r.onReady())}},r.postMessage=function(e,t){if(r.origin){var n=JSON.stringify({method:e,value:t});return r.iframe.contentWindow&&r.iframe.contentWindow.postMessage(n,r.origin)}},a=n,i(r,a)}return a(t,e),s(t,[{key:"componentDidMount",value:function(){window.addEventListener("message",this.onMessage,!1),this.iframe=this.refs.iframe,!this.props.url&&this.props.vimeoConfig.preload&&(this.preloading=!0,this.load(m)),l(Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this)}},{key:"getIframeParams",value:function(){return u({},b,this.props.vimeoConfig.iframeParams)}},{key:"load",value:function(e){var t=e.match(v)[3];this.iframe.src=h+t+"?"+(0,f.stringify)(this.getIframeParams())}},{key:"play",value:function(){this.postMessage("play")}},{key:"pause",value:function(){this.postMessage("pause")}},{key:"stop",value:function(){this.iframe.src=""}},{key:"seekTo",value:function(e){l(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.postMessage("seekTo",this.duration*e)}},{key:"setVolume",value:function(e){this.postMessage("setVolume",e)}},{key:"getDuration",value:function(){return this.duration}},{key:"getFractionPlayed",value:function(){return this.fractionPlayed||null}},{key:"getFractionLoaded",value:function(){return this.fractionLoaded||null}},{key:"render",value:function(){var e=this.getIframeParams(),t=e.fullscreen,n={display:this.props.url?"block":"none",width:"100%",height:"100%"};return p["default"].createElement("iframe",{ref:"iframe",frameBorder:"0",style:n,allowFullScreen:t})}}],[{key:"canPlay",value:function(e){return v.test(e)}}]),t}(d["default"]);w.displayName="Vimeo",t["default"]=w,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function T(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:T(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},c=n(1),p=r(c),f=n(4),y=r(f),d=n(2),h=r(d),v=n(10),g="https://www.youtube.com/iframe_api",m="YT",b="onYouTubeIframeAPIReady",w=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,P="youtube-player",_="https://www.youtube.com/watch?v=GlCmAC4MHek",O={autoplay:0,controls:0,playsinline:1,showinfo:0,rel:0,iv_load_policy:3},k=0,j=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.playerId=P+"-"+k++,r.onStateChange=function(e){var t=e.data,n=window[m].PlayerState,o=n.PLAYING,i=n.PAUSED,a=n.BUFFERING,u=n.ENDED,s=n.CUED;t===o&&r.onPlay(),t===i&&r.props.onPause(),t===a&&r.props.onBuffer(),t===u&&r.onEnded(),t===s&&r.onReady()},a=n,i(r,a)}return a(t,e),s(t,[{key:"componentDidMount",value:function(){!this.props.url&&this.props.youtubeConfig.preload&&(this.preloading=!0,this.load(_)),l(Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this)}},{key:"getSDK",value:function(){return window[m]?Promise.resolve(window[m]):new Promise(function(e,t){var n=window[b];window[b]=function(){n&&n(),e(window[m])},(0,y["default"])(g,function(e){e&&t(e)})})}},{key:"load",value:function(e){var t=this,n=e&&e.match(w)[1];return this.isReady?void this.player.cueVideoById({videoId:n,startSeconds:(0,v.parseStartTime)(e)}):this.loadingSDK?void(this.loadOnReady=e):(this.loadingSDK=!0,void this.getSDK().then(function(r){t.player=new r.Player(t.playerId,{width:"100%",height:"100%",videoId:n,playerVars:u({},O,t.props.youtubeConfig.playerVars,{start:(0,v.parseStartTime)(e),origin:window.location.origin}),events:{onReady:function(){t.loadingSDK=!1,t.onReady()},onStateChange:t.onStateChange,onError:function(e){return t.props.onError(e.data)}}})},this.props.onError))}},{key:"play",value:function(){this.isReady&&this.player.playVideo&&this.player.playVideo()}},{key:"pause",value:function(){this.isReady&&this.player.pauseVideo&&this.player.pauseVideo()}},{key:"stop",value:function(){this.isReady&&this.player.stopVideo&&this.player.stopVideo()}},{key:"seekTo",value:function(e){l(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.isReady&&this.player.seekTo&&this.player.seekTo(this.getDuration()*e)}},{key:"setVolume",value:function(e){this.isReady&&this.player.setVolume&&this.player.setVolume(100*e)}},{key:"getDuration",value:function(){return this.isReady&&this.player.getDuration?this.player.getDuration():null}},{key:"getFractionPlayed",value:function(){return this.isReady&&this.getDuration()?this.player.getCurrentTime()/this.getDuration():null}},{key:"getFractionLoaded",value:function(){return this.isReady&&this.player.getVideoLoadedFraction?this.player.getVideoLoadedFraction():null}},{key:"render",value:function(){var e={height:"100%",display:this.props.url?"block":"none"};return p["default"].createElement("div",{style:e},p["default"].createElement("div",{id:this.playerId}))}}],[{key:"canPlay",value:function(e){return w.test(e)}}]),t}(h["default"]);j.displayName="YouTube",t["default"]=j,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(8),i=r(o),a=n(6),u=r(a),s=n(7),l=r(s),c=n(5),p=r(c);t["default"]=[i["default"],u["default"],l["default"],p["default"]],e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=e.match(i);if(t){var n=t[1];if(n.match(a))return r(n);if(u.test(n))return parseInt(n,10)}return 0}function r(e){for(var t=0,n=a.exec(e);null!==n;){var r=n,i=o(r,3),u=i[1],s=i[2];"h"===s&&(t+=60*parseInt(u,10)*60),"m"===s&&(t+=60*parseInt(u,10)),"s"===s&&(t+=parseInt(u,10)),n=a.exec(e)}return t}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(s){o=!0,i=s}finally{try{!r&&u["return"]&&u["return"]()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.parseStartTime=n;var i=/[\?&#](?:start|t)=([0-9hms]+)/,a=/(\d+)(h|m|s)/g,u=/^\d+$/},function(e,t,n){var r;(function(e,o,i){(function(){"use strict";function a(e){return"function"==typeof e||"object"==typeof e&&null!==e}function u(e){return"function"==typeof e}function s(e){H=e}function l(e){ee=e}function c(){return function(){e.nextTick(h)}}function p(){return function(){J(h)}}function f(){var e=0,t=new re(h),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function y(){var e=new MessageChannel;return e.port1.onmessage=h,function(){e.port2.postMessage(0)}}function d(){return function(){setTimeout(h,1)}}function h(){for(var e=0;Z>e;e+=2){var t=ae[e],n=ae[e+1];t(n),ae[e]=void 0,ae[e+1]=void 0}Z=0}function v(){try{var e=n(18);return J=e.runOnLoop||e.runOnContext,p()}catch(t){return d()}}function g(e,t){var n=this,r=new this.constructor(b);void 0===r[le]&&L(r);var o=n._state;if(o){var i=arguments[o-1];ee(function(){F(o,r,i,n._result)})}else D(n,r,e,t);return r}function m(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return E(n,e),n}function b(){}function w(){return new TypeError("You cannot resolve a promise with itself")}function P(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return ye.error=t,ye}}function O(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function k(e,t,n){ee(function(e){var r=!1,o=O(n,t,function(n){r||(r=!0,t!==n?E(e,n):S(e,n))},function(t){r||(r=!0,R(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,R(e,o))},e)}function j(e,t){t._state===pe?S(e,t._result):t._state===fe?R(e,t._result):D(t,void 0,function(t){E(e,t)},function(t){R(e,t)})}function T(e,t,n){t.constructor===e.constructor&&n===ue&&constructor.resolve===se?j(e,t):n===ye?R(e,ye.error):void 0===n?S(e,t):u(n)?k(e,t,n):S(e,t)}function E(e,t){e===t?R(e,w()):a(t)?T(e,t,_(t)):S(e,t)}function C(e){e._onerror&&e._onerror(e._result),M(e)}function S(e,t){e._state===ce&&(e._result=t,e._state=pe,0!==e._subscribers.length&&ee(M,e))}function R(e,t){e._state===ce&&(e._state=fe,e._result=t,ee(C,e))}function D(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+pe]=n,o[i+fe]=r,0===i&&e._state&&ee(M,e)}function M(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,o,i=e._result,a=0;a<t.length;a+=3)r=t[a],o=t[a+n],r?F(n,r,o,i):o(i);e._subscribers.length=0}}function x(){this.error=null}function A(e,t){try{return e(t)}catch(n){return de.error=n,de}}function F(e,t,n,r){var o,i,a,s,l=u(n);if(l){if(o=A(n,r),o===de?(s=!0,i=o.error,o=null):a=!0,t===o)return void R(t,P())}else o=r,a=!0;t._state!==ce||(l&&a?E(t,o):s?R(t,i):e===pe?S(t,o):e===fe&&R(t,o))}function I(e,t){try{t(function(t){E(e,t)},function(t){R(e,t)})}catch(n){R(e,n)}}function V(){return he++}function L(e){e[le]=he++,e._state=void 0,e._result=void 0,e._subscribers=[]}function N(e){return new we(this,e).promise}function U(e){var t=this;return new t(X(e)?function(n,r){for(var o=e.length,i=0;o>i;i++)t.resolve(e[i]).then(n,r)}:function(e,t){t(new TypeError("You must pass an array to race."))})}function B(e){var t=this,n=new t(b);return R(n,e),n}function K(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Y(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function W(e){this[le]=V(),this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&K(),this instanceof W?I(this,e):Y())}function $(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[le]||L(this.promise),X(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):R(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function z(){var e;if("undefined"!=typeof o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(e.Promise=be)}var G;G=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var J,H,Q,X=G,Z=0,ee=function(e,t){ae[Z]=e,ae[Z+1]=t,Z+=2,2===Z&&(H?H(h):Q())},te="undefined"!=typeof window?window:void 0,ne=te||{},re=ne.MutationObserver||ne.WebKitMutationObserver,oe="undefined"==typeof self&&"undefined"!=typeof e&&"[object process]"==={}.toString.call(e),ie="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ae=new Array(1e3);Q=oe?c():re?f():ie?y():void 0===te?v():d();var ue=g,se=m,le=Math.random().toString(36).substring(16),ce=void 0,pe=1,fe=2,ye=new x,de=new x,he=0,ve=N,ge=U,me=B,be=W;W.all=ve,W.race=ge,W.resolve=se,W.reject=me,W._setScheduler=s,W._setAsap=l,W._asap=ee,W.prototype={constructor:W,then:ue,"catch":function(e){return this.then(null,e)}};var we=$;$.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ce&&e>n;n++)this._eachEntry(t[n],n)},$.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===se){var o=_(e);if(o===ue&&e._state!==ce)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===be){var i=new n(b);T(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},$.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ce&&(this._remaining--,e===fe?R(r,n):this._result[t]=n),0===this._remaining&&S(r,this._result)},$.prototype._willSettleAt=function(e,t){var n=this;D(e,void 0,function(e){n._settledAt(pe,t,e)},function(e){n._settledAt(fe,t,e)})};var Pe=z,_e={Promise:be,polyfill:Pe};n(16).amd?(r=function(){return _e}.call(t,n,t,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=_e:"undefined"!=typeof this&&(this.ES6Promise=_e),Pe()}).call(this)}).call(t,n(13),function(){return this}(),n(17)(e))},function(e,t,n){var r,o,i;!function(n,a){o=[t,e],r=a,i="function"==typeof r?r.apply(t,o):r,!(void 0!==i&&(e.exports=i))}(this,function(e,t){"use strict";function n(){return"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random())}function r(e){try{delete window[e]}catch(t){window[e]=void 0}}function o(e){var t=document.getElementById(e);document.getElementsByTagName("head")[0].removeChild(t)}var i={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null},a=function(e){var t=void 0===arguments[1]?{}:arguments[1],a=null!=t.timeout?t.timeout:i.timeout,u=null!=t.jsonpCallback?t.jsonpCallback:i.jsonpCallback,s=void 0;
return new Promise(function(i,l){var c=t.jsonpCallbackFunction||n();window[c]=function(e){i({ok:!0,json:function(){return Promise.resolve(e)}}),s&&clearTimeout(s),o(u+"_"+c),r(c)},e+=-1===e.indexOf("?")?"?":"&";var p=document.createElement("script");p.setAttribute("src",e+u+"="+c),p.id=u+"_"+c,document.getElementsByTagName("head")[0].appendChild(p),s=setTimeout(function(){l(new Error("JSONP request to "+e+" timed out")),r(c),o(u+"_"+c)},a)})};t.exports=a})},function(e,t){function n(){l&&a&&(l=!1,a.length?s=a.concat(s):c=-1,s.length&&r())}function r(){if(!l){var e=setTimeout(n);l=!0;for(var t=s.length;t;){for(a=s,s=[];++c<t;)a&&a[c].run();c=-1,t=s.length}a=null,l=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var a,u=e.exports={},s=[],l=!1,c=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new o(e,t)),1!==s.length||l||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=i,u.addListener=i,u.once=i,u.off=i,u.removeListener=i,u.removeAllListeners=i,u.emit=i,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(e,t,n){"use strict";function r(e,t){return t?o(e):encodeURIComponent(e)}var o=n(15);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){var t=Object.create(null);return"string"!=typeof e?t:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),void 0===t[r]?t[r]=o:Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]}),t):t},t.stringify=function(e,t){t=t||{};var n=t.strict!==!1;return e?Object.keys(e).sort().map(function(t){var o=e[t];if(void 0===o)return"";if(null===o)return t;if(Array.isArray(o)){var i=[];return o.slice().sort().forEach(function(e){void 0!==e&&(null===e?i.push(r(t,n)):i.push(r(t,n)+"="+r(e,n)))}),i.join("&")}return r(t,n)+"="+r(o,n)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){}]);
var ReactPlayer=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(10);var c=n(1),p=r(c),f=n(4),y=n(8),d=r(y),h=function(e){function t(){var e,n,r,u;i(this,t);for(var l=arguments.length,c=Array(l),f=0;l>f;f++)c[f]=arguments[f];return n=r=a(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),r.seekTo=function(e){var t=r.refs.player;t&&t.seekTo(e)},r.progress=function(){if(r.props.url&&r.refs.player){var e={},t=r.refs.player.getFractionLoaded(),n=r.refs.player.getFractionPlayed();null!==t&&t!==r.prevLoaded&&(e.loaded=r.prevLoaded=t),null!==n&&n!==r.prevPlayed&&r.props.playing&&(e.played=r.prevPlayed=n),(e.loaded||e.played)&&r.props.onProgress(e)}r.progressTimeout=setTimeout(r.progress,r.props.progressFrequency)},r.renderPlayer=function(e){var t=e.canPlay(r.props.url),n=r.props,i=n.youtubeConfig,a=n.soundcloudConfig,u=n.vimeoConfig,l=o(n,["youtubeConfig","soundcloudConfig","vimeoConfig"]),c=t?s({},l,{ref:"player"}):{};return p["default"].createElement(e,s({key:e.displayName,youtubeConfig:i,soundcloudConfig:a,vimeoConfig:u},c))},u=n,a(r,u)}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.progress()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.progressTimeout)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url||this.props.playing!==e.playing||this.props.volume!==e.volume}},{key:"render",value:function(){var e={width:this.props.width,height:this.props.height};return p["default"].createElement("div",{style:e,className:this.props.className},d["default"].map(this.renderPlayer))}}],[{key:"canPlay",value:function(e){return d["default"].some(function(t){return t.canPlay(e)})}}]),t}(c.Component);h.displayName="ReactPlayer",h.propTypes=f.propTypes,h.defaultProps=f.defaultProps,t["default"]=h,e.exports=t["default"]},function(e,t){e.exports=React},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(1),s=n(4),l=5e3,c=function(e){function t(){var e,n,i,a;r(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=i=o(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),i.isReady=!1,i.startOnPlay=!0,i.onPlay=function(){i.startOnPlay&&(i.props.onStart(),i.startOnPlay=!1),i.props.onPlay(),i.setVolume(i.props.volume),i.seekOnReady&&(i.seekTo(i.seekOnReady),i.seekOnReady=null),i.props.onDuration(i.getDuration())},i.onReady=function(){i.isReady=!0,(i.props.playing||i.preloading)&&(i.preloading=!1,i.loadOnReady?(i.load(i.loadOnReady),i.loadOnReady=null):i.play())},i.onEnded=function(){i.props.loop&&i.seekTo(0),i.props.onEnded()},a=n,o(i,a)}return i(t,e),a(t,[{key:"componentDidMount",value:function(){this.props.url&&this.load(this.props.url)}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"componentWillReceiveProps",value:function(e){this.props.url!==e.url&&e.url?(this.seekOnReady=null,this.startOnPlay=!0,this.load(e.url)):this.props.url&&!e.url?(this.stop(),clearTimeout(this.updateTimeout)):!this.props.playing&&e.playing?this.play():this.props.playing&&!e.playing?this.pause():this.props.volume!==e.volume&&this.setVolume(e.volume)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url}},{key:"seekTo",value:function(e){var t=this;this.isReady||0===e||(this.seekOnReady=e,setTimeout(function(){t.seekOnReady=null},l))}}]),t}(u.Component);c.propTypes=s.propTypes,c.defaultProps=s.defaultProps,t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function g(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:g(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},c=n(1),p=r(c),f=n(2),y=r(f),d=/\.(mp4|og[gv]|webm)($|\?)/,h=/\.(mp3|wav)($|\?)/,v=function(e){function t(){return o(this,t),i(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this;this.player=this.refs.player,this.player.oncanplay=this.onReady,this.player.onplay=this.onPlay,this.player.onpause=function(){return e.props.onPause()},this.player.onended=function(){return e.onEnded()},this.player.onerror=function(t){return e.props.onError(t)},this.player.setAttribute("webkit-playsinline",""),l(Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this)}},{key:"load",value:function(e){this.player.src=e}},{key:"play",value:function(){this.player.play()}},{key:"pause",value:function(){this.player.pause()}},{key:"stop",value:function(){this.player.removeAttribute("src")}},{key:"seekTo",value:function(e){l(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.player.currentTime=this.getDuration()*e}},{key:"setVolume",value:function(e){this.player.volume=e}},{key:"getDuration",value:function(){return this.isReady?this.player.duration:null}},{key:"getFractionPlayed",value:function(){return this.isReady?this.player.currentTime/this.getDuration():null}},{key:"getFractionLoaded",value:function(){return this.isReady&&0!==this.player.buffered.length?this.player.buffered.end(0)/this.getDuration():null}},{key:"render",value:function(){var e=this.props,t=e.controls,n=e.fileConfig,r=h.test(this.props.url)?"audio":"video",o={width:"100%",height:"100%",display:this.props.url?"block":"none"};return p["default"].createElement(r,u({ref:"player",style:o,preload:"auto",controls:t},n.attributes))}}],[{key:"canPlay",value:function(e){return d.test(e)||h.test(e)}}]),t}(y["default"]);v.displayName="FilePlayer",t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultProps=t.propTypes=void 0;var r=n(1);t.propTypes={url:r.PropTypes.string,playing:r.PropTypes.bool,loop:r.PropTypes.bool,controls:r.PropTypes.bool,volume:r.PropTypes.number,width:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.number]),height:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.number]),className:r.PropTypes.string,progressFrequency:r.PropTypes.number,soundcloudConfig:r.PropTypes.shape({clientId:r.PropTypes.string}),youtubeConfig:r.PropTypes.shape({playerVars:r.PropTypes.object,preload:r.PropTypes.bool}),vimeoConfig:r.PropTypes.shape({iframeParams:r.PropTypes.object,preload:r.PropTypes.bool}),fileConfig:r.PropTypes.shape({attributes:r.PropTypes.object}),onStart:r.PropTypes.func,onPlay:r.PropTypes.func,onPause:r.PropTypes.func,onBuffer:r.PropTypes.func,onEnded:r.PropTypes.func,onError:r.PropTypes.func,onDuration:r.PropTypes.func,onProgress:r.PropTypes.func},t.defaultProps={playing:!1,loop:!1,controls:!1,volume:.8,width:640,height:360,progressFrequency:1e3,soundcloudConfig:{clientId:"e8b6f84fbcad14c301ca1355cae1dea2"},youtubeConfig:{playerVars:{},preload:!1},vimeoConfig:{iframeParams:{},preload:!1},fileConfig:{attributes:{}},onStart:function(){},onPlay:function(){},onPause:function(){},onBuffer:function(){},onEnded:function(){},onError:function(){},onDuration:function(){},onProgress:function(){}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function b(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:b(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},l=n(1),c=r(l),p=n(11),f=r(p),y=n(3),d=r(y),h="//api.soundcloud.com/resolve.json",v=/^https?:\/\/(soundcloud.com|snd.sc)\/([a-z0-9-_]+\/[a-z0-9-_]+)$/,g={},m=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.state={image:null},a=n,i(r,a)}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e,n){return s(Object.getPrototypeOf(t.prototype),"shouldComponentUpdate",this).call(this,e,n)||this.state.image!==n.image}},{key:"getSongData",value:function(e){var t=this;return g[e]?Promise.resolve(g[e]):(0,f["default"])(h+"?url="+e+"&client_id="+this.props.soundcloudConfig.clientId).then(function(n){return n.ok?(g[e]=n.json(),g[e]):void t.props.onError(new Error("SoundCloud track could not be resolved"))})}},{key:"load",value:function(e){var t=this;this.stop(),this.getSongData(e).then(function(n){if(e===t.props.url){if(!n.streamable)return void t.props.onError(new Error("SoundCloud track is not streamable"));var r=n.artwork_url||n.user.avatar_url;r&&t.setState({image:r.replace("-large","-t500x500")}),t.player.src=n.stream_url+"?client_id="+t.props.soundcloudConfig.clientId}},this.props.onError)}},{key:"render",value:function(){var e=this.props,t=e.url,n=e.controls,r={display:t?"block":"none",height:"100%",backgroundImage:this.state.image?"url("+this.state.image+")":null,backgroundSize:"cover",backgroundPosition:"center"};return c["default"].createElement("div",{style:r},c["default"].createElement("audio",{ref:"player",type:"audio/mpeg",preload:"auto",style:{width:"100%",height:"100%"},controls:n}))}}],[{key:"canPlay",value:function(e){return v.test(e)}}]),t}(d["default"]);m.displayName="SoundCloud",t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function P(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:P(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},c=n(1),p=r(c),f=n(14),y=n(2),d=r(y),h="https://player.vimeo.com/video/",v=/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/,g=/^https?:\/\/player.vimeo.com/,m="https://vimeo.com/127250231",b={api:1,autoplay:0,badge:0,byline:0,fullscreen:1,portrait:0,title:0},w=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.onMessage=function(e){if(g.test(e.origin)){r.origin=r.origin||e.origin;var t=JSON.parse(e.data);"ready"===t.event&&(r.postMessage("getDuration"),r.postMessage("addEventListener","playProgress"),r.postMessage("addEventListener","loadProgress"),r.postMessage("addEventListener","play"),r.postMessage("addEventListener","pause"),r.postMessage("addEventListener","finish")),"playProgress"===t.event&&(r.fractionPlayed=t.data.percent),"loadProgress"===t.event&&(r.fractionLoaded=t.data.percent),"play"===t.event&&r.onPlay(),"pause"===t.event&&r.props.onPause(),"finish"===t.event&&r.onEnded(),"getDuration"===t.method&&(r.duration=t.value,r.onReady())}},r.postMessage=function(e,t){if(r.origin){var n=JSON.stringify({method:e,value:t});return r.iframe.contentWindow&&r.iframe.contentWindow.postMessage(n,r.origin)}},a=n,i(r,a)}return a(t,e),s(t,[{key:"componentDidMount",value:function(){window.addEventListener("message",this.onMessage,!1),this.iframe=this.refs.iframe,!this.props.url&&this.props.vimeoConfig.preload&&(this.preloading=!0,this.load(m)),l(Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this)}},{key:"getIframeParams",value:function(){return u({},b,this.props.vimeoConfig.iframeParams)}},{key:"load",value:function(e){var t=e.match(v)[3];this.iframe.src=h+t+"?"+(0,f.stringify)(this.getIframeParams())}},{key:"play",value:function(){this.postMessage("play")}},{key:"pause",value:function(){this.postMessage("pause")}},{key:"stop",value:function(){this.iframe.src=""}},{key:"seekTo",value:function(e){l(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.postMessage("seekTo",this.duration*e)}},{key:"setVolume",value:function(e){this.postMessage("setVolume",e)}},{key:"getDuration",value:function(){return this.duration}},{key:"getFractionPlayed",value:function(){return this.fractionPlayed||null}},{key:"getFractionLoaded",value:function(){return this.fractionLoaded||null}},{key:"render",value:function(){var e=this.getIframeParams(),t=e.fullscreen,n={display:this.props.url?"block":"none",width:"100%",height:"100%"};return p["default"].createElement("iframe",{ref:"iframe",frameBorder:"0",style:n,allowFullScreen:t})}}],[{key:"canPlay",value:function(e){return v.test(e)}}]),t}(d["default"]);w.displayName="Vimeo",t["default"]=w,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function T(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:T(o,t,n)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(n)},c=n(1),p=r(c),f=n(12),y=r(f),d=n(2),h=r(d),v=n(9),g="https://www.youtube.com/iframe_api",m="YT",b="onYouTubeIframeAPIReady",w=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,P="youtube-player",_="https://www.youtube.com/watch?v=GlCmAC4MHek",O={autoplay:0,playsinline:1,showinfo:0,rel:0,iv_load_policy:3},k=0,j=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;u>l;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.playerId=P+"-"+k++,r.onStateChange=function(e){var t=e.data,n=window[m].PlayerState,o=n.PLAYING,i=n.PAUSED,a=n.BUFFERING,u=n.ENDED,s=n.CUED;t===o&&r.onPlay(),t===i&&r.props.onPause(),t===a&&r.props.onBuffer(),t===u&&r.onEnded(),t===s&&r.onReady()},a=n,i(r,a)}return a(t,e),s(t,[{key:"componentDidMount",value:function(){!this.props.url&&this.props.youtubeConfig.preload&&(this.preloading=!0,this.load(_)),l(Object.getPrototypeOf(t.prototype),"componentDidMount",this).call(this)}},{key:"getSDK",value:function(){return window[m]?Promise.resolve(window[m]):new Promise(function(e,t){var n=window[b];window[b]=function(){n&&n(),e(window[m])},(0,y["default"])(g,function(e){e&&t(e)})})}},{key:"load",value:function(e){var t=this,n=e&&e.match(w)[1];return this.isReady?void this.player.cueVideoById({videoId:n,startSeconds:(0,v.parseStartTime)(e)}):this.loadingSDK?void(this.loadOnReady=e):(this.loadingSDK=!0,void this.getSDK().then(function(r){t.player=new r.Player(t.playerId,{width:"100%",height:"100%",videoId:n,playerVars:u({},O,{controls:t.props.controls?1:0},t.props.youtubeConfig.playerVars,{start:(0,v.parseStartTime)(e),origin:window.location.origin}),events:{onReady:function(){t.loadingSDK=!1,t.onReady()},onStateChange:t.onStateChange,onError:function(e){return t.props.onError(e.data)}}})},this.props.onError))}},{key:"play",value:function(){this.isReady&&this.player.playVideo&&this.player.playVideo()}},{key:"pause",value:function(){this.isReady&&this.player.pauseVideo&&this.player.pauseVideo()}},{key:"stop",value:function(){this.isReady&&this.player.stopVideo&&this.player.stopVideo()}},{key:"seekTo",value:function(e){l(Object.getPrototypeOf(t.prototype),"seekTo",this).call(this,e),this.isReady&&this.player.seekTo&&this.player.seekTo(this.getDuration()*e)}},{key:"setVolume",value:function(e){this.isReady&&this.player.setVolume&&this.player.setVolume(100*e)}},{key:"getDuration",value:function(){return this.isReady&&this.player.getDuration?this.player.getDuration():null}},{key:"getFractionPlayed",value:function(){return this.isReady&&this.getDuration()?this.player.getCurrentTime()/this.getDuration():null}},{key:"getFractionLoaded",value:function(){return this.isReady&&this.player.getVideoLoadedFraction?this.player.getVideoLoadedFraction():null}},{key:"render",value:function(){var e={height:"100%",display:this.props.url?"block":"none"};return p["default"].createElement("div",{style:e},p["default"].createElement("div",{id:this.playerId}))}}],[{key:"canPlay",value:function(e){return w.test(e)}}]),t}(h["default"]);j.displayName="YouTube",t["default"]=j,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),i=r(o),a=n(5),u=r(a),s=n(6),l=r(s),c=n(3),p=r(c);t["default"]=[i["default"],u["default"],l["default"],p["default"]],e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=e.match(i);if(t){var n=t[1];if(n.match(a))return r(n);if(u.test(n))return parseInt(n,10)}return 0}function r(e){for(var t=0,n=a.exec(e);null!==n;){var r=n,i=o(r,3),u=i[1],s=i[2];"h"===s&&(t+=60*parseInt(u,10)*60),"m"===s&&(t+=60*parseInt(u,10)),"s"===s&&(t+=parseInt(u,10)),n=a.exec(e)}return t}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(s){o=!0,i=s}finally{try{!r&&u["return"]&&u["return"]()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.parseStartTime=n;var i=/[\?&#](?:start|t)=([0-9hms]+)/,a=/(\d+)(h|m|s)/g,u=/^\d+$/},function(e,t,n){var r;(function(e,o,i){(function(){"use strict";function a(e){return"function"==typeof e||"object"==typeof e&&null!==e}function u(e){return"function"==typeof e}function s(e){H=e}function l(e){ee=e}function c(){return function(){e.nextTick(h)}}function p(){return function(){J(h)}}function f(){var e=0,t=new re(h),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function y(){var e=new MessageChannel;return e.port1.onmessage=h,function(){e.port2.postMessage(0)}}function d(){return function(){setTimeout(h,1)}}function h(){for(var e=0;Z>e;e+=2){var t=ae[e],n=ae[e+1];t(n),ae[e]=void 0,ae[e+1]=void 0}Z=0}function v(){try{var e=n(18);return J=e.runOnLoop||e.runOnContext,p()}catch(t){return d()}}function g(e,t){var n=this,r=new this.constructor(b);void 0===r[le]&&L(r);var o=n._state;if(o){var i=arguments[o-1];ee(function(){I(o,r,i,n._result)})}else R(n,r,e,t);return r}function m(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return E(n,e),n}function b(){}function w(){return new TypeError("You cannot resolve a promise with itself")}function P(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return ye.error=t,ye}}function O(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function k(e,t,n){ee(function(e){var r=!1,o=O(n,t,function(n){r||(r=!0,t!==n?E(e,n):S(e,n))},function(t){r||(r=!0,M(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&o&&(r=!0,M(e,o))},e)}function j(e,t){t._state===pe?S(e,t._result):t._state===fe?M(e,t._result):R(t,void 0,function(t){E(e,t)},function(t){M(e,t)})}function T(e,t,n){t.constructor===e.constructor&&n===ue&&constructor.resolve===se?j(e,t):n===ye?M(e,ye.error):void 0===n?S(e,t):u(n)?k(e,t,n):S(e,t)}function E(e,t){e===t?M(e,w()):a(t)?T(e,t,_(t)):S(e,t)}function C(e){e._onerror&&e._onerror(e._result),x(e)}function S(e,t){e._state===ce&&(e._result=t,e._state=pe,0!==e._subscribers.length&&ee(x,e))}function M(e,t){e._state===ce&&(e._state=fe,e._result=t,ee(C,e))}function R(e,t,n,r){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+pe]=n,o[i+fe]=r,0===i&&e._state&&ee(x,e)}function x(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,o,i=e._result,a=0;a<t.length;a+=3)r=t[a],o=t[a+n],r?I(n,r,o,i):o(i);e._subscribers.length=0}}function A(){this.error=null}function D(e,t){try{return e(t)}catch(n){return de.error=n,de}}function I(e,t,n,r){var o,i,a,s,l=u(n);if(l){if(o=D(n,r),o===de?(s=!0,i=o.error,o=null):a=!0,t===o)return void M(t,P())}else o=r,a=!0;t._state!==ce||(l&&a?E(t,o):s?M(t,i):e===pe?S(t,o):e===fe&&M(t,o))}function F(e,t){try{t(function(t){E(e,t)},function(t){M(e,t)})}catch(n){M(e,n)}}function V(){return he++}function L(e){e[le]=he++,e._state=void 0,e._result=void 0,e._subscribers=[]}function N(e){return new we(this,e).promise}function U(e){var t=this;return new t(X(e)?function(n,r){for(var o=e.length,i=0;o>i;i++)t.resolve(e[i]).then(n,r)}:function(e,t){t(new TypeError("You must pass an array to race."))})}function B(e){var t=this,n=new t(b);return M(n,e),n}function Y(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function W(e){this[le]=V(),this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&Y(),this instanceof W?F(this,e):K())}function $(e,t){this._instanceConstructor=e,this.promise=new e(b),this.promise[le]||L(this.promise),X(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):M(this.promise,q())}function q(){return new Error("Array Methods must be provided an Array")}function z(){var e;if("undefined"!=typeof o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;n&&"[object Promise]"===Object.prototype.toString.call(n.resolve())&&!n.cast||(e.Promise=be)}var G;G=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var J,H,Q,X=G,Z=0,ee=function(e,t){ae[Z]=e,ae[Z+1]=t,Z+=2,2===Z&&(H?H(h):Q())},te="undefined"!=typeof window?window:void 0,ne=te||{},re=ne.MutationObserver||ne.WebKitMutationObserver,oe="undefined"==typeof self&&"undefined"!=typeof e&&"[object process]"==={}.toString.call(e),ie="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ae=new Array(1e3);Q=oe?c():re?f():ie?y():void 0===te?v():d();var ue=g,se=m,le=Math.random().toString(36).substring(16),ce=void 0,pe=1,fe=2,ye=new A,de=new A,he=0,ve=N,ge=U,me=B,be=W;W.all=ve,W.race=ge,W.resolve=se,W.reject=me,W._setScheduler=s,W._setAsap=l,W._asap=ee,W.prototype={constructor:W,then:ue,"catch":function(e){return this.then(null,e)}};var we=$;$.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ce&&e>n;n++)this._eachEntry(t[n],n)},$.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===se){var o=_(e);if(o===ue&&e._state!==ce)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===be){var i=new n(b);T(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},$.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ce&&(this._remaining--,e===fe?M(r,n):this._result[t]=n),0===this._remaining&&S(r,this._result)},$.prototype._willSettleAt=function(e,t){var n=this;R(e,void 0,function(e){n._settledAt(pe,t,e)},function(e){n._settledAt(fe,t,e)})};var Pe=z,_e={Promise:be,polyfill:Pe};n(16).amd?(r=function(){return _e}.call(t,n,t,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=_e:"undefined"!=typeof this&&(this.ES6Promise=_e),Pe()}).call(this)}).call(t,n(13),function(){return this}(),n(17)(e))},function(e,t,n){var r,o,i;!function(n,a){o=[t,e],r=a,i="function"==typeof r?r.apply(t,o):r,!(void 0!==i&&(e.exports=i))}(this,function(e,t){"use strict";function n(){return"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random())}function r(e){try{delete window[e]}catch(t){window[e]=void 0}}function o(e){var t=document.getElementById(e);document.getElementsByTagName("head")[0].removeChild(t)}var i={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null},a=function(e){var t=void 0===arguments[1]?{}:arguments[1],a=null!=t.timeout?t.timeout:i.timeout,u=null!=t.jsonpCallback?t.jsonpCallback:i.jsonpCallback,s=void 0;return new Promise(function(i,l){var c=t.jsonpCallbackFunction||n();window[c]=function(e){i({ok:!0,json:function(){return Promise.resolve(e)}}),s&&clearTimeout(s),o(u+"_"+c),r(c)},e+=-1===e.indexOf("?")?"?":"&";var p=document.createElement("script");p.setAttribute("src",e+u+"="+c),p.id=u+"_"+c,document.getElementsByTagName("head")[0].appendChild(p),s=setTimeout(function(){l(new Error("JSONP request to "+e+" timed out")),r(c),o(u+"_"+c)},a)})};t.exports=a})},function(e,t){function n(e,t){for(var n in t)e.setAttribute(n,t[n])}function r(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function o(e,t){e.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||(this.onreadystatechange=null,t(null,e))}}e.exports=function(e,t,i){var a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("script");"function"==typeof t&&(i=t,t={}),t=t||{},i=i||function(){},u.type=t.type||"text/javascript",u.charset=t.charset||"utf8",u.async="async"in t?!!t.async:!0,u.src=e,t.attrs&&n(u,t.attrs),t.text&&(u.text=""+t.text);var s="onload"in u?r:o;s(u,i),u.onload||r(u,i),a.appendChild(u)}},function(e,t){function n(){l&&a&&(l=!1,a.length?s=a.concat(s):c=-1,s.length&&r())}function r(){if(!l){var e=setTimeout(n);l=!0;for(var t=s.length;t;){for(a=s,s=[];++c<t;)a&&a[c].run();c=-1,t=s.length}a=null,l=!1,clearTimeout(e)}}function o(e,t){this.fun=e,this.array=t}function i(){}var a,u=e.exports={},s=[],l=!1,c=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new o(e,t)),1!==s.length||l||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},
u.on=i,u.addListener=i,u.once=i,u.off=i,u.removeListener=i,u.removeAllListeners=i,u.emit=i,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(e,t,n){"use strict";function r(e,t){return t?o(e):encodeURIComponent(e)}var o=n(15);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){var t=Object.create(null);return"string"!=typeof e?t:(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("="),r=n.shift(),o=n.length>0?n.join("="):void 0;r=decodeURIComponent(r),o=void 0===o?null:decodeURIComponent(o),void 0===t[r]?t[r]=o:Array.isArray(t[r])?t[r].push(o):t[r]=[t[r],o]}),t):t},t.stringify=function(e,t){t=t||{};var n=t.strict!==!1;return e?Object.keys(e).sort().map(function(t){var o=e[t];if(void 0===o)return"";if(null===o)return t;if(Array.isArray(o)){var i=[];return o.slice().sort().forEach(function(e){void 0!==e&&(null===e?i.push(r(t,n)):i.push(r(t,n)+"="+r(e,n)))}),i.join("&")}return r(t,n)+"="+r(o,n)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){}]);
//# sourceMappingURL=ReactPlayer.js.map

@@ -79,3 +79,3 @@ 'use strict';

value: function stop() {
this.player.src = '';
this.player.removeAttribute('src');
}

@@ -114,12 +114,18 @@ }, {

value: function render() {
var _props = this.props;
var controls = _props.controls;
var fileConfig = _props.fileConfig;
var Media = AUDIO_EXTENSIONS.test(this.props.url) ? 'audio' : 'video';
var style = { display: this.props.url ? 'block' : 'none' };
var attributes = this.props.fileConfig.attributes;
var style = {
width: '100%',
height: '100%',
display: this.props.url ? 'block' : 'none'
};
return _react2.default.createElement(Media, _extends({
ref: 'player',
style: style,
width: '100%',
height: '100%',
preload: 'auto'
}, attributes));
preload: 'auto',
controls: controls
}, fileConfig.attributes));
}

@@ -126,0 +132,0 @@ }], [{

@@ -15,6 +15,2 @@ 'use strict';

var _loadScript = require('load-script');
var _loadScript2 = _interopRequireDefault(_loadScript);
var _fetchJsonp = require('fetch-jsonp');

@@ -24,5 +20,5 @@

var _Base2 = require('./Base');
var _FilePlayer2 = require('./FilePlayer');
var _Base3 = _interopRequireDefault(_Base2);
var _FilePlayer3 = _interopRequireDefault(_FilePlayer2);

@@ -37,4 +33,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var SDK_URL = '//connect.soundcloud.com/sdk-2.0.0.js';
var SDK_GLOBAL = 'SC';
var RESOLVE_URL = '//api.soundcloud.com/resolve.json';

@@ -45,4 +39,4 @@ var MATCH_URL = /^https?:\/\/(soundcloud.com|snd.sc)\/([a-z0-9-_]+\/[a-z0-9-_]+)$/;

var SoundCloud = function (_Base) {
_inherits(SoundCloud, _Base);
var SoundCloud = function (_FilePlayer) {
_inherits(SoundCloud, _FilePlayer);

@@ -62,7 +56,2 @@ function SoundCloud() {

image: null
}, _this.onStateChange = function (state) {
if (state === 'playing') _this.onPlay();
if (state === 'paused') _this.props.onPause();
if (state === 'loading') _this.props.onBuffer();
if (state === 'ended') _this.onEnded();
}, _temp), _possibleConstructorReturn(_this, _ret);

@@ -77,24 +66,5 @@ }

}, {
key: 'getSDK',
value: function getSDK() {
var _this2 = this;
if (window[SDK_GLOBAL]) {
return Promise.resolve(window[SDK_GLOBAL]);
}
return new Promise(function (resolve, reject) {
(0, _loadScript2.default)(SDK_URL, function (err) {
if (err) {
reject(err);
} else {
window[SDK_GLOBAL].initialize({ client_id: _this2.props.soundcloudConfig.clientId });
resolve(window[SDK_GLOBAL]);
}
});
});
}
}, {
key: 'getSongData',
value: function getSongData(url) {
var _this3 = this;
var _this2 = this;

@@ -109,3 +79,3 @@ if (songData[url]) {

} else {
_this3.props.onError(new Error('SoundCloud track could not be resolved'));
_this2.props.onError(new Error('SoundCloud track could not be resolved'));
}

@@ -117,82 +87,29 @@ });

value: function load(url) {
var _this4 = this;
var _this3 = this;
this.stop();
this.getSDK().then(function (SC) {
_this4.getSongData(url).then(function (data) {
if (url !== _this4.props.url) {
return; // Abort if url changes during async requests
}
if (!data.streamable) {
_this4.props.onError(new Error('SoundCloud track is not streamable'));
return;
}
var image = data.artwork_url || data.user.avatar_url;
if (image) {
_this4.setState({ image: image.replace('-large', '-t500x500') });
}
SC.stream(data.uri, function (player) {
_this4.player = player;
player._player.on('stateChange', _this4.onStateChange);
_this4.onReady();
});
}, _this4.props.onError);
this.getSongData(url).then(function (data) {
if (url !== _this3.props.url) {
return; // Abort if url changes during async requests
}
if (!data.streamable) {
_this3.props.onError(new Error('SoundCloud track is not streamable'));
return;
}
var image = data.artwork_url || data.user.avatar_url;
if (image) {
_this3.setState({ image: image.replace('-large', '-t500x500') });
}
_this3.player.src = data.stream_url + '?client_id=' + _this3.props.soundcloudConfig.clientId;
}, this.props.onError);
}
}, {
key: 'play',
value: function play() {
if (!this.isReady) return;
this.player.play();
}
}, {
key: 'pause',
value: function pause() {
if (!this.isReady) return;
this.player.pause();
}
}, {
key: 'stop',
value: function stop() {
if (!this.isReady) return;
this.player._player.off('stateChange', this.onStateChange);
this.player.stop();
}
}, {
key: 'seekTo',
value: function seekTo(fraction) {
_get(Object.getPrototypeOf(SoundCloud.prototype), 'seekTo', this).call(this, fraction);
if (!this.isReady) return;
this.player.seek(this.getDuration(true) * fraction);
}
}, {
key: 'setVolume',
value: function setVolume(fraction) {
if (!this.isReady) return;
this.player.setVolume(fraction);
}
}, {
key: 'getDuration',
value: function getDuration(ms) {
if (!this.isReady) return null;
if (ms) return this.player.getDuration();
return this.player.getDuration() / 1000;
}
}, {
key: 'getFractionPlayed',
value: function getFractionPlayed() {
if (!this.isReady) return null;
return this.player.getCurrentPosition() / this.getDuration(true);
}
}, {
key: 'getFractionLoaded',
value: function getFractionLoaded() {
if (!this.isReady) return null;
return this.player.getLoadedPosition() / this.getDuration(true);
}
}, {
key: 'render',
value: function render() {
var _props = this.props;
var url = _props.url;
var controls = _props.controls;
var style = {
display: this.props.url ? 'block' : 'none',
display: url ? 'block' : 'none',
height: '100%',

@@ -203,3 +120,13 @@ backgroundImage: this.state.image ? 'url(' + this.state.image + ')' : null,

};
return _react2.default.createElement('div', { style: style });
return _react2.default.createElement(
'div',
{ style: style },
_react2.default.createElement('audio', {
ref: 'player',
type: 'audio/mpeg',
preload: 'auto',
style: { width: '100%', height: '100%' },
controls: controls
})
);
}

@@ -214,3 +141,3 @@ }], [{

return SoundCloud;
}(_Base3.default);
}(_FilePlayer3.default);

@@ -217,0 +144,0 @@ SoundCloud.displayName = 'SoundCloud';

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

autoplay: 0,
controls: 0,
playsinline: 1,

@@ -133,3 +132,5 @@ showinfo: 0,

videoId: id,
playerVars: _extends({}, DEFAULT_PLAYER_VARS, _this2.props.youtubeConfig.playerVars, {
playerVars: _extends({}, DEFAULT_PLAYER_VARS, {
controls: _this2.props.controls ? 1 : 0
}, _this2.props.youtubeConfig.playerVars, {
start: (0, _utils.parseStartTime)(url),

@@ -136,0 +137,0 @@ origin: window.location.origin

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

loop: _react.PropTypes.bool,
controls: _react.PropTypes.bool,
volume: _react.PropTypes.number,

@@ -47,2 +48,3 @@ width: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]),

loop: false,
controls: false,
volume: 0.8,

@@ -49,0 +51,0 @@ width: 640,

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

@@ -5,0 +5,0 @@ "main": "lib/ReactPlayer.js",

@@ -80,2 +80,3 @@ ReactPlayer

`loop` | Set to `true` or `false` to loop the media | `false`
`controls` | Set to `true` or `false` to display native player controls<br />*Note: Vimeo player controls are not configurable and will always display* | `false`
`volume` | Sets the volume of the appropriate player | `0.8`

@@ -89,7 +90,7 @@ `width` | Sets the width of the player | `640`

Callback props take a function that gets fired on various player events
Callback props take a function that gets fired on various player events:
Prop | Description
---- | -----------
`onProgress` | Callback containing `played` and `loaded` progress as a fraction<br/>eg `{ played: 0.12, loaded: 0.34 }`
`onProgress` | Callback containing `played` and `loaded` progress as a fraction<br />eg `{ played: 0.12, loaded: 0.34 }`
`onDuration` | Callback containing duration of the media, in seconds

@@ -105,10 +106,10 @@ `onStart` | Called when media starts playing

These props allow you to override the parameters for the various players
These props allow you to override the parameters for the various players:
Prop | Description
---- | -----------
`soundcloudConfig` | Configuration object for the SoundCloud player. Set `clientId` to your own SoundCloud app [client ID](https://soundcloud.com/you/apps)
`vimeoConfig` | Configuration object for the Vimeo player. Set `iframeParams` to override the [default params](https://developer.vimeo.com/player/embedding#universal-parameters). Set `preload` for [preloading](#preloading)
`youtubeConfig` | Configuration object for the YouTube player. Set `playerVars` to override the [default player vars](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5). Set `preload` for [preloading](#preloading)
`fileConfig` | Configuration object for the file player. Set `attributes` to apply [element attributes](https://developer.mozilla.org/en/docs/Web/HTML/Element/video#Attributes)
`soundcloudConfig` | Configuration object for the SoundCloud player.<br />Set `clientId` to your own SoundCloud app [client ID](https://soundcloud.com/you/apps).
`vimeoConfig` | Configuration object for the Vimeo player.<br />Set `iframeParams` to override the [default params](https://developer.vimeo.com/player/embedding#universal-parameters).<br />Set `preload` for [preloading](#preloading).
`youtubeConfig` | Configuration object for the YouTube player.<br />Set `playerVars` to override the [default player vars](https://developers.google.com/youtube/player_parameters?playerVersion=HTML5).<br />Set `preload` for [preloading](#preloading).
`fileConfig` | Configuration object for the file player.<br />Set `attributes` to apply [element attributes](https://developer.mozilla.org/en/docs/Web/HTML/Element/video#Attributes).

@@ -115,0 +116,0 @@ ##### Preloading

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