@bits-innovate/react-native-vstarcam 1.0.61 → 1.0.62

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.
@@ -933,6 +933,34 @@ public class VStarCamModule extends ReactContextBaseJavaModule implements Lifecy
933
933
  }
934
934
  }
935
935
 
936
+ /**
937
+ * Mute / Unmute the Live Video Stream Audio
938
+ */
939
+ @ReactMethod
940
+ public void setAudioStream(int clientPtr, boolean enableAudio, Promise promise) {
941
+ Log.d(TAG, "setAudioStream called: client=" + clientPtr + ", enable=" + enableAudio);
942
+ try {
943
+ ClientInfo clientInfo = clients.get(clientPtr);
944
+ if (clientInfo == null || clientInfo.sdkClientPtr == 0) {
945
+ promise.reject("E_NOT_CONNECTED", "Client not connected");
946
+ return;
947
+ }
948
+
949
+ // Find AppPlayerApi class
950
+ Class<?> appPlayerClass = Class.forName("com.veepai.AppPlayerApi");
951
+ Method setAudioMethod = appPlayerClass.getMethod("app_player_set_audio", long.class, int.class);
952
+
953
+ // Invoke app_player_set_audio(clientPtr, onOff) where 1=ON, 0=OFF
954
+ int result = (Integer) setAudioMethod.invoke(null, clientInfo.sdkClientPtr, enableAudio ? 1 : 0);
955
+ Log.d(TAG, "app_player_set_audio result: " + result);
956
+
957
+ promise.resolve(result == 0); // usually 0 is success
958
+ } catch (Exception e) {
959
+ Log.e(TAG, "setAudioStream error", e);
960
+ promise.reject("E_AUDIO_SET_FAILED", e.getMessage(), e);
961
+ }
962
+ }
963
+
936
964
  /**
937
965
  * Check connection mode
938
966
  * JNIApi.checkMode(long clientPtr)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bits-innovate/react-native-vstarcam",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "description": "React Native bridge for VStarCam P2P SDK",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -43,4 +43,4 @@
43
43
  "react": "*",
44
44
  "react-native": "*"
45
45
  }
46
- }
46
+ }
package/src/index.ts CHANGED
@@ -320,6 +320,15 @@ class VStarCamClient {
320
320
  return VStarCamModule.clientGetState(this.clientPtr);
321
321
  }
322
322
 
323
+ /**
324
+ * Mutes or Unmutes the live video audio stream
325
+ * @param enableAudio true to play sound, false to mute
326
+ */
327
+ async setAudioStream(enableAudio: boolean): Promise<boolean> {
328
+ if (!this.clientPtr) throw new Error("Client not created");
329
+ return VStarCamModule.setAudioStream(this.clientPtr, enableAudio);
330
+ }
331
+
323
332
  /**
324
333
  * Login to the camera
325
334
  * @param username Camera username (default: admin)