@blerp/design 1.2.7 → 1.2.8
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 +114 -72
- package/dist/index.esm.js +112 -68
- package/dist/index.umd.js +114 -72
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -12,8 +12,10 @@ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiter
|
|
|
12
12
|
var iconsMaterial = require('@mui/icons-material');
|
|
13
13
|
var BookmarkOutlinedIcon = require('@mui/icons-material/BookmarkOutlined');
|
|
14
14
|
var LockRoundedIcon = require('@mui/icons-material/LockRounded');
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
17
|
+
require('@blerp/wavesurfer');
|
|
18
|
+
require('@blerp/wavesurfer/dist/plugin/wavesurfer.cursor.min.js');
|
|
17
19
|
var AddRoundedIcon = require('@mui/icons-material/AddRounded');
|
|
18
20
|
var ArrowDropDownRoundedIcon = require('@mui/icons-material/ArrowDropDownRounded');
|
|
19
21
|
var FavoriteIcon = require('@mui/icons-material/Favorite');
|
|
@@ -22,8 +24,6 @@ var PauseRoundedIcon = require('@mui/icons-material/PauseRounded');
|
|
|
22
24
|
var PlayArrowRoundedIcon = require('@mui/icons-material/PlayArrowRounded');
|
|
23
25
|
var WarningRoundedIcon = require('@mui/icons-material/WarningRounded');
|
|
24
26
|
require('@mui/icons-material/DoNotDisturbRounded');
|
|
25
|
-
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
26
|
-
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
27
27
|
var BookmarkAddOutlinedIcon = require('@mui/icons-material/BookmarkAddOutlined');
|
|
28
28
|
var MoreHorizRoundedIcon = require('@mui/icons-material/MoreHorizRounded');
|
|
29
29
|
var reactPalette = require('react-palette');
|
|
@@ -91,8 +91,8 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
91
91
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
92
92
|
var BookmarkOutlinedIcon__default = /*#__PURE__*/_interopDefaultLegacy(BookmarkOutlinedIcon);
|
|
93
93
|
var LockRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(LockRoundedIcon);
|
|
94
|
-
var
|
|
95
|
-
var
|
|
94
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
95
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
96
96
|
var AddRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddRoundedIcon);
|
|
97
97
|
var ArrowDropDownRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDropDownRoundedIcon);
|
|
98
98
|
var FavoriteIcon__default = /*#__PURE__*/_interopDefaultLegacy(FavoriteIcon);
|
|
@@ -100,8 +100,6 @@ var FavoriteBorderIcon__default = /*#__PURE__*/_interopDefaultLegacy(FavoriteBor
|
|
|
100
100
|
var PauseRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(PauseRoundedIcon);
|
|
101
101
|
var PlayArrowRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(PlayArrowRoundedIcon);
|
|
102
102
|
var WarningRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(WarningRoundedIcon);
|
|
103
|
-
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
104
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
105
103
|
var BookmarkAddOutlinedIcon__default = /*#__PURE__*/_interopDefaultLegacy(BookmarkAddOutlinedIcon);
|
|
106
104
|
var MoreHorizRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(MoreHorizRoundedIcon);
|
|
107
105
|
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
@@ -1577,7 +1575,10 @@ Blerp$1.propTypes = {
|
|
|
1577
1575
|
var BlerpAudioContext = /*#__PURE__*/React.createContext({});
|
|
1578
1576
|
var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
1579
1577
|
var children = _ref.children;
|
|
1580
|
-
|
|
1578
|
+
|
|
1579
|
+
if (typeof window === "undefined") {
|
|
1580
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, children);
|
|
1581
|
+
}
|
|
1581
1582
|
|
|
1582
1583
|
var _useState = React.useState(null),
|
|
1583
1584
|
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
@@ -1625,7 +1626,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1625
1626
|
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
|
1626
1627
|
var _bite$audio, _bite$audio$mp;
|
|
1627
1628
|
|
|
1628
|
-
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, gainNode, source;
|
|
1629
|
+
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, audioCtx, gainNode, source;
|
|
1629
1630
|
|
|
1630
1631
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
1631
1632
|
while (1) {
|
|
@@ -1684,13 +1685,14 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1684
1685
|
}
|
|
1685
1686
|
}, _callee2);
|
|
1686
1687
|
}));
|
|
1688
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
1687
1689
|
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
1690
|
|
|
1689
1691
|
gainNode.gain.setValueAtTime(newGain, 0);
|
|
1690
1692
|
source = audioCtx.createMediaElementSource(audioRef.current);
|
|
1691
1693
|
source.connect(gainNode);
|
|
1692
1694
|
gainNode.connect(audioCtx.destination);
|
|
1693
|
-
_context3.next =
|
|
1695
|
+
_context3.next = 25;
|
|
1694
1696
|
return audioRef.current.play().then(function () {
|
|
1695
1697
|
console.log("playing", bite === null || bite === void 0 ? void 0 : bite.title);
|
|
1696
1698
|
setPlayState("playing");
|
|
@@ -1698,7 +1700,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1698
1700
|
setPlayState("stopped");
|
|
1699
1701
|
});
|
|
1700
1702
|
|
|
1701
|
-
case
|
|
1703
|
+
case 25:
|
|
1702
1704
|
// const playPromise = audioRef.current.play();
|
|
1703
1705
|
// if (playPromise !== undefined) {
|
|
1704
1706
|
// playPromise
|
|
@@ -1715,7 +1717,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1715
1717
|
// }
|
|
1716
1718
|
_setSelectedBlerp(bite);
|
|
1717
1719
|
|
|
1718
|
-
case
|
|
1720
|
+
case 26:
|
|
1719
1721
|
case "end":
|
|
1720
1722
|
return _context3.stop();
|
|
1721
1723
|
}
|
|
@@ -1774,8 +1776,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1774
1776
|
return playState;
|
|
1775
1777
|
}
|
|
1776
1778
|
},
|
|
1777
|
-
setStartTime: setStartTime
|
|
1778
|
-
audioContext: audioCtx
|
|
1779
|
+
setStartTime: setStartTime
|
|
1779
1780
|
}
|
|
1780
1781
|
}, children);
|
|
1781
1782
|
};
|
|
@@ -2123,57 +2124,98 @@ var BlerpWaveform = function BlerpWaveform(_ref6) {
|
|
|
2123
2124
|
setWavesurfer = _useState8[1];
|
|
2124
2125
|
|
|
2125
2126
|
React.useEffect(function () {
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2127
|
+
var create = /*#__PURE__*/function () {
|
|
2128
|
+
var _ref7 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2129
|
+
var _WaveSurfer, _CursorPlugin, mWavesurfer;
|
|
2130
|
+
|
|
2131
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
2132
|
+
while (1) {
|
|
2133
|
+
switch (_context.prev = _context.next) {
|
|
2134
|
+
case 0:
|
|
2135
|
+
console.log("creating", hovering, wavesurfer, hasRendered);
|
|
2136
|
+
|
|
2137
|
+
if (!(hovering && wavesurfer)) {
|
|
2138
|
+
_context.next = 5;
|
|
2139
|
+
break;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
wavesurfer.load(audio);
|
|
2143
|
+
_context.next = 17;
|
|
2144
|
+
break;
|
|
2145
|
+
|
|
2146
|
+
case 5:
|
|
2147
|
+
if (!(hovering && !wavesurfer && !hasRendered && document.querySelector("#blerp-waveform-".concat(id)) && document.querySelector("#blerp-waveform-".concat(id)).children.length === 0)) {
|
|
2148
|
+
_context.next = 17;
|
|
2149
|
+
break;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
_context.next = 8;
|
|
2153
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@blerp/wavesurfer')); });
|
|
2154
|
+
|
|
2155
|
+
case 8:
|
|
2156
|
+
_WaveSurfer = _context.sent.default;
|
|
2157
|
+
_context.next = 11;
|
|
2158
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@blerp/wavesurfer/src/plugin/cursor')); });
|
|
2159
|
+
|
|
2160
|
+
case 11:
|
|
2161
|
+
_CursorPlugin = _context.sent.default;
|
|
2162
|
+
mWavesurfer = _WaveSurfer.create({
|
|
2163
|
+
container: document.querySelector("#blerp-waveform-".concat(id)),
|
|
2164
|
+
barWidth: 2,
|
|
2165
|
+
barHeight: 1.5,
|
|
2166
|
+
// the height of the wave
|
|
2167
|
+
barGap: 2,
|
|
2168
|
+
// the optional spacing between bars of the wave, if not provided will be calculated in legacy format
|
|
2169
|
+
progressColor: "#ffffff",
|
|
2170
|
+
hoverColor: "#ffffff99",
|
|
2171
|
+
barRadius: 2,
|
|
2172
|
+
height: 30,
|
|
2173
|
+
hideScrollBar: true,
|
|
2174
|
+
plugins: [_CursorPlugin.create({
|
|
2175
|
+
showTime: false,
|
|
2176
|
+
opacity: 0,
|
|
2177
|
+
customShowTimeStyle: {
|
|
2178
|
+
"background-color": "#000",
|
|
2179
|
+
color: "#fff",
|
|
2180
|
+
padding: "2px",
|
|
2181
|
+
"font-size": "10px"
|
|
2182
|
+
}
|
|
2183
|
+
})]
|
|
2184
|
+
});
|
|
2185
|
+
mWavesurfer.on("error", function (e) {
|
|
2186
|
+
console.warn(e);
|
|
2187
|
+
});
|
|
2188
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.on("seek", function (prog) {
|
|
2189
|
+
if (prog) {
|
|
2190
|
+
console.log("SEEEEEEK", prog, bite);
|
|
2191
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.setMute(true);
|
|
2192
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.play();
|
|
2193
|
+
play({
|
|
2194
|
+
bite: bite,
|
|
2195
|
+
startTime: mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.getCurrentTime(),
|
|
2196
|
+
forcePlay: true
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
}); // Load audio from URL
|
|
2200
|
+
// mWavesurfer.load(audio);
|
|
2201
|
+
|
|
2202
|
+
setWavesurfer(mWavesurfer);
|
|
2203
|
+
setHasRendered(true);
|
|
2204
|
+
|
|
2205
|
+
case 17:
|
|
2206
|
+
case "end":
|
|
2207
|
+
return _context.stop();
|
|
2168
2208
|
}
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2209
|
+
}
|
|
2210
|
+
}, _callee);
|
|
2211
|
+
}));
|
|
2171
2212
|
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2213
|
+
return function create() {
|
|
2214
|
+
return _ref7.apply(this, arguments);
|
|
2215
|
+
};
|
|
2216
|
+
}();
|
|
2217
|
+
|
|
2218
|
+
create();
|
|
2177
2219
|
}, [wavesurfer, bite, play, audio, hovering, hasRendered, id]);
|
|
2178
2220
|
React.useEffect(function () {
|
|
2179
2221
|
// if (wavesurfer && selectedBlerp?._id === bite?._id) {
|
|
@@ -2227,11 +2269,11 @@ var BlerpWaveform = function BlerpWaveform(_ref6) {
|
|
|
2227
2269
|
});
|
|
2228
2270
|
};
|
|
2229
2271
|
|
|
2230
|
-
var ReportedWarning = function ReportedWarning(
|
|
2231
|
-
var showWarning =
|
|
2232
|
-
saved =
|
|
2233
|
-
count =
|
|
2234
|
-
onClick =
|
|
2272
|
+
var ReportedWarning = function ReportedWarning(_ref9) {
|
|
2273
|
+
var showWarning = _ref9.showWarning,
|
|
2274
|
+
saved = _ref9.saved,
|
|
2275
|
+
count = _ref9.count,
|
|
2276
|
+
onClick = _ref9.onClick;
|
|
2235
2277
|
|
|
2236
2278
|
var _useState9 = React.useState(showWarning),
|
|
2237
2279
|
_useState10 = _slicedToArray__default['default'](_useState9, 2),
|
|
@@ -2312,11 +2354,11 @@ var ReportedWarning = function ReportedWarning(_ref8) {
|
|
|
2312
2354
|
})), renderInfo());
|
|
2313
2355
|
};
|
|
2314
2356
|
|
|
2315
|
-
var NewBlerp$1 = function NewBlerp(
|
|
2357
|
+
var NewBlerp$1 = function NewBlerp(_ref10) {
|
|
2316
2358
|
var _bite$image, _bite$image$original, _bite$ownerObject;
|
|
2317
2359
|
|
|
2318
|
-
var bite =
|
|
2319
|
-
|
|
2360
|
+
var bite = _ref10.bite;
|
|
2361
|
+
_ref10.playState;
|
|
2320
2362
|
|
|
2321
2363
|
var _useContext2 = React.useContext(BlerpAudioContext),
|
|
2322
2364
|
play = _useContext2.play,
|
package/dist/index.esm.js
CHANGED
|
@@ -9,8 +9,10 @@ import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
9
9
|
import { PauseCircleOutlineRounded, LockRounded, CheckRounded, CloseRounded, BookmarkRounded, BookmarkAddOutlined, AccountCircleRounded, VisibilityOffRounded, CancelRounded } from '@mui/icons-material';
|
|
10
10
|
import BookmarkOutlinedIcon from '@mui/icons-material/BookmarkOutlined';
|
|
11
11
|
import LockRoundedIcon from '@mui/icons-material/LockRounded';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
13
|
+
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
14
|
+
import '@blerp/wavesurfer';
|
|
15
|
+
import '@blerp/wavesurfer/dist/plugin/wavesurfer.cursor.min.js';
|
|
14
16
|
import AddRoundedIcon from '@mui/icons-material/AddRounded';
|
|
15
17
|
import ArrowDropDownRoundedIcon from '@mui/icons-material/ArrowDropDownRounded';
|
|
16
18
|
import FavoriteIcon from '@mui/icons-material/Favorite';
|
|
@@ -19,8 +21,6 @@ import PauseRoundedIcon from '@mui/icons-material/PauseRounded';
|
|
|
19
21
|
import PlayArrowRoundedIcon from '@mui/icons-material/PlayArrowRounded';
|
|
20
22
|
import WarningRoundedIcon from '@mui/icons-material/WarningRounded';
|
|
21
23
|
import '@mui/icons-material/DoNotDisturbRounded';
|
|
22
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
23
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
24
24
|
import BookmarkAddOutlinedIcon from '@mui/icons-material/BookmarkAddOutlined';
|
|
25
25
|
import MoreHorizRoundedIcon from '@mui/icons-material/MoreHorizRounded';
|
|
26
26
|
import { usePalette } from 'react-palette';
|
|
@@ -1500,7 +1500,10 @@ Blerp$1.propTypes = {
|
|
|
1500
1500
|
var BlerpAudioContext = /*#__PURE__*/createContext({});
|
|
1501
1501
|
var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
1502
1502
|
var children = _ref.children;
|
|
1503
|
-
|
|
1503
|
+
|
|
1504
|
+
if (typeof window === "undefined") {
|
|
1505
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
|
|
1506
|
+
}
|
|
1504
1507
|
|
|
1505
1508
|
var _useState = useState(null),
|
|
1506
1509
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -1548,7 +1551,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1548
1551
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
|
|
1549
1552
|
var _bite$audio, _bite$audio$mp;
|
|
1550
1553
|
|
|
1551
|
-
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, gainNode, source;
|
|
1554
|
+
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, audioCtx, gainNode, source;
|
|
1552
1555
|
|
|
1553
1556
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
1554
1557
|
while (1) {
|
|
@@ -1607,13 +1610,14 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1607
1610
|
}
|
|
1608
1611
|
}, _callee2);
|
|
1609
1612
|
}));
|
|
1613
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
1610
1614
|
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
|
|
1611
1615
|
|
|
1612
1616
|
gainNode.gain.setValueAtTime(newGain, 0);
|
|
1613
1617
|
source = audioCtx.createMediaElementSource(audioRef.current);
|
|
1614
1618
|
source.connect(gainNode);
|
|
1615
1619
|
gainNode.connect(audioCtx.destination);
|
|
1616
|
-
_context3.next =
|
|
1620
|
+
_context3.next = 25;
|
|
1617
1621
|
return audioRef.current.play().then(function () {
|
|
1618
1622
|
console.log("playing", bite === null || bite === void 0 ? void 0 : bite.title);
|
|
1619
1623
|
setPlayState("playing");
|
|
@@ -1621,7 +1625,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1621
1625
|
setPlayState("stopped");
|
|
1622
1626
|
});
|
|
1623
1627
|
|
|
1624
|
-
case
|
|
1628
|
+
case 25:
|
|
1625
1629
|
// const playPromise = audioRef.current.play();
|
|
1626
1630
|
// if (playPromise !== undefined) {
|
|
1627
1631
|
// playPromise
|
|
@@ -1638,7 +1642,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1638
1642
|
// }
|
|
1639
1643
|
_setSelectedBlerp(bite);
|
|
1640
1644
|
|
|
1641
|
-
case
|
|
1645
|
+
case 26:
|
|
1642
1646
|
case "end":
|
|
1643
1647
|
return _context3.stop();
|
|
1644
1648
|
}
|
|
@@ -1697,8 +1701,7 @@ var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
|
1697
1701
|
return playState;
|
|
1698
1702
|
}
|
|
1699
1703
|
},
|
|
1700
|
-
setStartTime: setStartTime
|
|
1701
|
-
audioContext: audioCtx
|
|
1704
|
+
setStartTime: setStartTime
|
|
1702
1705
|
}
|
|
1703
1706
|
}, children);
|
|
1704
1707
|
};
|
|
@@ -2046,57 +2049,98 @@ var BlerpWaveform = function BlerpWaveform(_ref6) {
|
|
|
2046
2049
|
setWavesurfer = _useState8[1];
|
|
2047
2050
|
|
|
2048
2051
|
useEffect(function () {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2052
|
+
var create = /*#__PURE__*/function () {
|
|
2053
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
2054
|
+
var _WaveSurfer, _CursorPlugin, mWavesurfer;
|
|
2055
|
+
|
|
2056
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
2057
|
+
while (1) {
|
|
2058
|
+
switch (_context.prev = _context.next) {
|
|
2059
|
+
case 0:
|
|
2060
|
+
console.log("creating", hovering, wavesurfer, hasRendered);
|
|
2061
|
+
|
|
2062
|
+
if (!(hovering && wavesurfer)) {
|
|
2063
|
+
_context.next = 5;
|
|
2064
|
+
break;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
wavesurfer.load(audio);
|
|
2068
|
+
_context.next = 17;
|
|
2069
|
+
break;
|
|
2070
|
+
|
|
2071
|
+
case 5:
|
|
2072
|
+
if (!(hovering && !wavesurfer && !hasRendered && document.querySelector("#blerp-waveform-".concat(id)) && document.querySelector("#blerp-waveform-".concat(id)).children.length === 0)) {
|
|
2073
|
+
_context.next = 17;
|
|
2074
|
+
break;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
_context.next = 8;
|
|
2078
|
+
return import('@blerp/wavesurfer');
|
|
2079
|
+
|
|
2080
|
+
case 8:
|
|
2081
|
+
_WaveSurfer = _context.sent.default;
|
|
2082
|
+
_context.next = 11;
|
|
2083
|
+
return import('@blerp/wavesurfer/src/plugin/cursor');
|
|
2084
|
+
|
|
2085
|
+
case 11:
|
|
2086
|
+
_CursorPlugin = _context.sent.default;
|
|
2087
|
+
mWavesurfer = _WaveSurfer.create({
|
|
2088
|
+
container: document.querySelector("#blerp-waveform-".concat(id)),
|
|
2089
|
+
barWidth: 2,
|
|
2090
|
+
barHeight: 1.5,
|
|
2091
|
+
// the height of the wave
|
|
2092
|
+
barGap: 2,
|
|
2093
|
+
// the optional spacing between bars of the wave, if not provided will be calculated in legacy format
|
|
2094
|
+
progressColor: "#ffffff",
|
|
2095
|
+
hoverColor: "#ffffff99",
|
|
2096
|
+
barRadius: 2,
|
|
2097
|
+
height: 30,
|
|
2098
|
+
hideScrollBar: true,
|
|
2099
|
+
plugins: [_CursorPlugin.create({
|
|
2100
|
+
showTime: false,
|
|
2101
|
+
opacity: 0,
|
|
2102
|
+
customShowTimeStyle: {
|
|
2103
|
+
"background-color": "#000",
|
|
2104
|
+
color: "#fff",
|
|
2105
|
+
padding: "2px",
|
|
2106
|
+
"font-size": "10px"
|
|
2107
|
+
}
|
|
2108
|
+
})]
|
|
2109
|
+
});
|
|
2110
|
+
mWavesurfer.on("error", function (e) {
|
|
2111
|
+
console.warn(e);
|
|
2112
|
+
});
|
|
2113
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.on("seek", function (prog) {
|
|
2114
|
+
if (prog) {
|
|
2115
|
+
console.log("SEEEEEEK", prog, bite);
|
|
2116
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.setMute(true);
|
|
2117
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.play();
|
|
2118
|
+
play({
|
|
2119
|
+
bite: bite,
|
|
2120
|
+
startTime: mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.getCurrentTime(),
|
|
2121
|
+
forcePlay: true
|
|
2122
|
+
});
|
|
2123
|
+
}
|
|
2124
|
+
}); // Load audio from URL
|
|
2125
|
+
// mWavesurfer.load(audio);
|
|
2126
|
+
|
|
2127
|
+
setWavesurfer(mWavesurfer);
|
|
2128
|
+
setHasRendered(true);
|
|
2129
|
+
|
|
2130
|
+
case 17:
|
|
2131
|
+
case "end":
|
|
2132
|
+
return _context.stop();
|
|
2091
2133
|
}
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2134
|
+
}
|
|
2135
|
+
}, _callee);
|
|
2136
|
+
}));
|
|
2094
2137
|
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2138
|
+
return function create() {
|
|
2139
|
+
return _ref7.apply(this, arguments);
|
|
2140
|
+
};
|
|
2141
|
+
}();
|
|
2142
|
+
|
|
2143
|
+
create();
|
|
2100
2144
|
}, [wavesurfer, bite, play, audio, hovering, hasRendered, id]);
|
|
2101
2145
|
useEffect(function () {
|
|
2102
2146
|
// if (wavesurfer && selectedBlerp?._id === bite?._id) {
|
|
@@ -2150,11 +2194,11 @@ var BlerpWaveform = function BlerpWaveform(_ref6) {
|
|
|
2150
2194
|
});
|
|
2151
2195
|
};
|
|
2152
2196
|
|
|
2153
|
-
var ReportedWarning = function ReportedWarning(
|
|
2154
|
-
var showWarning =
|
|
2155
|
-
saved =
|
|
2156
|
-
count =
|
|
2157
|
-
onClick =
|
|
2197
|
+
var ReportedWarning = function ReportedWarning(_ref9) {
|
|
2198
|
+
var showWarning = _ref9.showWarning,
|
|
2199
|
+
saved = _ref9.saved,
|
|
2200
|
+
count = _ref9.count,
|
|
2201
|
+
onClick = _ref9.onClick;
|
|
2158
2202
|
|
|
2159
2203
|
var _useState9 = useState(showWarning),
|
|
2160
2204
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
@@ -2235,11 +2279,11 @@ var ReportedWarning = function ReportedWarning(_ref8) {
|
|
|
2235
2279
|
})), renderInfo());
|
|
2236
2280
|
};
|
|
2237
2281
|
|
|
2238
|
-
var NewBlerp$1 = function NewBlerp(
|
|
2282
|
+
var NewBlerp$1 = function NewBlerp(_ref10) {
|
|
2239
2283
|
var _bite$image, _bite$image$original, _bite$ownerObject;
|
|
2240
2284
|
|
|
2241
|
-
var bite =
|
|
2242
|
-
|
|
2285
|
+
var bite = _ref10.bite;
|
|
2286
|
+
_ref10.playState;
|
|
2243
2287
|
|
|
2244
2288
|
var _useContext2 = useContext(BlerpAudioContext),
|
|
2245
2289
|
play = _useContext2.play,
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@mui/material'), require('@babel/runtime/helpers/slicedToArray'), require('prop-types'), require('react'), require('react-color-extractor'), require('styled-components'), require('@babel/runtime/helpers/taggedTemplateLiteral'), require('@mui/icons-material'), require('@mui/icons-material/BookmarkOutlined'), require('@mui/icons-material/LockRounded'), require('@blerp/wavesurfer'), require('@blerp/wavesurfer/dist/plugin/wavesurfer.cursor.min.js'), require('@mui/icons-material/AddRounded'), require('@mui/icons-material/ArrowDropDownRounded'), require('@mui/icons-material/Favorite'), require('@mui/icons-material/FavoriteBorder'), require('@mui/icons-material/PauseRounded'), require('@mui/icons-material/PlayArrowRounded'), require('@mui/icons-material/WarningRounded'), require('@mui/icons-material/DoNotDisturbRounded'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@mui/material', '@babel/runtime/helpers/slicedToArray', 'prop-types', 'react', 'react-color-extractor', 'styled-components', '@babel/runtime/helpers/taggedTemplateLiteral', '@mui/icons-material', '@mui/icons-material/BookmarkOutlined', '@mui/icons-material/LockRounded', '@blerp/wavesurfer', '@blerp/wavesurfer/dist/plugin/wavesurfer.cursor.min.js', '@mui/icons-material/AddRounded', '@mui/icons-material/ArrowDropDownRounded', '@mui/icons-material/Favorite', '@mui/icons-material/FavoriteBorder', '@mui/icons-material/PauseRounded', '@mui/icons-material/PlayArrowRounded', '@mui/icons-material/WarningRounded', '@mui/icons-material/DoNotDisturbRounded', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['react-awesome-buttons'] = {}, global.material, global._slicedToArray, global.PropTypes, global.React, global.reactColorExtractor, global.styled, global._taggedTemplateLiteral, global.iconsMaterial, global.BookmarkOutlinedIcon, global.LockRoundedIcon, global.
|
|
5
|
-
}(this, (function (exports, material, _slicedToArray, PropTypes, React, reactColorExtractor, styled, _taggedTemplateLiteral, iconsMaterial, BookmarkOutlinedIcon, LockRoundedIcon,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@mui/material'), require('@babel/runtime/helpers/slicedToArray'), require('prop-types'), require('react'), require('react-color-extractor'), require('styled-components'), require('@babel/runtime/helpers/taggedTemplateLiteral'), require('@mui/icons-material'), require('@mui/icons-material/BookmarkOutlined'), require('@mui/icons-material/LockRounded'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('@blerp/wavesurfer'), require('@blerp/wavesurfer/dist/plugin/wavesurfer.cursor.min.js'), require('@mui/icons-material/AddRounded'), require('@mui/icons-material/ArrowDropDownRounded'), require('@mui/icons-material/Favorite'), require('@mui/icons-material/FavoriteBorder'), require('@mui/icons-material/PauseRounded'), require('@mui/icons-material/PlayArrowRounded'), require('@mui/icons-material/WarningRounded'), require('@mui/icons-material/DoNotDisturbRounded'), require('@mui/icons-material/BookmarkAddOutlined'), require('@mui/icons-material/MoreHorizRounded'), require('react-palette'), require('@babel/runtime/helpers/typeof'), require('@mui/icons-material/KeyboardArrowRightRounded'), require('@babel/runtime/helpers/defineProperty'), require('@mui/icons-material/KeyboardArrowDownRounded'), require('@mui/icons-material/CloseRounded'), require('@mui/icons-material/FileUploadRounded'), require('@babel/runtime/helpers/extends'), require('react-avatar-editor'), require('react-dropzone'), require('@mui/icons-material/InsertPhotoRounded'), require('@mui/material/styles'), require('@mui/material/Slide'), require('@mui/material/Fade'), require('react-lottie'), require('@mui/icons-material/Facebook'), require('@mui/icons-material/Instagram'), require('@mui/icons-material/ModeEditRounded'), require('@mui/icons-material/PersonAddRounded'), require('@mui/icons-material/Pinterest'), require('@mui/icons-material/Twitter'), require('@mui/icons-material/YouTube'), require('@mui/icons-material/PersonRemoveRounded'), require('@babel/runtime/helpers/toConsumableArray'), require('@mui/icons-material/FilterAltRounded'), require('@mui/icons-material/MenuRounded'), require('@mui/icons-material/ViewModuleRounded'), require('@mui/icons-material/SettingsRounded'), require('@mui/icons-material/SortRounded'), require('@mui/icons-material/ChevronRightRounded'), require('@mui/icons-material/PersonRounded'), require('@mui/icons-material/SearchRounded'), require('@mui/icons-material/BookmarkRemoveOutlined'), require('@mui/icons-material/VisibilityOffRounded')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@mui/material', '@babel/runtime/helpers/slicedToArray', 'prop-types', 'react', 'react-color-extractor', 'styled-components', '@babel/runtime/helpers/taggedTemplateLiteral', '@mui/icons-material', '@mui/icons-material/BookmarkOutlined', '@mui/icons-material/LockRounded', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', '@blerp/wavesurfer', '@blerp/wavesurfer/dist/plugin/wavesurfer.cursor.min.js', '@mui/icons-material/AddRounded', '@mui/icons-material/ArrowDropDownRounded', '@mui/icons-material/Favorite', '@mui/icons-material/FavoriteBorder', '@mui/icons-material/PauseRounded', '@mui/icons-material/PlayArrowRounded', '@mui/icons-material/WarningRounded', '@mui/icons-material/DoNotDisturbRounded', '@mui/icons-material/BookmarkAddOutlined', '@mui/icons-material/MoreHorizRounded', 'react-palette', '@babel/runtime/helpers/typeof', '@mui/icons-material/KeyboardArrowRightRounded', '@babel/runtime/helpers/defineProperty', '@mui/icons-material/KeyboardArrowDownRounded', '@mui/icons-material/CloseRounded', '@mui/icons-material/FileUploadRounded', '@babel/runtime/helpers/extends', 'react-avatar-editor', 'react-dropzone', '@mui/icons-material/InsertPhotoRounded', '@mui/material/styles', '@mui/material/Slide', '@mui/material/Fade', 'react-lottie', '@mui/icons-material/Facebook', '@mui/icons-material/Instagram', '@mui/icons-material/ModeEditRounded', '@mui/icons-material/PersonAddRounded', '@mui/icons-material/Pinterest', '@mui/icons-material/Twitter', '@mui/icons-material/YouTube', '@mui/icons-material/PersonRemoveRounded', '@babel/runtime/helpers/toConsumableArray', '@mui/icons-material/FilterAltRounded', '@mui/icons-material/MenuRounded', '@mui/icons-material/ViewModuleRounded', '@mui/icons-material/SettingsRounded', '@mui/icons-material/SortRounded', '@mui/icons-material/ChevronRightRounded', '@mui/icons-material/PersonRounded', '@mui/icons-material/SearchRounded', '@mui/icons-material/BookmarkRemoveOutlined', '@mui/icons-material/VisibilityOffRounded'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['react-awesome-buttons'] = {}, global.material, global._slicedToArray, global.PropTypes, global.React, global.reactColorExtractor, global.styled, global._taggedTemplateLiteral, global.iconsMaterial, global.BookmarkOutlinedIcon, global.LockRoundedIcon, global._asyncToGenerator, global._regeneratorRuntime, null, null, global.AddRoundedIcon, global.ArrowDropDownRoundedIcon, global.FavoriteIcon, global.FavoriteBorderIcon, global.PauseRoundedIcon, global.PlayArrowRoundedIcon, global.WarningRoundedIcon, null, global.BookmarkAddOutlinedIcon, global.MoreHorizRoundedIcon, global.reactPalette, global._typeof, global.KeyboardArrowRightRoundedIcon, global._defineProperty, global.KeyboardArrowDownRoundedIcon, global.CloseRoundedIcon, global.FileUploadRoundedIcon, global._extends, global.AvatarEditor, global.Dropzone, global.InsertPhotoRoundedIcon, global.styles, global.Slide, global.Fade, global.Lottie, global.FacebookIcon, global.InstagramIcon, global.ModeEditRoundedIcon, global.PersonAddRoundedIcon, global.PinterestIcon, global.TwitterIcon, global.YouTubeIcon, global.PersonRemoveRoundedIcon, global._toConsumableArray, null, global.MenuRoundedIcon, global.ViewModuleRoundedIcon, null, global.SortRoundedIcon, global.ChevronRightRoundedIcon, global.PersonRoundedIcon, global.SearchRoundedIcon, global.BookmarkRemoveOutlinedIcon, global.VisibilityOffRoundedIcon));
|
|
5
|
+
}(this, (function (exports, material, _slicedToArray, PropTypes, React, reactColorExtractor, styled, _taggedTemplateLiteral, iconsMaterial, BookmarkOutlinedIcon, LockRoundedIcon, _asyncToGenerator, _regeneratorRuntime, wavesurfer, wavesurfer_cursor_min_js, AddRoundedIcon, ArrowDropDownRoundedIcon, FavoriteIcon, FavoriteBorderIcon, PauseRoundedIcon, PlayArrowRoundedIcon, WarningRoundedIcon, DoNotDisturbRoundedIcon, BookmarkAddOutlinedIcon, MoreHorizRoundedIcon, reactPalette, _typeof, KeyboardArrowRightRoundedIcon, _defineProperty, KeyboardArrowDownRoundedIcon, CloseRoundedIcon, FileUploadRoundedIcon, _extends, AvatarEditor, Dropzone, InsertPhotoRoundedIcon, styles, Slide, Fade, Lottie, FacebookIcon, InstagramIcon, ModeEditRoundedIcon, PersonAddRoundedIcon, PinterestIcon, TwitterIcon, YouTubeIcon, PersonRemoveRoundedIcon, _toConsumableArray, FilterAltRounded, MenuRoundedIcon, ViewModuleRoundedIcon, SettingsRounded, SortRoundedIcon, ChevronRightRoundedIcon, PersonRoundedIcon, SearchRoundedIcon, BookmarkRemoveOutlinedIcon, VisibilityOffRoundedIcon) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
35
35
|
var BookmarkOutlinedIcon__default = /*#__PURE__*/_interopDefaultLegacy(BookmarkOutlinedIcon);
|
|
36
36
|
var LockRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(LockRoundedIcon);
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
38
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
39
39
|
var AddRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddRoundedIcon);
|
|
40
40
|
var ArrowDropDownRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDropDownRoundedIcon);
|
|
41
41
|
var FavoriteIcon__default = /*#__PURE__*/_interopDefaultLegacy(FavoriteIcon);
|
|
@@ -43,8 +43,6 @@
|
|
|
43
43
|
var PauseRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(PauseRoundedIcon);
|
|
44
44
|
var PlayArrowRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(PlayArrowRoundedIcon);
|
|
45
45
|
var WarningRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(WarningRoundedIcon);
|
|
46
|
-
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
47
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
48
46
|
var BookmarkAddOutlinedIcon__default = /*#__PURE__*/_interopDefaultLegacy(BookmarkAddOutlinedIcon);
|
|
49
47
|
var MoreHorizRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(MoreHorizRoundedIcon);
|
|
50
48
|
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
@@ -1520,7 +1518,10 @@
|
|
|
1520
1518
|
var BlerpAudioContext = /*#__PURE__*/React.createContext({});
|
|
1521
1519
|
var BlerpAudioContextProvider$1 = function BlerpAudioContextProvider(_ref) {
|
|
1522
1520
|
var children = _ref.children;
|
|
1523
|
-
|
|
1521
|
+
|
|
1522
|
+
if (typeof window === "undefined") {
|
|
1523
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, children);
|
|
1524
|
+
}
|
|
1524
1525
|
|
|
1525
1526
|
var _useState = React.useState(null),
|
|
1526
1527
|
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
@@ -1568,7 +1569,7 @@
|
|
|
1568
1569
|
var _ref4 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(_ref3) {
|
|
1569
1570
|
var _bite$audio, _bite$audio$mp;
|
|
1570
1571
|
|
|
1571
|
-
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, gainNode, source;
|
|
1572
|
+
var bite, _ref3$gain, gain, _ref3$startTime, startTime, _ref3$forcePlay, forcePlay, newGain, audioCtx, gainNode, source;
|
|
1572
1573
|
|
|
1573
1574
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
1574
1575
|
while (1) {
|
|
@@ -1627,13 +1628,14 @@
|
|
|
1627
1628
|
}
|
|
1628
1629
|
}, _callee2);
|
|
1629
1630
|
}));
|
|
1631
|
+
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
1630
1632
|
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
|
|
1631
1633
|
|
|
1632
1634
|
gainNode.gain.setValueAtTime(newGain, 0);
|
|
1633
1635
|
source = audioCtx.createMediaElementSource(audioRef.current);
|
|
1634
1636
|
source.connect(gainNode);
|
|
1635
1637
|
gainNode.connect(audioCtx.destination);
|
|
1636
|
-
_context3.next =
|
|
1638
|
+
_context3.next = 25;
|
|
1637
1639
|
return audioRef.current.play().then(function () {
|
|
1638
1640
|
console.log("playing", bite === null || bite === void 0 ? void 0 : bite.title);
|
|
1639
1641
|
setPlayState("playing");
|
|
@@ -1641,7 +1643,7 @@
|
|
|
1641
1643
|
setPlayState("stopped");
|
|
1642
1644
|
});
|
|
1643
1645
|
|
|
1644
|
-
case
|
|
1646
|
+
case 25:
|
|
1645
1647
|
// const playPromise = audioRef.current.play();
|
|
1646
1648
|
// if (playPromise !== undefined) {
|
|
1647
1649
|
// playPromise
|
|
@@ -1658,7 +1660,7 @@
|
|
|
1658
1660
|
// }
|
|
1659
1661
|
_setSelectedBlerp(bite);
|
|
1660
1662
|
|
|
1661
|
-
case
|
|
1663
|
+
case 26:
|
|
1662
1664
|
case "end":
|
|
1663
1665
|
return _context3.stop();
|
|
1664
1666
|
}
|
|
@@ -1717,8 +1719,7 @@
|
|
|
1717
1719
|
return playState;
|
|
1718
1720
|
}
|
|
1719
1721
|
},
|
|
1720
|
-
setStartTime: setStartTime
|
|
1721
|
-
audioContext: audioCtx
|
|
1722
|
+
setStartTime: setStartTime
|
|
1722
1723
|
}
|
|
1723
1724
|
}, children);
|
|
1724
1725
|
};
|
|
@@ -2066,57 +2067,98 @@
|
|
|
2066
2067
|
setWavesurfer = _useState8[1];
|
|
2067
2068
|
|
|
2068
2069
|
React.useEffect(function () {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2070
|
+
var create = /*#__PURE__*/function () {
|
|
2071
|
+
var _ref7 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
2072
|
+
var _WaveSurfer, _CursorPlugin, mWavesurfer;
|
|
2073
|
+
|
|
2074
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
2075
|
+
while (1) {
|
|
2076
|
+
switch (_context.prev = _context.next) {
|
|
2077
|
+
case 0:
|
|
2078
|
+
console.log("creating", hovering, wavesurfer, hasRendered);
|
|
2079
|
+
|
|
2080
|
+
if (!(hovering && wavesurfer)) {
|
|
2081
|
+
_context.next = 5;
|
|
2082
|
+
break;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
wavesurfer.load(audio);
|
|
2086
|
+
_context.next = 17;
|
|
2087
|
+
break;
|
|
2088
|
+
|
|
2089
|
+
case 5:
|
|
2090
|
+
if (!(hovering && !wavesurfer && !hasRendered && document.querySelector("#blerp-waveform-".concat(id)) && document.querySelector("#blerp-waveform-".concat(id)).children.length === 0)) {
|
|
2091
|
+
_context.next = 17;
|
|
2092
|
+
break;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
_context.next = 8;
|
|
2096
|
+
return import('@blerp/wavesurfer');
|
|
2097
|
+
|
|
2098
|
+
case 8:
|
|
2099
|
+
_WaveSurfer = _context.sent.default;
|
|
2100
|
+
_context.next = 11;
|
|
2101
|
+
return import('@blerp/wavesurfer/src/plugin/cursor');
|
|
2102
|
+
|
|
2103
|
+
case 11:
|
|
2104
|
+
_CursorPlugin = _context.sent.default;
|
|
2105
|
+
mWavesurfer = _WaveSurfer.create({
|
|
2106
|
+
container: document.querySelector("#blerp-waveform-".concat(id)),
|
|
2107
|
+
barWidth: 2,
|
|
2108
|
+
barHeight: 1.5,
|
|
2109
|
+
// the height of the wave
|
|
2110
|
+
barGap: 2,
|
|
2111
|
+
// the optional spacing between bars of the wave, if not provided will be calculated in legacy format
|
|
2112
|
+
progressColor: "#ffffff",
|
|
2113
|
+
hoverColor: "#ffffff99",
|
|
2114
|
+
barRadius: 2,
|
|
2115
|
+
height: 30,
|
|
2116
|
+
hideScrollBar: true,
|
|
2117
|
+
plugins: [_CursorPlugin.create({
|
|
2118
|
+
showTime: false,
|
|
2119
|
+
opacity: 0,
|
|
2120
|
+
customShowTimeStyle: {
|
|
2121
|
+
"background-color": "#000",
|
|
2122
|
+
color: "#fff",
|
|
2123
|
+
padding: "2px",
|
|
2124
|
+
"font-size": "10px"
|
|
2125
|
+
}
|
|
2126
|
+
})]
|
|
2127
|
+
});
|
|
2128
|
+
mWavesurfer.on("error", function (e) {
|
|
2129
|
+
console.warn(e);
|
|
2130
|
+
});
|
|
2131
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.on("seek", function (prog) {
|
|
2132
|
+
if (prog) {
|
|
2133
|
+
console.log("SEEEEEEK", prog, bite);
|
|
2134
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.setMute(true);
|
|
2135
|
+
mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.play();
|
|
2136
|
+
play({
|
|
2137
|
+
bite: bite,
|
|
2138
|
+
startTime: mWavesurfer === null || mWavesurfer === void 0 ? void 0 : mWavesurfer.getCurrentTime(),
|
|
2139
|
+
forcePlay: true
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
}); // Load audio from URL
|
|
2143
|
+
// mWavesurfer.load(audio);
|
|
2144
|
+
|
|
2145
|
+
setWavesurfer(mWavesurfer);
|
|
2146
|
+
setHasRendered(true);
|
|
2147
|
+
|
|
2148
|
+
case 17:
|
|
2149
|
+
case "end":
|
|
2150
|
+
return _context.stop();
|
|
2111
2151
|
}
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2152
|
+
}
|
|
2153
|
+
}, _callee);
|
|
2154
|
+
}));
|
|
2114
2155
|
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2156
|
+
return function create() {
|
|
2157
|
+
return _ref7.apply(this, arguments);
|
|
2158
|
+
};
|
|
2159
|
+
}();
|
|
2160
|
+
|
|
2161
|
+
create();
|
|
2120
2162
|
}, [wavesurfer, bite, play, audio, hovering, hasRendered, id]);
|
|
2121
2163
|
React.useEffect(function () {
|
|
2122
2164
|
// if (wavesurfer && selectedBlerp?._id === bite?._id) {
|
|
@@ -2170,11 +2212,11 @@
|
|
|
2170
2212
|
});
|
|
2171
2213
|
};
|
|
2172
2214
|
|
|
2173
|
-
var ReportedWarning = function ReportedWarning(
|
|
2174
|
-
var showWarning =
|
|
2175
|
-
saved =
|
|
2176
|
-
count =
|
|
2177
|
-
onClick =
|
|
2215
|
+
var ReportedWarning = function ReportedWarning(_ref9) {
|
|
2216
|
+
var showWarning = _ref9.showWarning,
|
|
2217
|
+
saved = _ref9.saved,
|
|
2218
|
+
count = _ref9.count,
|
|
2219
|
+
onClick = _ref9.onClick;
|
|
2178
2220
|
|
|
2179
2221
|
var _useState9 = React.useState(showWarning),
|
|
2180
2222
|
_useState10 = _slicedToArray__default['default'](_useState9, 2),
|
|
@@ -2255,11 +2297,11 @@
|
|
|
2255
2297
|
})), renderInfo());
|
|
2256
2298
|
};
|
|
2257
2299
|
|
|
2258
|
-
var NewBlerp$1 = function NewBlerp(
|
|
2300
|
+
var NewBlerp$1 = function NewBlerp(_ref10) {
|
|
2259
2301
|
var _bite$image, _bite$image$original, _bite$ownerObject;
|
|
2260
2302
|
|
|
2261
|
-
var bite =
|
|
2262
|
-
|
|
2303
|
+
var bite = _ref10.bite;
|
|
2304
|
+
_ref10.playState;
|
|
2263
2305
|
|
|
2264
2306
|
var _useContext2 = React.useContext(BlerpAudioContext),
|
|
2265
2307
|
play = _useContext2.play,
|