react-player
Advanced tools
Comparing version 0.7.5 to 0.8.0
@@ -7,2 +7,10 @@ # Change Log | ||
#### [v0.8.0](https://github.com/CookPete/react-player/compare/v0.7.5...v0.8.0) | ||
> 29 July 2016 | ||
* Add support for non-es5 compatible browsers [`#87`](https://github.com/CookPete/react-player/pull/87) | ||
* Render FilePlayer by default [`8d249ce`](https://github.com/CookPete/react-player/commit/8d249cedb234f63e59858840a5ea40b899632177) | ||
* Bump packages [`2d43659`](https://github.com/CookPete/react-player/commit/2d436592fedbba4b92653e1f929d5a31ccf3b14d) | ||
#### [v0.7.5](https://github.com/CookPete/react-player/compare/v0.7.4...v0.7.5) | ||
@@ -9,0 +17,0 @@ > 27 July 2016 |
@@ -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(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=r.refs.player.getFractionLoaded()||0,t=r.refs.player.getFractionPlayed()||0;e===r.prevLoaded&&t===r.prevPlayed||(r.props.onProgress({loaded:e,played:t}),r.prevLoaded=e,r.prevPlayed=t)}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=n.fileConfig,c=o(n,["youtubeConfig","soundcloudConfig","vimeoConfig","fileConfig"]),f=t?s({},c,{ref:"player"}):{};return p["default"].createElement(e,s({key:e.displayName,youtubeConfig:i,soundcloudConfig:a,vimeoConfig:u,fileConfig:l},f))},u=n,a(r,u)}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.progress()}},{key:"componentWillReceiveProps",value:function(e){this.props.playing&&!e.playing&&clearTimeout(this.progressTimeout),!this.props.playing&&e.playing&&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||this.props.height!==e.height||this.props.width!==e.width}},{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.durationOnPlay=!1,i.seekOnPlay=null,i.onPlay=function(){i.startOnPlay&&(i.setVolume(i.props.volume),i.props.onStart(),i.startOnPlay=!1),i.props.onPlay(),i.seekOnPlay&&(i.seekTo(i.seekOnPlay),i.seekOnPlay=null),i.durationOnPlay&&(i.props.onDuration(i.getDuration()),i.durationOnPlay=!1)},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());var e=i.getDuration();e?i.props.onDuration(e):i.durationOnPlay=!0},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.seekOnPlay=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.seekOnPlay=e,setTimeout(function(){t.seekOnPlay=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 m(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:m(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=/^rtsp:\/\//i,h=/\.(mp4|og[gv]|webm|mov|m4v)($|\?)/i,v=/\.(mp3|wav|m4a)($|\?)/i,g=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.pause(),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=v.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)||v.test(e)}}]),t}(y["default"]);g.displayName="FilePlayer",t["default"]=g,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 j(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:j(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",O="https://www.youtube.com/watch?v=GlCmAC4MHek",_={autoplay:0,playsinline:1,showinfo:0,rel:0,iv_load_policy:3},k=0,T=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(O)),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({},_,{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"]);T.displayName="YouTube",t["default"]=T,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 x(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 O(e){try{return e.then}catch(t){return ye.error=t,ye}}function _(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=_(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 T(e,t){t._state===pe?S(e,t._result):t._state===fe?M(e,t._result):x(t,void 0,function(t){E(e,t)},function(t){M(e,t)})}function j(e,t,n){t.constructor===e.constructor&&n===ue&&constructor.resolve===se?T(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)?j(e,t,O(t)):S(e,t)}function C(e){e._onerror&&e._onerror(e._result),D(e)}function S(e,t){e._state===ce&&(e._result=t,e._state=pe,0!==e._subscribers.length&&ee(D,e))}function M(e,t){e._state===ce&&(e._state=fe,e._result=t,ee(C,e))}function x(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(D,e)}function D(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 R(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=R(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 W(){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 K(e){this[le]=V(),this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&W(),this instanceof K?F(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))):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=K;K.all=ve,K.race=ge,K.resolve=se,K.reject=me,K._setScheduler=s,K._setAsap=l,K._asap=ee,K.prototype={constructor:K,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=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);j(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;x(e,void 0,function(e){n._settledAt(pe,t,e)},function(e){n._settledAt(fe,t,e)})};var Pe=z,Oe={Promise:be,polyfill:Pe};n(16).amd?(r=function(){return Oe}.call(t,n,t,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=Oe:"undefined"!=typeof this&&(this.ES6Promise=Oe),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){}]); | ||
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(9);var c=n(1),p=r(c),f=n(4),y=n(7),d=r(y),h=n(5),v=r(h),g=n(6),m=r(g),b=n(3),w=r(b),P=function(e){function t(){var e,n,r,u;i(this,t);for(var l=arguments.length,c=Array(l),f=0;f<l;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=r.refs.player.getFractionLoaded()||0,t=r.refs.player.getFractionPlayed()||0;e===r.prevLoaded&&t===r.prevPlayed||(r.props.onProgress({loaded:e,played:t}),r.prevLoaded=e,r.prevPlayed=t)}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=n.fileConfig,c=o(n,["youtubeConfig","soundcloudConfig","vimeoConfig","fileConfig"]),f=t?s({},c,{ref:"player"}):{};return p["default"].createElement(e,s({key:e.displayName,youtubeConfig:i,soundcloudConfig:a,vimeoConfig:u,fileConfig:l},f))},u=n,a(r,u)}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.progress()}},{key:"componentWillReceiveProps",value:function(e){this.props.playing&&!e.playing&&clearTimeout(this.progressTimeout),!this.props.playing&&e.playing&&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||this.props.height!==e.height||this.props.width!==e.width}},{key:"renderPlayers",value:function(){var e=this.props,t=e.url,n=e.youtubeConfig,r=e.vimeoConfig,o=[];return d["default"].canPlay(t)?o.push(d["default"]):v["default"].canPlay(t)?o.push(v["default"]):m["default"].canPlay(t)?o.push(m["default"]):t&&o.push(w["default"]),!d["default"].canPlay(t)&&n.preload&&o.push(d["default"]),!m["default"].canPlay(t)&&r.preload&&o.push(m["default"]),o.map(this.renderPlayer)}},{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},this.renderPlayers())}}]),t}(c.Component);P.displayName="ReactPlayer",P.propTypes=f.propTypes,P.defaultProps=f.defaultProps,t["default"]=P,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;l<u;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.durationOnPlay=!1,i.seekOnPlay=null,i.onPlay=function(){i.startOnPlay&&(i.setVolume(i.props.volume),i.props.onStart(),i.startOnPlay=!1),i.props.onPlay(),i.seekOnPlay&&(i.seekTo(i.seekOnPlay),i.seekOnPlay=null),i.durationOnPlay&&(i.props.onDuration(i.getDuration()),i.durationOnPlay=!1)},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());var e=i.getDuration();e?i.props.onDuration(e):i.durationOnPlay=!0},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.seekOnPlay=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.seekOnPlay=e,setTimeout(function(){t.seekOnPlay=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 v(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:v(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=/\.(mp3|wav|m4a)($|\?)/i,h=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.pause(),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=d.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!0}}]),t}(y["default"]);h.displayName="FilePlayer",t["default"]=h,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(10),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;l<u;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(13),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;l<u;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(11),y=r(f),d=n(2),h=r(d),v=n(8),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",O="https://www.youtube.com/watch?v=GlCmAC4MHek",_={autoplay:0,playsinline:1,showinfo:0,rel:0,iv_load_policy:3},j=0,k=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),l=0;l<u;l++)s[l]=arguments[l];return n=r=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.playerId=P+"-"+j++,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(O)),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({},_,{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"]);k.displayName="YouTube",t["default"]=k,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;e<Z;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 x(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 O(e){try{return e.then}catch(t){return ye.error=t,ye}}function _(e,t,n,r){try{e.call(t,n,r)}catch(o){return o}}function j(e,t,n){ee(function(e){var r=!1,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 k(e,t){t._state===pe?S(e,t._result):t._state===fe?M(e,t._result):x(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?k(e,t):n===ye?M(e,ye.error):void 0===n?S(e,t):u(n)?j(e,t,n):S(e,t)}function E(e,t){e===t?M(e,w()):a(t)?T(e,t,O(t)):S(e,t)}function C(e){e._onerror&&e._onerror(e._result),D(e)}function S(e,t){e._state===ce&&(e._result=t,e._state=pe,0!==e._subscribers.length&&ee(D,e))}function M(e,t){e._state===ce&&(e._state=fe,e._result=t,ee(C,e))}function x(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(D,e)}function D(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 R(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=R(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;i<o;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 W(){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 q(e){this[le]=V(),this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&W(),this instanceof q?F(this,e):Y())}function K(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,$())}function $(){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=q;q.all=ve,q.race=ge,q.resolve=se,q.reject=me,q._setScheduler=s,q._setAsap=l,q._asap=ee,q.prototype={constructor:q,then:ue,"catch":function(e){return this.then(null,e)}};var we=K;K.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ce&&n<e;n++)this._eachEntry(t[n],n)},K.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===se){var o=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)},K.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)},K.prototype._willSettleAt=function(e,t){var n=this;x(e,void 0,function(e){n._settledAt(pe,t,e)},function(e){n._settledAt(fe,t,e)})};var Pe=z,Oe={Promise:be,polyfill:Pe};n(16).amd?(r=function(){return Oe}.call(t,n,t,i),!(void 0!==r&&(i.exports=r))):"undefined"!=typeof i&&i.exports?i.exports=Oe:"undefined"!=typeof this&&(this.ES6Promise=Oe),Pe()}).call(this)}).call(t,n(12),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+=e.indexOf("?")===-1?"?":"&";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,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(){p&&l&&(p=!1,l.length?c=l.concat(c):f=-1,c.length&&r())}function r(){if(!p){var e=a.call(null,n);p=!0;for(var t=c.length;t;){for(l=c,c=[];++f<t;)l&&l[f].run();f=-1,t=c.length}l=null,p=!1,u.call(null,e)}}function o(e,t){this.fun=e,this.array=t; | ||
}function i(){}var a,u,s=e.exports={};!function(){try{a=setTimeout}catch(e){a=function(){throw new Error("setTimeout is not defined")}}try{u=clearTimeout}catch(e){u=function(){throw new Error("clearTimeout is not defined")}}}();var l,c=[],p=!1,f=-1;s.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];c.push(new o(e,t)),1!==c.length||p||a.call(null,r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=i,s.addListener=i,s.once=i,s.off=i,s.removeListener=i,s.removeAllListeners=i,s.emit=i,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,n){"use strict";function r(e,t){return t.encode?t.strict?o(e):encodeURIComponent(e):e}var o=n(15),i=n(14);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){var n={encode:!0,strict:!0};return t=i(n,t),e?Object.keys(e).sort().map(function(n){var o=e[n];if(void 0===o)return"";if(null===o)return r(n,t);if(Array.isArray(o)){var i=[];return o.slice().forEach(function(e){void 0!==e&&(null===e?i.push(r(n,t)):i.push(r(n,t)+"="+r(e,t)))}),i.join("&")}return r(n,t)+"="+r(o,t)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,a,u=n(e),s=1;s<arguments.length;s++){r=Object(arguments[s]);for(var l in r)o.call(r,l)&&(u[l]=r[l]);if(Object.getOwnPropertySymbols){a=Object.getOwnPropertySymbols(r);for(var c=0;c<a.length;c++)i.call(r,a[c])&&(u[a[c]]=r[a[c]])}}return u}},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 |
@@ -131,3 +131,3 @@ 'use strict'; | ||
Base.defaultProps = _props.defaultProps; | ||
exports.default = Base; | ||
exports['default'] = Base; | ||
module.exports = exports['default']; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -30,4 +30,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var MEDIA_PROTOCOLS = /^rtsp:\/\//i; | ||
var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)($|\?)/i; | ||
var AUDIO_EXTENSIONS = /\.(mp3|wav|m4a)($|\?)/i; | ||
@@ -127,3 +125,3 @@ | ||
}; | ||
return _react2.default.createElement(Media, _extends({ | ||
return _react2['default'].createElement(Media, _extends({ | ||
ref: 'player', | ||
@@ -138,3 +136,3 @@ style: style, | ||
value: function canPlay(url) { | ||
return MEDIA_PROTOCOLS.test(url) || VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url); | ||
return true; | ||
} | ||
@@ -144,6 +142,6 @@ }]); | ||
return FilePlayer; | ||
}(_Base3.default); | ||
}(_Base3['default']); | ||
FilePlayer.displayName = 'FilePlayer'; | ||
exports.default = FilePlayer; | ||
exports['default'] = FilePlayer; | ||
module.exports = exports['default']; |
@@ -23,5 +23,5 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
exports.default = [_YouTube2.default, _SoundCloud2.default, _Vimeo2.default, _FilePlayer2.default]; | ||
exports['default'] = [_YouTube2['default'], _SoundCloud2['default'], _Vimeo2['default'], _FilePlayer2['default']]; | ||
module.exports = exports['default']; |
@@ -23,3 +23,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -69,3 +69,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
} | ||
return (0, _fetchJsonp2.default)(RESOLVE_URL + '?url=' + url + '&client_id=' + this.props.soundcloudConfig.clientId).then(function (response) { | ||
return (0, _fetchJsonp2['default'])(RESOLVE_URL + '?url=' + url + '&client_id=' + this.props.soundcloudConfig.clientId).then(function (response) { | ||
if (response.ok) { | ||
@@ -114,6 +114,6 @@ songData[url] = response.json(); | ||
}; | ||
return _react2.default.createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
{ style: style }, | ||
_react2.default.createElement('audio', { | ||
_react2['default'].createElement('audio', { | ||
ref: 'player', | ||
@@ -135,6 +135,6 @@ type: 'audio/mpeg', | ||
return SoundCloud; | ||
}(_FilePlayer3.default); | ||
}(_FilePlayer3['default']); | ||
SoundCloud.displayName = 'SoundCloud'; | ||
exports.default = SoundCloud; | ||
exports['default'] = SoundCloud; | ||
module.exports = exports['default']; |
@@ -23,3 +23,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -165,3 +165,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}; | ||
return _react2.default.createElement('iframe', { ref: 'iframe', frameBorder: '0', style: style, allowFullScreen: fullscreen }); | ||
return _react2['default'].createElement('iframe', { ref: 'iframe', frameBorder: '0', style: style, allowFullScreen: fullscreen }); | ||
} | ||
@@ -176,6 +176,6 @@ }], [{ | ||
return Vimeo; | ||
}(_Base3.default); | ||
}(_Base3['default']); | ||
Vimeo.displayName = 'Vimeo'; | ||
exports.default = Vimeo; | ||
exports['default'] = Vimeo; | ||
module.exports = exports['default']; |
@@ -27,3 +27,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
@@ -104,3 +104,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}; | ||
(0, _loadScript2.default)(SDK_URL, function (err) { | ||
(0, _loadScript2['default'])(SDK_URL, function (err) { | ||
if (err) reject(err); | ||
@@ -208,6 +208,6 @@ }); | ||
}; | ||
return _react2.default.createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
{ style: style }, | ||
_react2.default.createElement('div', { id: this.playerId }) | ||
_react2['default'].createElement('div', { id: this.playerId }) | ||
); | ||
@@ -223,6 +223,6 @@ } | ||
return YouTube; | ||
}(_Base3.default); | ||
}(_Base3['default']); | ||
YouTube.displayName = 'YouTube'; | ||
exports.default = YouTube; | ||
exports['default'] = YouTube; | ||
module.exports = exports['default']; |
@@ -17,10 +17,22 @@ 'use strict'; | ||
var _props = require('./props'); | ||
var _props2 = require('./props'); | ||
var _players = require('./players'); | ||
var _YouTube = require('./players/YouTube'); | ||
var _players2 = _interopRequireDefault(_players); | ||
var _YouTube2 = _interopRequireDefault(_YouTube); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _SoundCloud = require('./players/SoundCloud'); | ||
var _SoundCloud2 = _interopRequireDefault(_SoundCloud); | ||
var _Vimeo = require('./players/Vimeo'); | ||
var _Vimeo2 = _interopRequireDefault(_Vimeo); | ||
var _FilePlayer = require('./players/FilePlayer'); | ||
var _FilePlayer2 = _interopRequireDefault(_FilePlayer); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
@@ -75,3 +87,3 @@ | ||
var props = active ? _extends({}, activeProps, { ref: 'player' }) : {}; | ||
return _react2.default.createElement(Player, _extends({ | ||
return _react2['default'].createElement(Player, _extends({ | ||
key: Player.displayName, | ||
@@ -112,2 +124,28 @@ youtubeConfig: youtubeConfig, | ||
}, { | ||
key: 'renderPlayers', | ||
value: function renderPlayers() { | ||
var _props = this.props; | ||
var url = _props.url; | ||
var youtubeConfig = _props.youtubeConfig; | ||
var vimeoConfig = _props.vimeoConfig; | ||
var players = []; | ||
if (_YouTube2['default'].canPlay(url)) { | ||
players.push(_YouTube2['default']); | ||
} else if (_SoundCloud2['default'].canPlay(url)) { | ||
players.push(_SoundCloud2['default']); | ||
} else if (_Vimeo2['default'].canPlay(url)) { | ||
players.push(_Vimeo2['default']); | ||
} else if (url) { | ||
players.push(_FilePlayer2['default']); | ||
} | ||
if (!_YouTube2['default'].canPlay(url) && youtubeConfig.preload) { | ||
players.push(_YouTube2['default']); | ||
} | ||
if (!_Vimeo2['default'].canPlay(url) && vimeoConfig.preload) { | ||
players.push(_Vimeo2['default']); | ||
} | ||
return players.map(this.renderPlayer); | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -119,15 +157,8 @@ value: function render() { | ||
}; | ||
return _react2.default.createElement( | ||
return _react2['default'].createElement( | ||
'div', | ||
{ style: style, className: this.props.className }, | ||
_players2.default.map(this.renderPlayer) | ||
this.renderPlayers() | ||
); | ||
} | ||
}], [{ | ||
key: 'canPlay', | ||
value: function canPlay(url) { | ||
return _players2.default.some(function (player) { | ||
return player.canPlay(url); | ||
}); | ||
} | ||
}]); | ||
@@ -139,5 +170,5 @@ | ||
ReactPlayer.displayName = 'ReactPlayer'; | ||
ReactPlayer.propTypes = _props.propTypes; | ||
ReactPlayer.defaultProps = _props.defaultProps; | ||
exports.default = ReactPlayer; | ||
ReactPlayer.propTypes = _props2.propTypes; | ||
ReactPlayer.defaultProps = _props2.defaultProps; | ||
exports['default'] = ReactPlayer; | ||
module.exports = exports['default']; |
{ | ||
"name": "react-player", | ||
"version": "0.7.5", | ||
"version": "0.8.0", | ||
"description": "A react component for playing a variety of URLs, including file paths, YouTube, SoundCloud and Vimeo", | ||
@@ -52,2 +52,4 @@ "main": "lib/ReactPlayer.js", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0", | ||
"babel-plugin-transform-es3-property-literals": "^6.8.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
@@ -64,3 +66,3 @@ "babel-preset-react": "^6.3.13", | ||
"json-loader": "^0.5.4", | ||
"karma": "^0.13.16", | ||
"karma": "^1.1.2", | ||
"karma-chai": "^0.1.0", | ||
@@ -80,3 +82,3 @@ "karma-chrome-launcher": "^1.0.1", | ||
"rimraf": "^2.4.4", | ||
"sass-loader": "^3.1.2", | ||
"sass-loader": "^4.0.0", | ||
"snazzy": "^4.0.0", | ||
@@ -83,0 +85,0 @@ "standard": "^7.1.0", |
@@ -116,4 +116,2 @@ ReactPlayer | ||
There is a static method `ReactPlayer.canPlay(url)` to determine if a URL can be played by the media player. Note that this does *not* detect media that is unplayable due to streaming permissions etc. In that case, `onError` will occur after attemping to play. | ||
To seek to a certain part of the media, there is a `seekTo(fraction)` instance method that will seek to the appropriate place in the media. See `App.js` for an example of this using `refs`. | ||
@@ -120,0 +118,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
334638
22
1134
41
133