@stream-io/video-react-sdk 1.23.0 → 1.24.0

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 CHANGED
@@ -2924,22 +2924,11 @@ const Host = () => {
2924
2924
  Host.displayName = 'PipLayout.Host';
2925
2925
  const PipLayout = { Pip, Host };
2926
2926
 
2927
- function useEffectEvent(cb) {
2928
- const cbRef = react.useRef(undefined);
2929
- react.useLayoutEffect(() => {
2930
- cbRef.current = cb;
2931
- }, [cb]);
2932
- return react.useCallback((...args) => {
2933
- const callback = cbRef.current;
2934
- callback?.(...args);
2935
- }, []);
2936
- }
2937
-
2938
2927
  const LivestreamPlayer = (props) => {
2939
2928
  const { callType, callId, ...restProps } = props;
2940
2929
  const client = videoReactBindings.useStreamVideoClient();
2941
2930
  const [call, setCall] = react.useState();
2942
- const onError = useEffectEvent(props.onError);
2931
+ const onError = videoReactBindings.useEffectEvent(props.onError ?? (() => { }));
2943
2932
  react.useEffect(() => {
2944
2933
  if (!client)
2945
2934
  return;
@@ -2955,7 +2944,7 @@ const LivestreamPlayer = (props) => {
2955
2944
  });
2956
2945
  setCall(undefined);
2957
2946
  };
2958
- }, [callId, callType, client, onError]);
2947
+ }, [callId, callType, client]);
2959
2948
  if (!call) {
2960
2949
  return null;
2961
2950
  }
@@ -2982,7 +2971,7 @@ const useLivestreamCall = (props) => {
2982
2971
  const joinBehavior = props.joinBehavior ?? 'asap';
2983
2972
  const canJoin = (joinBehavior === 'asap' && canJoinAsap) ||
2984
2973
  (joinBehavior === 'live' && canJoinLive);
2985
- const onError = useEffectEvent(props.onError);
2974
+ const onError = videoReactBindings.useEffectEvent(props.onError ?? (() => { }));
2986
2975
  react.useEffect(() => {
2987
2976
  if (call && call.state.callingState === videoClient.CallingState.IDLE && canJoin) {
2988
2977
  call.join().catch((e) => {
@@ -2990,7 +2979,7 @@ const useLivestreamCall = (props) => {
2990
2979
  onError(e);
2991
2980
  });
2992
2981
  }
2993
- }, [call, canJoin, onError]);
2982
+ }, [call, canJoin]);
2994
2983
  return call;
2995
2984
  };
2996
2985
  const useCanJoinEarly = () => {
@@ -3016,7 +3005,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
3016
3005
  return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
3017
3006
  };
3018
3007
 
3019
- const [major, minor, patch] = ("1.23.0").split('.');
3008
+ const [major, minor, patch] = ("1.24.0").split('.');
3020
3009
  videoClient.setSdkInfo({
3021
3010
  type: videoClient.SfuModels.SdkType.REACT,
3022
3011
  major,