Guest User

Untitled

a guest
Jan 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.06 KB | None | 0 0
  1. module.exports = function(e) {
  2. function t(o) {
  3. if (n[o]) return n[o].exports;
  4. var r = n[o] = {
  5. exports: {},
  6. id: o,
  7. loaded: !1
  8. };
  9. return e[o].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports
  10. }
  11. var n = {};
  12. return t.m = e, t.c = n, t.p = "", t(0)
  13. }([function(e, t, n) {
  14. "use strict";
  15.  
  16. function o(e) {
  17. return e && e.__esModule ? e : {
  18. default: e
  19. }
  20. }
  21.  
  22. function r(e, t) {
  23. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  24. }
  25.  
  26. function a(e, t) {
  27. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  28. return !t || "object" != typeof t && "function" != typeof t ? e : t
  29. }
  30.  
  31. function u(e, t) {
  32. if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
  33. e.prototype = Object.create(t && t.prototype, {
  34. constructor: {
  35. value: e,
  36. enumerable: !1,
  37. writable: !0,
  38. configurable: !0
  39. }
  40. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  41. }
  42. Object.defineProperty(t, "__esModule", {
  43. value: !0
  44. });
  45. var l = Object.assign || function(e) {
  46. for (var t = 1; t < arguments.length; t++) {
  47. var n = arguments[t];
  48. for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o])
  49. }
  50. return e
  51. },
  52. s = function() {
  53. function e(e, t) {
  54. for (var n = 0; n < t.length; n++) {
  55. var o = t[n];
  56. o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
  57. }
  58. }
  59. return function(t, n, o) {
  60. return n && e(t.prototype, n), o && e(t, o), t
  61. }
  62. }(),
  63. i = n(2),
  64. c = o(i),
  65. d = n(1),
  66. p = o(d),
  67. f = function(e) {
  68. function t() {
  69. return r(this, t), a(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments))
  70. }
  71. return u(t, e), s(t, [{
  72. key: "componentDidMount",
  73. value: function() {
  74. var e = this,
  75. t = this.audioEl;
  76. this.updateVolume(this.props.volume), t.addEventListener("error", function(t) {
  77. e.props.onError(t)
  78. }), t.addEventListener("canplay", function(t) {
  79. e.props.onCanPlay(t)
  80. }), t.addEventListener("canplaythrough", function(t) {
  81. e.props.onCanPlayThrough(t)
  82. }), t.addEventListener("play", function(t) {
  83. e.setListenTrack(), e.props.onPlay(t)
  84. }), t.addEventListener("abort", function(t) {
  85. e.clearListenTrack(), e.props.onAbort(t)
  86. }), t.addEventListener("ended", function(t) {
  87. e.clearListenTrack(), e.props.onEnded(t)
  88. }), t.addEventListener("pause", function(t) {
  89. e.clearListenTrack(), e.props.onPause(t)
  90. }), t.addEventListener("seeked", function(t) {
  91. e.props.onSeeked(t)
  92. }), t.addEventListener("loadedmetadata", function(t) {
  93. e.props.onLoadedMetadata(t)
  94. }), t.addEventListener("volumechange", function(t) {
  95. e.props.onVolumeChanged(t)
  96. })
  97. }
  98. }, {
  99. key: "componentWillReceiveProps",
  100. value: function(e) {
  101. this.updateVolume(e.volume)
  102. }
  103. }, {
  104. key: "setListenTrack",
  105. value: function() {
  106. var e = this;
  107. if (!this.listenTracker) {
  108. var t = this.props.listenInterval;
  109. this.listenTracker = setInterval(function() {
  110. e.props.onListen(e.audioEl.currentTime)
  111. }, t)
  112. }
  113. }
  114. }, {
  115. key: "updateVolume",
  116. value: function(e) {
  117. "number" == typeof e && e !== this.audioEl.volume && (this.audioEl.volume = e)
  118. }
  119. }, {
  120. key: "clearListenTrack",
  121. value: function() {
  122. this.listenTracker && (clearInterval(this.listenTracker), this.listenTracker = null)
  123. }
  124. }, {
  125. key: "render",
  126. value: function() {
  127. var e = this,
  128. t = this.props.children || c.default.createElement("p", null, "Your browser does not support the ", c.default.createElement("code", null, "audio"), " element."),
  129. n = !(this.props.controls === !1),
  130. o = this.props.title ? this.props.title : this.props.src,
  131. r = {};
  132. return this.props.controlsList && (r.controlsList = this.props.controlsList), c.default.createElement("audio", l({
  133. autoPlay: this.props.autoPlay,
  134. className: "react-audio-player " + this.props.className,
  135. controls: n,
  136. loop: this.props.loop,
  137. muted: this.props.muted,
  138. onPlay: this.onPlay,
  139. preload: this.props.preload,
  140. ref: function(t) {
  141. e.audioEl = t
  142. },
  143. src: this.props.src,
  144. style: this.props.style,
  145. title: o
  146. }, r), t)
  147. }
  148. }]), t
  149. }(i.Component);
  150. f.defaultProps = {
  151. autoPlay: !1,
  152. children: null,
  153. className: "",
  154. controls: !1,
  155. controlsList: "",
  156. listenInterval: 1e4,
  157. loop: !1,
  158. muted: !1,
  159. onAbort: function() {},
  160. onCanPlay: function() {},
  161. onCanPlayThrough: function() {},
  162. onEnded: function() {},
  163. onError: function() {},
  164. onListen: function() {},
  165. onPause: function() {},
  166. onPlay: function() {},
  167. onSeeked: function() {},
  168. onVolumeChanged: function() {},
  169. onLoadedMetadata: function() {},
  170. preload: "metadata",
  171. src: null,
  172. style: {},
  173. title: "",
  174. volume: 1
  175. }, f.propTypes = {
  176. autoPlay: p.default.bool,
  177. children: p.default.element,
  178. className: p.default.string,
  179. controls: p.default.bool,
  180. controlsList: p.default.string,
  181. listenInterval: p.default.number,
  182. loop: p.default.bool,
  183. muted: p.default.bool,
  184. onAbort: p.default.func,
  185. onCanPlay: p.default.func,
  186. onCanPlayThrough: p.default.func,
  187. onEnded: p.default.func,
  188. onError: p.default.func,
  189. onListen: p.default.func,
  190. onLoadedMetadata: p.default.func,
  191. onPause: p.default.func,
  192. onPlay: p.default.func,
  193. onSeeked: p.default.func,
  194. onVolumeChanged: p.default.func,
  195. preload: p.default.oneOf(["", "none", "metadata", "auto"]),
  196. src: p.default.string,
  197. style: p.default.objectOf(p.default.string),
  198. title: p.default.string,
  199. volume: p.default.number
  200. };
  201. var h = f;
  202. t.default = h;
  203. (function() {
  204. "undefined" != typeof __REACT_HOT_LOADER__ && (__REACT_HOT_LOADER__.register(f, "ReactAudioPlayer", "/Users/mccandj/Documents/Projects/react-audio-player/src/index.jsx"), __REACT_HOT_LOADER__.register(h, "default", "/Users/mccandj/Documents/Projects/react-audio-player/src/index.jsx"))
  205. })()
  206. }, function(e, t) {
  207. e.exports = require("prop-types")
  208. }, function(e, t) {
  209. e.exports = require("react")
  210. }]);
Add Comment
Please, Sign In to add comment