l-min-components 1.0.1141 → 1.0.1143

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.1141",
3
+ "version": "1.0.1143",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -1,4 +1,4 @@
1
- import { useContext, useEffect, useRef, useState } from "react";
1
+ import { useCallback, useContext, useEffect, useRef, useState } from "react";
2
2
  import Hls from "hls.js";
3
3
  import { OutletContext } from "../AppMainLayout";
4
4
 
@@ -13,9 +13,9 @@ const useAudioPlayer = ({ src, streamSrc }) => {
13
13
  const { accessToken, generalData } = useContext(OutletContext);
14
14
 
15
15
  const accountId = generalData?.selectedAccount?.id;
16
+ const audio = audioRef?.current;
16
17
 
17
18
  useEffect(() => {
18
- const audio = audioRef?.current;
19
19
  if (!audio) return;
20
20
  let hls;
21
21
 
@@ -94,23 +94,25 @@ const useAudioPlayer = ({ src, streamSrc }) => {
94
94
  };
95
95
  }, [src, streamSrc, accessToken, accountId]);
96
96
 
97
- const play = () => {
97
+ const play = useCallback(() => {
98
98
  if (audioRef.current) {
99
99
  audioRef.current.play();
100
100
  }
101
- };
101
+ }, [src, streamSrc, accessToken, accountId]);
102
102
 
103
- const pause = () => {
103
+ const pause = useCallback(() => {
104
104
  if (audioRef.current) {
105
105
  audioRef.current.pause();
106
106
  }
107
- };
108
- const stop = () => {
107
+ }, [src, streamSrc, accessToken, accountId]);
108
+
109
+ const stop = useCallback(() => {
109
110
  if (audioRef.current) {
110
111
  audioRef.current.pause();
111
112
  audioRef.current.currentTime = 0;
112
113
  }
113
- };
114
+ }, [src, streamSrc, accessToken, accountId]);
115
+
114
116
  return {
115
117
  stop,
116
118
  audioRef,