I have developed a web application that we can view live streaming of the camera via direct streaming (videos-stream element). But sometimes I have noted that stream is not coming through and when we checked on Milestone camera connection is lost.
My requirement is to show the same on my application side too when direct stream is been used.
Hi Kesera,
We are looking into your question and will get back to you as soon as we can.
In the meanwhile, have you tried adding a VideoConnectionObserver to VideoStream using addObserver function? Following events from the observer might help you with your case:
- videoConnectionFailed
- videoConnectionTemporaryDown
- videoConnectionRecovered
- videoConnectionChangedState
As we are using the direct streaming via “video-stream” tag, because of that we can’t add the VideoConnectionObserver.
Hi again Kesera,
You can use restartStream and streamReady events for checking camera status. restartStream should be thrown when connection is lost and streamReady should be thrown when connection is established. Alternatively, you can check out beginVideoStuck and endVideoStuck events, but those events are not thrown only when camera connection is lost.
I’m just trying to figure out which parameter returns the status of the camera as it was returning many parameters on the event.
can you help me with that?
Of course!
I don’t think there is a parameter that returns the status of the camera. But maybe you could make your own local variable / function for camera status, and call it from those events. As I mentioned, streamReady is invoked when when connection is made and restartStream is invoked when the connection is lost and trying to re-establish the connection.
Alternatively, you could also add a VideoConnectionObserver in streamReady event like this:
let videoConnection = null;
var camera = XPMobileSDK.library.VideoConnectionPool.getCameraByVideoId(event.detail.cameraId, event.detail.videoId);
if (camera) {
videoConnection = camera.videoConnection;
streamRequest = null;
}
videoConnection.addObserver(this.videoConnectionObserver);
Thanks for the detailed explanation. I’ll get that implemented.