Reconnecting to the Video Stream Cloud Phone
Application Scenario
Reconnect to the video stream cloud phone when the client socket is disconnected.
Prerequisites
The client socket is disconnected.
Development Process
In the started logic threads, call the stop, initialize, and start interface functions of the video stream engine in sequence.
Encoding Instance
public class Activity implements BaseActivity {
protected void ReconnectCloudPhone() {
threadPool.submit(new ReconnectRunnable());
}
}
class ReconnectRunable implements Runnable {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// Stop the video stream engine.
engine.stop();
// Initialize the video stream engine.
int initResult = engine.initialize();
if (initResult != VideoEngine.VMI_SUCCESS) {
// The video stream engine fails to be initialized.
}
// Start the video stream engine.
int startResult = engine.start(surfaceView.getHolder().getSurface(),
guestWidth, guestHeight, metric.densityDpi);
if (startResult == VideoEngine.VMI_CLIENT_START_FAIL) {
// The video stream engine fails to be started.
} else {
// The video stream engine is started successfully. Start the receiving thread.
}
}
});
}
}
Parent topic: Development Process of the Video Stream Engine Client