@bits-innovate/react-native-vstarcam 1.0.55 → 1.0.56
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.
|
@@ -47,6 +47,7 @@ public class VStarCamVideoView extends FrameLayout
|
|
|
47
47
|
private boolean isStreaming = false;
|
|
48
48
|
private boolean playerInitialized = false;
|
|
49
49
|
private boolean pendingStartStream = false;
|
|
50
|
+
private boolean streamingRequested = false; // Tracks if JS set streaming=true
|
|
50
51
|
|
|
51
52
|
// Player class (from AAR)
|
|
52
53
|
private Class<?> appPlayerClass;
|
|
@@ -151,7 +152,13 @@ public class VStarCamVideoView extends FrameLayout
|
|
|
151
152
|
Log.d(TAG, "SDK client pointer: " + sdkClientPtr);
|
|
152
153
|
|
|
153
154
|
if (sdkClientPtr != 0) {
|
|
154
|
-
|
|
155
|
+
// If streaming was already requested (prop order race), start now
|
|
156
|
+
if (streamingRequested && !isStreaming) {
|
|
157
|
+
Log.d(TAG, "clientPtr arrived after streaming requested — starting stream");
|
|
158
|
+
startStream();
|
|
159
|
+
} else {
|
|
160
|
+
statusView.setText("Ready to stream");
|
|
161
|
+
}
|
|
155
162
|
} else {
|
|
156
163
|
statusView.setText("Waiting for connection...");
|
|
157
164
|
}
|
|
@@ -174,6 +181,8 @@ public class VStarCamVideoView extends FrameLayout
|
|
|
174
181
|
* - start(long) -> boolean
|
|
175
182
|
*/
|
|
176
183
|
public void startStream() {
|
|
184
|
+
streamingRequested = true;
|
|
185
|
+
|
|
177
186
|
if (sdkClientPtr == 0) {
|
|
178
187
|
// Try to get SDK pointer again in case it was set after setClientPtr
|
|
179
188
|
this.sdkClientPtr = VStarCamModule.getSdkClientPtr((int) clientPtr);
|
|
@@ -251,6 +260,7 @@ public class VStarCamVideoView extends FrameLayout
|
|
|
251
260
|
* Stop video streaming.
|
|
252
261
|
*/
|
|
253
262
|
public void stopStream() {
|
|
263
|
+
streamingRequested = false;
|
|
254
264
|
if (!isStreaming || playerPtr == 0) return;
|
|
255
265
|
|
|
256
266
|
Log.d(TAG, "Stopping stream...");
|