l-min-components 1.0.1145 → 1.0.1147
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/package.json
CHANGED
|
@@ -18,11 +18,7 @@ const useAudioPlayer = ({ src, streamSrc }) => {
|
|
|
18
18
|
if (!audioRef.current) return;
|
|
19
19
|
let hls;
|
|
20
20
|
|
|
21
|
-
if (src) {
|
|
22
|
-
audioRef.current.src = src;
|
|
23
|
-
audioRef.current.load();
|
|
24
|
-
setIsReady(true);
|
|
25
|
-
} else if (Hls?.isSupported() && streamSrc) {
|
|
21
|
+
if (Hls?.isSupported() && streamSrc && !src) {
|
|
26
22
|
hls = new Hls({
|
|
27
23
|
xhrSetup: function (xhr, url) {
|
|
28
24
|
const modifiedURL = `${url}?_account=${accountId}`;
|
|
@@ -110,23 +106,23 @@ const useAudioPlayer = ({ src, streamSrc }) => {
|
|
|
110
106
|
}, [src, streamSrc, accessToken, accountId]);
|
|
111
107
|
|
|
112
108
|
const play = useCallback(() => {
|
|
113
|
-
if (audioRef.current
|
|
109
|
+
if (audioRef.current) {
|
|
114
110
|
audioRef.current.play();
|
|
115
111
|
}
|
|
116
|
-
}, [
|
|
112
|
+
}, []);
|
|
117
113
|
|
|
118
114
|
const pause = useCallback(() => {
|
|
119
|
-
if (audioRef.current
|
|
115
|
+
if (audioRef.current) {
|
|
120
116
|
audioRef.current.pause();
|
|
121
117
|
}
|
|
122
|
-
}, [
|
|
118
|
+
}, []);
|
|
123
119
|
|
|
124
120
|
const stop = useCallback(() => {
|
|
125
|
-
if (audioRef.current
|
|
121
|
+
if (audioRef.current) {
|
|
126
122
|
audioRef.current.pause();
|
|
127
123
|
audioRef.current.currentTime = 0;
|
|
128
124
|
}
|
|
129
|
-
}, [
|
|
125
|
+
}, []);
|
|
130
126
|
|
|
131
127
|
return {
|
|
132
128
|
stop,
|