@bits-innovate/react-native-vstarcam 1.0.48 → 1.0.49

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.
@@ -205,11 +205,6 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
205
205
  currentContext = new java.lang.ref.WeakReference<>(reactContext);
206
206
 
207
207
  synchronized (initLock) {
208
- if (isP2PInitialized) {
209
- Log.d(TAG, "P2P already initialized, skipping...");
210
- return;
211
- }
212
-
213
208
  // Load the native libraries
214
209
  try {
215
210
  if (!isNativeLibraryLoaded) {
@@ -242,11 +237,6 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
242
237
  return;
243
238
  }
244
239
 
245
- if (VStarCamModule.isP2PInitialized) {
246
- Log.d(TAG, "P2P system already initialized, skipping SDK init calls");
247
- return;
248
- }
249
-
250
240
  try {
251
241
  // Create dynamic proxy for ClientStateListener
252
242
  stateListenerProxy = Proxy.newProxyInstance(
@@ -268,8 +258,14 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
268
258
  Log.d(TAG, "ClientStateListener." + methodName + " called");
269
259
  if (methodName.equals("stateListener")) {
270
260
  // args: long clientPtr, int state
271
- final long clientPtr = (Long) args[0];
272
- final int state = (Integer) args[1];
261
+ long clientPtr = 0;
262
+ int state = 0;
263
+
264
+ if (args != null && args.length >= 2) {
265
+ if (args[0] instanceof Number) clientPtr = ((Number) args[0]).longValue();
266
+ if (args[1] instanceof Number) state = ((Number) args[1]).intValue();
267
+ }
268
+
273
269
  Log.d(TAG, "State callback: clientPtr=" + clientPtr + ", state=" + state);
274
270
 
275
271
  // Post to main thread for React Native compatibility
@@ -303,9 +299,16 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
303
299
  Log.d(TAG, "ClientCommandListener." + methodName + " called");
304
300
  if (methodName.equals("commandListener")) {
305
301
  // args: long clientPtr, byte[] data, int length (from interface)
306
- final long clientPtr = (Long) args[0];
307
- final byte[] data = (byte[]) args[1];
308
- final int length = (Integer) args[2];
302
+ long clientPtr = 0;
303
+ byte[] data = null;
304
+ int length = 0;
305
+
306
+ if (args != null && args.length >= 3) {
307
+ if (args[0] instanceof Number) clientPtr = ((Number) args[0]).longValue();
308
+ if (args[1] instanceof byte[]) data = (byte[]) args[1];
309
+ if (args[2] instanceof Number) length = ((Number) args[2]).intValue();
310
+ }
311
+
309
312
  Log.d(TAG, "Command callback: clientPtr=" + clientPtr + ", dataLen=" + (data != null ? data.length : 0));
310
313
 
311
314
  // Post to main thread for React Native compatibility
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bits-innovate/react-native-vstarcam",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "description": "React Native bridge for VStarCam P2P SDK",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",