@bits-innovate/react-native-vstarcam 1.0.41 → 1.0.42

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.
@@ -105,7 +105,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
105
105
 
106
106
  // Client tracking - maps our clientPtr to actual SDK client handle
107
107
  // Made static so VStarCamVideoView can access SDK pointers
108
- private static Map<Integer, ClientInfo> clients = new HashMap<>();
108
+ private static Map<Integer, ClientInfo> clients = new java.util.concurrent.ConcurrentHashMap<>();
109
109
  private boolean isNativeLibraryLoaded = false;
110
110
  private boolean isP2PInitialized = false;
111
111
 
@@ -487,6 +487,24 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
487
487
  });
488
488
  }
489
489
 
490
+ /**
491
+ * Get the current connection state of a client
492
+ */
493
+ @ReactMethod
494
+ public void clientGetState(int clientPtr, Promise promise) {
495
+ ClientInfo clientInfo = clients.get(clientPtr);
496
+ if (clientInfo == null) {
497
+ promise.resolve(5); // DISCONNECTED
498
+ return;
499
+ }
500
+
501
+ WritableMap result = Arguments.createMap();
502
+ result.putInt("state", clientInfo.isConnected ? 3 : 1); // 3=ONLINE, 1=CONNECTING (approx)
503
+ result.putBoolean("isConnected", clientInfo.isConnected);
504
+ result.putBoolean("isLoggedIn", clientInfo.isLoggedIn);
505
+ promise.resolve(result);
506
+ }
507
+
490
508
  /**
491
509
  * Login to camera
492
510
  * JNIApi.login(long clientPtr, String username, String password)
@@ -90,6 +90,7 @@ public class VStarCamVideoView extends FrameLayout
90
90
  // Based on decompiling app_player-5.0.0.aar classes.jar
91
91
  String[] classNames = {
92
92
  "com.veepai.AppPlayerApi", // Main API class from AAR
93
+ "com.veepai.AppPlayer", // Possible alternative
93
94
  "com.veepai.app_player.AppPlayerPlugin", // Flutter plugin wrapper
94
95
  "com.vstarcam.player.AppPlayer",
95
96
  "com.vstarcam.AppPlayer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bits-innovate/react-native-vstarcam",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "React Native bridge for VStarCam P2P SDK",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -288,6 +288,14 @@ class VStarCamClient {
288
288
  return VStarCamModule.clientCheckMode(this.clientPtr);
289
289
  }
290
290
 
291
+ /**
292
+ * Get the current connection state of the client
293
+ */
294
+ async getState(): Promise<any> {
295
+ if (!this.clientPtr) return { state: 5, isConnected: false };
296
+ return VStarCamModule.clientGetState(this.clientPtr);
297
+ }
298
+
291
299
  /**
292
300
  * Login to the camera
293
301
  * @param username Camera username (default: admin)