@blerp/design 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +209 -221
- package/dist/index.esm.js +209 -221
- package/dist/index.umd.js +209 -221
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1570,215 +1570,6 @@ Blerp$1.propTypes = {
|
|
|
1570
1570
|
handleClickTitle: PropTypes__default['default'].func.isRequired
|
|
1571
1571
|
};
|
|
1572
1572
|
|
|
1573
|
-
var BlerpAudioContext = /*#__PURE__*/React.createContext({});
|
|
1574
|
-
var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
1575
|
-
var children = _ref.children;
|
|
1576
|
-
|
|
1577
|
-
if (typeof window === "undefined") {
|
|
1578
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, children);
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
var _useState = React.useState(null),
|
|
1582
|
-
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
1583
|
-
selectedBlerp = _useState2[0],
|
|
1584
|
-
_setSelectedBlerp = _useState2[1];
|
|
1585
|
-
|
|
1586
|
-
var _useState3 = React.useState("stopped"),
|
|
1587
|
-
_useState4 = _slicedToArray__default['default'](_useState3, 2),
|
|
1588
|
-
playState = _useState4[0],
|
|
1589
|
-
setPlayState = _useState4[1];
|
|
1590
|
-
|
|
1591
|
-
var _useState5 = React.useState(0),
|
|
1592
|
-
_useState6 = _slicedToArray__default['default'](_useState5, 2);
|
|
1593
|
-
_useState6[0];
|
|
1594
|
-
var setStartTime = _useState6[1]; // const [audioCtx, setAudioCtx] = useState(null);
|
|
1595
|
-
// Refs
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
var audioRef = React.useRef(new Audio());
|
|
1599
|
-
|
|
1600
|
-
var pause = /*#__PURE__*/function () {
|
|
1601
|
-
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
1602
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
1603
|
-
while (1) {
|
|
1604
|
-
switch (_context.prev = _context.next) {
|
|
1605
|
-
case 0:
|
|
1606
|
-
setPlayState("paused");
|
|
1607
|
-
_context.next = 3;
|
|
1608
|
-
return audioRef.current.pause();
|
|
1609
|
-
|
|
1610
|
-
case 3:
|
|
1611
|
-
case "end":
|
|
1612
|
-
return _context.stop();
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
}, _callee);
|
|
1616
|
-
}));
|
|
1617
|
-
|
|
1618
|
-
return function pause() {
|
|
1619
|
-
return _ref2.apply(this, arguments);
|
|
1620
|
-
};
|
|
1621
|
-
}();
|
|
1622
|
-
|
|
1623
|
-
var play = /*#__PURE__*/function () {
|
|
1624
|
-
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
|
1625
|
-
var _bite$audio, _bite$audio$mp;
|
|
1626
|
-
|
|
1627
|
-
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, audioCtx, gainNode, source;
|
|
1628
|
-
|
|
1629
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
1630
|
-
while (1) {
|
|
1631
|
-
switch (_context3.prev = _context3.next) {
|
|
1632
|
-
case 0:
|
|
1633
|
-
bite = _ref3.bite, _ref3$gain = _ref3.gain, gain = _ref3$gain === void 0 ? 1 : _ref3$gain, _ref3$startTime = _ref3.startTime, startTime = _ref3$startTime === void 0 ? 0 : _ref3$startTime, _ref3$forcePlay = _ref3.forcePlay, forcePlay = _ref3$forcePlay === void 0 ? false : _ref3$forcePlay;
|
|
1634
|
-
console.log("astats", startTime, playState);
|
|
1635
|
-
startTime = audioRef.current.currentTime > 0 ? audioRef.current.currentTime : startTime;
|
|
1636
|
-
console.log("play", playState, startTime);
|
|
1637
|
-
|
|
1638
|
-
if (!((bite === null || bite === void 0 ? void 0 : bite._id) !== (selectedBlerp === null || selectedBlerp === void 0 ? void 0 : selectedBlerp._id) && playState === "playing")) {
|
|
1639
|
-
_context3.next = 8;
|
|
1640
|
-
break;
|
|
1641
|
-
}
|
|
1642
|
-
|
|
1643
|
-
_context3.next = 7;
|
|
1644
|
-
return audioRef.current.pause();
|
|
1645
|
-
|
|
1646
|
-
case 7:
|
|
1647
|
-
if (!forcePlay) {
|
|
1648
|
-
startTime = 0;
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
case 8:
|
|
1652
|
-
if (!(playState === "playing" && (bite === null || bite === void 0 ? void 0 : bite._id) === (selectedBlerp === null || selectedBlerp === void 0 ? void 0 : selectedBlerp._id))) {
|
|
1653
|
-
_context3.next = 11;
|
|
1654
|
-
break;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
pause();
|
|
1658
|
-
return _context3.abrupt("return");
|
|
1659
|
-
|
|
1660
|
-
case 11:
|
|
1661
|
-
audioRef.current = new Audio(bite === null || bite === void 0 ? void 0 : (_bite$audio = bite.audio) === null || _bite$audio === void 0 ? void 0 : (_bite$audio$mp = _bite$audio.mp3) === null || _bite$audio$mp === void 0 ? void 0 : _bite$audio$mp.url);
|
|
1662
|
-
audioRef.current.crossOrigin = "anonymous";
|
|
1663
|
-
console.log("current time", startTime);
|
|
1664
|
-
audioRef.current.currentTime = startTime;
|
|
1665
|
-
newGain = gain;
|
|
1666
|
-
audioRef.current.onended = /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
1667
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
1668
|
-
while (1) {
|
|
1669
|
-
switch (_context2.prev = _context2.next) {
|
|
1670
|
-
case 0:
|
|
1671
|
-
console.log("ended");
|
|
1672
|
-
setPlayState("played");
|
|
1673
|
-
_context2.next = 4;
|
|
1674
|
-
return audioRef.current.pause();
|
|
1675
|
-
|
|
1676
|
-
case 4:
|
|
1677
|
-
audioRef.current.currentTime = 0;
|
|
1678
|
-
|
|
1679
|
-
case 5:
|
|
1680
|
-
case "end":
|
|
1681
|
-
return _context2.stop();
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
}, _callee2);
|
|
1685
|
-
}));
|
|
1686
|
-
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
1687
|
-
gainNode = audioCtx.createGain(); // gainNode.gain.value = 2 // value between 0 and 2 https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API
|
|
1688
|
-
|
|
1689
|
-
gainNode.gain.setValueAtTime(newGain, 0);
|
|
1690
|
-
source = audioCtx.createMediaElementSource(audioRef.current);
|
|
1691
|
-
source.connect(gainNode);
|
|
1692
|
-
gainNode.connect(audioCtx.destination);
|
|
1693
|
-
_context3.next = 25;
|
|
1694
|
-
return audioRef.current.play().then(function () {
|
|
1695
|
-
console.log("playing", bite === null || bite === void 0 ? void 0 : bite.title);
|
|
1696
|
-
setPlayState("playing");
|
|
1697
|
-
}).catch(function (e) {
|
|
1698
|
-
setPlayState("stopped");
|
|
1699
|
-
});
|
|
1700
|
-
|
|
1701
|
-
case 25:
|
|
1702
|
-
// const playPromise = audioRef.current.play();
|
|
1703
|
-
// if (playPromise !== undefined) {
|
|
1704
|
-
// playPromise
|
|
1705
|
-
// .then((_) => {
|
|
1706
|
-
// // Automatic playback started!
|
|
1707
|
-
// // Show playing UI.
|
|
1708
|
-
// setPlayState("playing");
|
|
1709
|
-
// })
|
|
1710
|
-
// .catch((error) => {
|
|
1711
|
-
// // Auto-play was prevented
|
|
1712
|
-
// // Show paused UI.
|
|
1713
|
-
// console.log("playing failed witihin", error);
|
|
1714
|
-
// });
|
|
1715
|
-
// }
|
|
1716
|
-
_setSelectedBlerp(bite);
|
|
1717
|
-
|
|
1718
|
-
case 26:
|
|
1719
|
-
case "end":
|
|
1720
|
-
return _context3.stop();
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
}, _callee3);
|
|
1724
|
-
}));
|
|
1725
|
-
|
|
1726
|
-
return function play(_x) {
|
|
1727
|
-
return _ref4.apply(this, arguments);
|
|
1728
|
-
};
|
|
1729
|
-
}();
|
|
1730
|
-
|
|
1731
|
-
return /*#__PURE__*/React__default['default'].createElement(BlerpAudioContext.Provider, {
|
|
1732
|
-
value: {
|
|
1733
|
-
selectedBlerp: selectedBlerp,
|
|
1734
|
-
setSelectedBlerp: function setSelectedBlerp(_ref6) {
|
|
1735
|
-
var bite = _ref6.bite;
|
|
1736
|
-
|
|
1737
|
-
_setSelectedBlerp(bite);
|
|
1738
|
-
},
|
|
1739
|
-
pause: pause,
|
|
1740
|
-
play: play,
|
|
1741
|
-
stop: function () {
|
|
1742
|
-
var _stop = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
|
|
1743
|
-
var _audioRef$current;
|
|
1744
|
-
|
|
1745
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
1746
|
-
while (1) {
|
|
1747
|
-
switch (_context4.prev = _context4.next) {
|
|
1748
|
-
case 0:
|
|
1749
|
-
setPlayState("stopped");
|
|
1750
|
-
_context4.next = 3;
|
|
1751
|
-
return (_audioRef$current = audioRef.current) === null || _audioRef$current === void 0 ? void 0 : _audioRef$current.pause();
|
|
1752
|
-
|
|
1753
|
-
case 3:
|
|
1754
|
-
audioRef.current.currentTime = 0;
|
|
1755
|
-
|
|
1756
|
-
case 4:
|
|
1757
|
-
case "end":
|
|
1758
|
-
return _context4.stop();
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
}, _callee4);
|
|
1762
|
-
}));
|
|
1763
|
-
|
|
1764
|
-
function stop() {
|
|
1765
|
-
return _stop.apply(this, arguments);
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
return stop;
|
|
1769
|
-
}(),
|
|
1770
|
-
getPlayState: function getPlayState(_ref7) {
|
|
1771
|
-
var biteId = _ref7.biteId;
|
|
1772
|
-
|
|
1773
|
-
if (biteId === (selectedBlerp && selectedBlerp._id)) {
|
|
1774
|
-
return playState;
|
|
1775
|
-
}
|
|
1776
|
-
},
|
|
1777
|
-
setStartTime: setStartTime
|
|
1778
|
-
}
|
|
1779
|
-
}, children);
|
|
1780
|
-
};
|
|
1781
|
-
|
|
1782
1573
|
var _templateObject$f, _templateObject2$a;
|
|
1783
1574
|
var PremiumContainer = styled__default['default'].div(_templateObject$f || (_templateObject$f = _taggedTemplateLiteral__default['default'](["\n background: transparent;\n overflow: hidden;\n min-width: 210px;\n max-width: 260px;\n width: 100%;\n max-height: 322px;\n flex: 1;\n min-height: 272px;\n margin: 20px;\n aspect-ratio: 260 / 322;\n gap: 10px;\n border-radius: 18px;\n box-sizing: border-box;\n padding: 2px;\n position: relative;\n transition: 0.3s;\n"])));
|
|
1784
1575
|
var Container$1 = styled__default['default'].div(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteral__default['default'](["\n background-color: ", ";\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n position: relative;\n height: 100%;\n padding: 10px;\n border-radius: 17px;\n box-sizing: border-box;\n"])), function (props) {
|
|
@@ -2188,13 +1979,9 @@ var NewBlerp$1 = function NewBlerp(_ref8) {
|
|
|
2188
1979
|
|
|
2189
1980
|
var _ref8$Waveform = _ref8.Waveform,
|
|
2190
1981
|
Waveform = _ref8$Waveform === void 0 ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null) : _ref8$Waveform,
|
|
2191
|
-
bite = _ref8.bite
|
|
2192
|
-
_ref8.playState
|
|
2193
|
-
|
|
2194
|
-
var _useContext = React.useContext(BlerpAudioContext),
|
|
2195
|
-
play = _useContext.play,
|
|
2196
|
-
getPlayState = _useContext.getPlayState;
|
|
2197
|
-
_useContext.stop;
|
|
1982
|
+
bite = _ref8.bite,
|
|
1983
|
+
playState = _ref8.playState,
|
|
1984
|
+
play = _ref8.play;
|
|
2198
1985
|
|
|
2199
1986
|
var _useState9 = React.useState(false),
|
|
2200
1987
|
_useState10 = _slicedToArray__default['default'](_useState9, 2),
|
|
@@ -2212,10 +1999,6 @@ var NewBlerp$1 = function NewBlerp(_ref8) {
|
|
|
2212
1999
|
var saveCount = formatter.format(bite === null || bite === void 0 ? void 0 : bite.totalSaveCount);
|
|
2213
2000
|
|
|
2214
2001
|
var renderPlayStateIcon = function renderPlayStateIcon() {
|
|
2215
|
-
var playState = getPlayState({
|
|
2216
|
-
biteId: bite === null || bite === void 0 ? void 0 : bite._id
|
|
2217
|
-
});
|
|
2218
|
-
|
|
2219
2002
|
if (playState === "played") {
|
|
2220
2003
|
return /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
2221
2004
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2467,6 +2250,211 @@ var NewBlerp$1 = function NewBlerp(_ref8) {
|
|
|
2467
2250
|
}, ((bite === null || bite === void 0 ? void 0 : bite.audioDuration) / 1000).toFixed(0), "s"))));
|
|
2468
2251
|
};
|
|
2469
2252
|
|
|
2253
|
+
var BlerpAudioContext = /*#__PURE__*/React.createContext({});
|
|
2254
|
+
var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
2255
|
+
var children = _ref.children;
|
|
2256
|
+
|
|
2257
|
+
var _useState = React.useState(null),
|
|
2258
|
+
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
2259
|
+
selectedBlerp = _useState2[0],
|
|
2260
|
+
_setSelectedBlerp = _useState2[1];
|
|
2261
|
+
|
|
2262
|
+
var _useState3 = React.useState("stopped"),
|
|
2263
|
+
_useState4 = _slicedToArray__default['default'](_useState3, 2),
|
|
2264
|
+
playState = _useState4[0],
|
|
2265
|
+
setPlayState = _useState4[1];
|
|
2266
|
+
|
|
2267
|
+
var _useState5 = React.useState(0),
|
|
2268
|
+
_useState6 = _slicedToArray__default['default'](_useState5, 2);
|
|
2269
|
+
_useState6[0];
|
|
2270
|
+
var setStartTime = _useState6[1]; // const [audioCtx, setAudioCtx] = useState(null);
|
|
2271
|
+
// Refs
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
var audioRef = React.useRef(null);
|
|
2275
|
+
|
|
2276
|
+
var pause = /*#__PURE__*/function () {
|
|
2277
|
+
var _ref2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2278
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
2279
|
+
while (1) {
|
|
2280
|
+
switch (_context.prev = _context.next) {
|
|
2281
|
+
case 0:
|
|
2282
|
+
setPlayState("paused");
|
|
2283
|
+
_context.next = 3;
|
|
2284
|
+
return audioRef.current.pause();
|
|
2285
|
+
|
|
2286
|
+
case 3:
|
|
2287
|
+
case "end":
|
|
2288
|
+
return _context.stop();
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
}, _callee);
|
|
2292
|
+
}));
|
|
2293
|
+
|
|
2294
|
+
return function pause() {
|
|
2295
|
+
return _ref2.apply(this, arguments);
|
|
2296
|
+
};
|
|
2297
|
+
}();
|
|
2298
|
+
|
|
2299
|
+
var play = /*#__PURE__*/function () {
|
|
2300
|
+
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
|
2301
|
+
var _bite$audio, _bite$audio$mp;
|
|
2302
|
+
|
|
2303
|
+
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, audioCtx, gainNode, source;
|
|
2304
|
+
|
|
2305
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
2306
|
+
while (1) {
|
|
2307
|
+
switch (_context3.prev = _context3.next) {
|
|
2308
|
+
case 0:
|
|
2309
|
+
bite = _ref3.bite, _ref3$gain = _ref3.gain, gain = _ref3$gain === void 0 ? 1 : _ref3$gain, _ref3$startTime = _ref3.startTime, startTime = _ref3$startTime === void 0 ? 0 : _ref3$startTime, _ref3$forcePlay = _ref3.forcePlay, forcePlay = _ref3$forcePlay === void 0 ? false : _ref3$forcePlay;
|
|
2310
|
+
console.log("astats", startTime, playState);
|
|
2311
|
+
startTime = audioRef.current.currentTime > 0 ? audioRef.current.currentTime : startTime;
|
|
2312
|
+
console.log("play", playState, startTime);
|
|
2313
|
+
|
|
2314
|
+
if (!((bite === null || bite === void 0 ? void 0 : bite._id) !== (selectedBlerp === null || selectedBlerp === void 0 ? void 0 : selectedBlerp._id) && playState === "playing")) {
|
|
2315
|
+
_context3.next = 8;
|
|
2316
|
+
break;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
_context3.next = 7;
|
|
2320
|
+
return audioRef.current.pause();
|
|
2321
|
+
|
|
2322
|
+
case 7:
|
|
2323
|
+
if (!forcePlay) {
|
|
2324
|
+
startTime = 0;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
case 8:
|
|
2328
|
+
if (!(playState === "playing" && (bite === null || bite === void 0 ? void 0 : bite._id) === (selectedBlerp === null || selectedBlerp === void 0 ? void 0 : selectedBlerp._id))) {
|
|
2329
|
+
_context3.next = 11;
|
|
2330
|
+
break;
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
pause();
|
|
2334
|
+
return _context3.abrupt("return");
|
|
2335
|
+
|
|
2336
|
+
case 11:
|
|
2337
|
+
audioRef.current = new Audio(bite === null || bite === void 0 ? void 0 : (_bite$audio = bite.audio) === null || _bite$audio === void 0 ? void 0 : (_bite$audio$mp = _bite$audio.mp3) === null || _bite$audio$mp === void 0 ? void 0 : _bite$audio$mp.url);
|
|
2338
|
+
audioRef.current.crossOrigin = "anonymous";
|
|
2339
|
+
console.log("current time", startTime);
|
|
2340
|
+
audioRef.current.currentTime = startTime;
|
|
2341
|
+
newGain = gain;
|
|
2342
|
+
audioRef.current.onended = /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
2343
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
2344
|
+
while (1) {
|
|
2345
|
+
switch (_context2.prev = _context2.next) {
|
|
2346
|
+
case 0:
|
|
2347
|
+
console.log("ended");
|
|
2348
|
+
setPlayState("played");
|
|
2349
|
+
_context2.next = 4;
|
|
2350
|
+
return audioRef.current.pause();
|
|
2351
|
+
|
|
2352
|
+
case 4:
|
|
2353
|
+
audioRef.current.currentTime = 0;
|
|
2354
|
+
|
|
2355
|
+
case 5:
|
|
2356
|
+
case "end":
|
|
2357
|
+
return _context2.stop();
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
}, _callee2);
|
|
2361
|
+
}));
|
|
2362
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
2363
|
+
gainNode = audioCtx.createGain(); // gainNode.gain.value = 2 // value between 0 and 2 https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API
|
|
2364
|
+
|
|
2365
|
+
gainNode.gain.setValueAtTime(newGain, 0);
|
|
2366
|
+
source = audioCtx.createMediaElementSource(audioRef.current);
|
|
2367
|
+
source.connect(gainNode);
|
|
2368
|
+
gainNode.connect(audioCtx.destination);
|
|
2369
|
+
_context3.next = 25;
|
|
2370
|
+
return audioRef.current.play().then(function () {
|
|
2371
|
+
console.log("playing", bite === null || bite === void 0 ? void 0 : bite.title);
|
|
2372
|
+
setPlayState("playing");
|
|
2373
|
+
}).catch(function (e) {
|
|
2374
|
+
setPlayState("stopped");
|
|
2375
|
+
});
|
|
2376
|
+
|
|
2377
|
+
case 25:
|
|
2378
|
+
// const playPromise = audioRef.current.play();
|
|
2379
|
+
// if (playPromise !== undefined) {
|
|
2380
|
+
// playPromise
|
|
2381
|
+
// .then((_) => {
|
|
2382
|
+
// // Automatic playback started!
|
|
2383
|
+
// // Show playing UI.
|
|
2384
|
+
// setPlayState("playing");
|
|
2385
|
+
// })
|
|
2386
|
+
// .catch((error) => {
|
|
2387
|
+
// // Auto-play was prevented
|
|
2388
|
+
// // Show paused UI.
|
|
2389
|
+
// console.log("playing failed witihin", error);
|
|
2390
|
+
// });
|
|
2391
|
+
// }
|
|
2392
|
+
_setSelectedBlerp(bite);
|
|
2393
|
+
|
|
2394
|
+
case 26:
|
|
2395
|
+
case "end":
|
|
2396
|
+
return _context3.stop();
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
}, _callee3);
|
|
2400
|
+
}));
|
|
2401
|
+
|
|
2402
|
+
return function play(_x) {
|
|
2403
|
+
return _ref4.apply(this, arguments);
|
|
2404
|
+
};
|
|
2405
|
+
}();
|
|
2406
|
+
|
|
2407
|
+
return /*#__PURE__*/React__default['default'].createElement(BlerpAudioContext.Provider, {
|
|
2408
|
+
value: {
|
|
2409
|
+
selectedBlerp: selectedBlerp,
|
|
2410
|
+
setSelectedBlerp: function setSelectedBlerp(_ref6) {
|
|
2411
|
+
var bite = _ref6.bite;
|
|
2412
|
+
|
|
2413
|
+
_setSelectedBlerp(bite);
|
|
2414
|
+
},
|
|
2415
|
+
pause: pause,
|
|
2416
|
+
play: play,
|
|
2417
|
+
stop: function () {
|
|
2418
|
+
var _stop = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4() {
|
|
2419
|
+
var _audioRef$current;
|
|
2420
|
+
|
|
2421
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
2422
|
+
while (1) {
|
|
2423
|
+
switch (_context4.prev = _context4.next) {
|
|
2424
|
+
case 0:
|
|
2425
|
+
setPlayState("stopped");
|
|
2426
|
+
_context4.next = 3;
|
|
2427
|
+
return (_audioRef$current = audioRef.current) === null || _audioRef$current === void 0 ? void 0 : _audioRef$current.pause();
|
|
2428
|
+
|
|
2429
|
+
case 3:
|
|
2430
|
+
audioRef.current.currentTime = 0;
|
|
2431
|
+
|
|
2432
|
+
case 4:
|
|
2433
|
+
case "end":
|
|
2434
|
+
return _context4.stop();
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}, _callee4);
|
|
2438
|
+
}));
|
|
2439
|
+
|
|
2440
|
+
function stop() {
|
|
2441
|
+
return _stop.apply(this, arguments);
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
return stop;
|
|
2445
|
+
}(),
|
|
2446
|
+
getPlayState: function getPlayState(_ref7) {
|
|
2447
|
+
var biteId = _ref7.biteId;
|
|
2448
|
+
|
|
2449
|
+
if (biteId === (selectedBlerp && selectedBlerp._id)) {
|
|
2450
|
+
return playState;
|
|
2451
|
+
}
|
|
2452
|
+
},
|
|
2453
|
+
setStartTime: setStartTime
|
|
2454
|
+
}
|
|
2455
|
+
}, children);
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2470
2458
|
var _templateObject$e, _templateObject2$9, _templateObject3$7, _templateObject4$6, _templateObject5$4, _templateObject6$4, _templateObject7$2;
|
|
2471
2459
|
var BlerpImage$1 = styled__default['default'].div(_templateObject$e || (_templateObject$e = _taggedTemplateLiteral__default['default'](["\n height: 150px;\n width: 150px;\n background-image: url(", ");\n background-size: cover;\n border-radius: 50%;\n position: relative;\n transition: 0.2s;\n\n &:hover {\n transform: scale(1.1);\n }\n"])), function (props) {
|
|
2472
2460
|
return props.url;
|
|
@@ -5759,7 +5747,7 @@ var BlerpTheme = function BlerpTheme(_ref) {
|
|
|
5759
5747
|
icons: icons,
|
|
5760
5748
|
mode: mode === "dark" ? "dark" : "light"
|
|
5761
5749
|
}, currentTheme)
|
|
5762
|
-
}, /*#__PURE__*/React__default['default'].createElement(SnackbarProvider, null,
|
|
5750
|
+
}, /*#__PURE__*/React__default['default'].createElement(SnackbarProvider, null, children)));
|
|
5763
5751
|
};
|
|
5764
5752
|
|
|
5765
5753
|
var LottieAnimation = function LottieAnimation(_ref) {
|