@stream-io/video-react-native-sdk 0.0.1-alpha.262 → 0.0.1-alpha.263

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.1-alpha.263](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.262...@stream-io/video-react-native-sdk-0.0.1-alpha.263) (2023-07-10)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **react-native:** video published on foreground even if it was muted ([#773](https://github.com/GetStream/stream-video-js/issues/773)) ([6fc1ce9](https://github.com/GetStream/stream-video-js/commit/6fc1ce91db183e6fa2c962b86b5715e3ac4421c6))
11
+
12
+
13
+
5
14
  ## [0.0.1-alpha.262](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.0.1-alpha.261...@stream-io/video-react-native-sdk-0.0.1-alpha.262) (2023-07-10)
6
15
 
7
16
 
package/README.md CHANGED
@@ -96,7 +96,7 @@ Stream's video roadmap and changelog are available [here](https://github.com/Get
96
96
  - [x] Reconnection (awaiting BE)
97
97
  - [x] Simulcasting- iOS
98
98
  - [x] Pinning and spotlighting participants
99
- - [ ] Components parity, alignment and refactor
99
+ - [x] Components parity, alignment and refactor
100
100
  - [ ] Write docs:
101
101
  - [ ] UI Components
102
102
  - [ ] Tutorials
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A helper hook which exposes audio, video mute and camera facing mode and
2
+ * A helper hook which exposes audio, video publishing state and
3
3
  * their respective functions to toggle state
4
4
  *
5
5
  * @category Device Management
@@ -7,46 +7,36 @@ const react_1 = require("react");
7
7
  const useAppStateListener_1 = require("../utils/hooks/useAppStateListener");
8
8
  const MediaStreamManagement_1 = require("../providers/MediaStreamManagement");
9
9
  /**
10
- * A helper hook which exposes audio, video mute and camera facing mode and
10
+ * A helper hook which exposes audio, video publishing state and
11
11
  * their respective functions to toggle state
12
12
  *
13
13
  * @category Device Management
14
14
  */
15
15
  const useCallControls = () => {
16
16
  const localParticipant = (0, video_react_bindings_1.useLocalParticipant)();
17
- const call = (0, video_react_bindings_1.useCall)();
18
- /** Refs to keep track of the current call and whether the user is online or not */
19
- const callRef = (0, react_1.useRef)(call);
20
- callRef.current = call;
21
17
  const { publishAudioStream, publishVideoStream, stopPublishingAudio, stopPublishingVideo, } = (0, MediaStreamManagement_1.useMediaStreamManagement)();
22
18
  const isAudioPublished = localParticipant?.publishedTracks.includes(video_client_1.SfuModels.TrackType.AUDIO);
23
19
  const isVideoPublished = localParticipant?.publishedTracks.includes(video_client_1.SfuModels.TrackType.VIDEO);
24
- /** Refs to keep track of whether the user has published the track before going offline */
25
- const isAudioPublishedRef = (0, react_1.useRef)(false);
26
- const isVideoPublishedRef = (0, react_1.useRef)(false);
27
- isAudioPublishedRef.current = !isAudioPublished;
28
- isVideoPublishedRef.current = !isVideoPublished;
29
- /** Refs to be used for useEffect that does the rejoining flow when coming back offline */
30
- const publishAudioStreamRef = (0, react_1.useRef)(publishAudioStream);
31
- const publishVideoStreamRef = (0, react_1.useRef)(publishVideoStream);
32
- publishAudioStreamRef.current = publishAudioStream;
33
- publishVideoStreamRef.current = publishVideoStream;
34
20
  /** Attempt to republish video stream when app comes back to foreground */
35
- (0, useAppStateListener_1.useAppStateListener)(isVideoPublishedRef.current ? publishVideoStream : undefined);
36
- const toggleVideoMuted = (0, react_1.useCallback)(async () => {
37
- if (!isVideoPublished) {
21
+ (0, useAppStateListener_1.useAppStateListener)(() => {
22
+ if (isVideoPublished) {
38
23
  publishVideoStream();
39
24
  }
40
- else {
25
+ }, undefined);
26
+ const toggleVideoMuted = (0, react_1.useCallback)(async () => {
27
+ if (isVideoPublished) {
41
28
  stopPublishingVideo();
42
29
  }
30
+ else {
31
+ publishVideoStream();
32
+ }
43
33
  }, [isVideoPublished, publishVideoStream, stopPublishingVideo]);
44
34
  const toggleAudioMuted = (0, react_1.useCallback)(async () => {
45
- if (!isAudioPublished) {
46
- publishAudioStream();
35
+ if (isAudioPublished) {
36
+ stopPublishingAudio();
47
37
  }
48
38
  else {
49
- stopPublishingAudio();
39
+ publishAudioStream();
50
40
  }
51
41
  }, [isAudioPublished, publishAudioStream, stopPublishingAudio]);
52
42
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"useCallControls.js","sourceRoot":"","sources":["../../../src/hooks/useCallControls.tsx"],"names":[],"mappings":";;;AAAA,0DAAoD;AACpD,0EAA+E;AAC/E,iCAA4C;AAC5C,4EAAyE;AACzE,8EAA8E;AAE9E;;;;;GAKG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,gBAAgB,GAAG,IAAA,0CAAmB,GAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,IAAA,8BAAO,GAAE,CAAC;IACvB,mFAAmF;IACnF,MAAM,OAAO,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAEvB,MAAM,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,GAAG,IAAA,gDAAwB,GAAE,CAAC;IAE/B,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,eAAe,CAAC,QAAQ,CACjE,wBAAS,CAAC,SAAS,CAAC,KAAK,CAC1B,CAAC;IACF,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,eAAe,CAAC,QAAQ,CACjE,wBAAS,CAAC,SAAS,CAAC,KAAK,CAC1B,CAAC;IACF,2FAA2F;IAC3F,MAAM,mBAAmB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,mBAAmB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IAC1C,mBAAmB,CAAC,OAAO,GAAG,CAAC,gBAAgB,CAAC;IAChD,mBAAmB,CAAC,OAAO,GAA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- "version": "0.0.1-alpha.262"
87
+ "version": "0.0.1-alpha.263"
88
88
  }
@@ -1,21 +1,17 @@
1
1
  import { SfuModels } from '@stream-io/video-client';
2
- import { useCall, useLocalParticipant } from '@stream-io/video-react-bindings';
3
- import { useCallback, useRef } from 'react';
2
+ import { useLocalParticipant } from '@stream-io/video-react-bindings';
3
+ import { useCallback } from 'react';
4
4
  import { useAppStateListener } from '../utils/hooks/useAppStateListener';
5
5
  import { useMediaStreamManagement } from '../providers/MediaStreamManagement';
6
6
 
7
7
  /**
8
- * A helper hook which exposes audio, video mute and camera facing mode and
8
+ * A helper hook which exposes audio, video publishing state and
9
9
  * their respective functions to toggle state
10
10
  *
11
11
  * @category Device Management
12
12
  */
13
13
  export const useCallControls = () => {
14
14
  const localParticipant = useLocalParticipant();
15
- const call = useCall();
16
- /** Refs to keep track of the current call and whether the user is online or not */
17
- const callRef = useRef(call);
18
- callRef.current = call;
19
15
 
20
16
  const {
21
17
  publishAudioStream,
@@ -30,36 +26,27 @@ export const useCallControls = () => {
30
26
  const isVideoPublished = localParticipant?.publishedTracks.includes(
31
27
  SfuModels.TrackType.VIDEO,
32
28
  );
33
- /** Refs to keep track of whether the user has published the track before going offline */
34
- const isAudioPublishedRef = useRef(false);
35
- const isVideoPublishedRef = useRef(false);
36
- isAudioPublishedRef.current = !isAudioPublished;
37
- isVideoPublishedRef.current = !isVideoPublished;
38
-
39
- /** Refs to be used for useEffect that does the rejoining flow when coming back offline */
40
- const publishAudioStreamRef = useRef(publishAudioStream);
41
- const publishVideoStreamRef = useRef(publishVideoStream);
42
- publishAudioStreamRef.current = publishAudioStream;
43
- publishVideoStreamRef.current = publishVideoStream;
44
29
 
45
30
  /** Attempt to republish video stream when app comes back to foreground */
46
- useAppStateListener(
47
- isVideoPublishedRef.current ? publishVideoStream : undefined,
48
- );
31
+ useAppStateListener(() => {
32
+ if (isVideoPublished) {
33
+ publishVideoStream();
34
+ }
35
+ }, undefined);
49
36
 
50
37
  const toggleVideoMuted = useCallback(async () => {
51
- if (!isVideoPublished) {
52
- publishVideoStream();
53
- } else {
38
+ if (isVideoPublished) {
54
39
  stopPublishingVideo();
40
+ } else {
41
+ publishVideoStream();
55
42
  }
56
43
  }, [isVideoPublished, publishVideoStream, stopPublishingVideo]);
57
44
 
58
45
  const toggleAudioMuted = useCallback(async () => {
59
- if (!isAudioPublished) {
60
- publishAudioStream();
61
- } else {
46
+ if (isAudioPublished) {
62
47
  stopPublishingAudio();
48
+ } else {
49
+ publishAudioStream();
63
50
  }
64
51
  }, [isAudioPublished, publishAudioStream, stopPublishingAudio]);
65
52