Hi Veselina,
I’m not sure I fully understand the question.
Could you please specify what exactly ID you have in mind ?
As far for the sample (if you are talking about main video sample), “XPMobileSDK.getAllViews” returns the whole hierarchy of folders and views.
The last level of children in that “tree” are cameras that are included in the particular view.
The sample actually accesses the predefined view in the system - All cameras View:
items[0].Items[0].Items[0].Items[i] ==
...<Camera[N]>.
After that foreach camera is requested live video stream (when user clicks on the Camera element).
You can see in “function buildCameraElement(item, wrapper)” method that “item.Id” and “item.Name” are used. Those are unique camera ID in the system and camera name.
Peter, thank you very much for the help and the detailed explanation. A lot of things make sense now. One more question: How can I get (visualize and play) one camera when I have only its ID (I want to display one camera by selecting it by ID)?
Hi Veselina,
Yes,
in the same file (sample.js) you can see something like:
function RequestStreamParams(cameraId, signalType) {
return {
CameraId: cameraId,
DestWidth: 400,
DestHeight: 300,
SignalType: signalType /*'Live' or 'Playback'*/,
MethodType: 'Push' /*'Pull'*/,
Fps: 25, // This doesn't work for Pull mode, but we have to supply it anyway to keep the server happy
ComprLevel: 71,
KeyFramesOnly: 'No' /*'Yes'*/, // Server will give only key frame thumb nails. This will reduce FPS
RequestSize: 'Yes',
StreamType: 'Transcoded'
};
}
var videoConnectionObserver = {
videoConnectionReceivedFrame: videoConnectionReceivedFrame
}
var streamRequest = XPMobileSDK.RequestStream(RequestStreamParams(Id, 'Live'), requestStreamCallback, function (error) { } );
/**
* Video stream request callback
*/
function requestStreamCallback(videoConnection) {
videoController = videoConnection;
videoConnection.addObserver(videoConnectionObserver);
videoConnection.open();
}
function videoConnectionReceivedFrame(frame) {
...
imageURL = window.URL.createObjectURL(frame.blob);
image.src = imageURL
...
}
}
I think this “id”/“cameraId” is exactly what you have in mind.