Last Updated on : 2024-06-19 03:58:29download
IP cameras (IPCs) support the cloud storage service that allows users to save video footage on the IPCs to the cloud.
If the cloud storage service is inactivated or has expired, this service must be purchased to enable cloud storage.
After the cloud storage service expires, the existing cloud-stored video files will be retained for a period, seven days in most cases. At the end of this period, all cloud-stored video files will be deleted.
If the cloud storage service is within the validity period:
Demo | Class | Method | Description |
---|---|---|---|
IThingIPCCloud | isSupportCloudStorage | Check support for cloud storage. | |
IThingIPCCloud | createCloudCamera | Create a camera object for cloud storage. One device ID matches one camera object. | |
IThingCloudCamera | queryCloudServiceStatus | Query cloud storage status.
|
|
IThingCloudCamera | getTimeLineInfo | Query video clips within a specified period. | |
IThingCloudCamera | playCloudDataWithStartTime | Start playback. | |
IThingCloudCamera | stopPlayCloudVideo | Stop playback. |
Some IThingCloudCamera
APIs are implemented asynchronously. It is recommended not to call other methods of an object within this object’s callback, as it may cause Application Not Responding (ANR) issues.
void queryCloudServiceStatus(String devId, IThingResultCallback<CloudStatusBean> callback);
void getTimeLineInfo(String devId, long timeGT, long timeLT, IThingResultCallback<List<TimePieceBean>> callback);
void playCloudDataWithStartTime(long mStartTime, long mEndTime, boolean isEvent, OperationCallBack callback, OperationCallBack playFinishedCallBack);
Java:
// Check if cloud storage is supported.
IThingIPCCloud cloud = ThingIPCSdk.getCloud();
if (cloud != null) {
isSupportCloudStorage = cloud.isSupportCloudStorage(devId);
}
// Create a camera object.
IThingCloudCamera cloudCamera;
if (cloud != null) {
cloudCamera = cloud.createCloudCamera();
}
// Initialize the device.
cloudCamera.createCloudDevice(cachePath, devId);
ThingCameraView mVideoView = findViewById(R.id.camera_video_view);
// Set the callback for the view rendering container.
mVideoView.setViewCallback(new AbsVideoViewCallback() {
@Override
public void onCreated(Object view) {
super.onCreated(view);
// When the rendering view is constructed, bind it to IThingCloudCamera.
if (null != cloudCamera){
cloudCamera.generateCloudCameraView(view);
}
}
});
// Construct the rendering view.
mVideoView.createVideoView(devId);
// Register a listener with IThingCloudCamera to ensure the video feed is displayed correctly.
cloudCamera.registorOnP2PCameraListener(new AbsP2pCameraListener() {
@Override
public void onSessionStatusChanged(Object camera, int sessionId, int sessionStatus) {
super.onSessionStatusChanged(camera, sessionId, sessionStatus);
}
});
// Check cloud storage activation.
cloudCamera.queryCloudServiceStatus(devId, new IThingResultCallback<CloudStatusBean>() {
@Override
public void onSuccess(CloudStatusBean result) {
//Get cloud storage status
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Get video clips.
CloudDayBean dayBean = dayBeanList.get(0);
cloudCamera.getTimeLineInfo(devId, dayBean.getCurrentStartDayTime(), dayBean.getCurrentDayEndTime(), new IThingResultCallback<List<TimePieceBean>>() {
@Override
public void onSuccess(List<TimePieceBean> result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Play clip
cloudCamera.playCloudDataWithStartTime(startTime, endTime, isEvent,
new OperationCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data, Object camera) {
// Callback during playback, playing
}
@Override
public void onFailure(int sessionId, int requestId, int errCode, Object camera) {
}
}, new OperationCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data, Object camera) {
// Callback when playback completes, playCompleted
}
@Override
public void onFailure(int sessionId, int requestId, int errCode, Object camera) {
}
});
// Stop playing.
cloudCamera.stopPlayCloudVideo(new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
// Release the camera object when the page is closed.
// Deinitialize.
cloudCamera.deinitCloudCamera();
// Remove listener.
cloudCamera.removeOnP2PCameraListener();
// Destroy.
cloudCamera.destroy();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback