Last Updated on : 2023-05-22 06:38:31download
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 unactivated or has expired, the cloud storage service must be purchased to enable the cloud storage service.
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:
To enable subscription to the cloud storage service, the Cloud Storage UI BizBundle must be integrated. This component provides the H5 pages and order display features for the subscription.
ITYCloudCamera
provides API methods to deal with cloud-stored video footage.
API description
Creates a cloud storage instance object.
ITYCloudCamera createCloudCamera();
Example
private ITYCloudCamera cloudCamera;
ITuyaIPCCloud cloud = TuyaIPCSdk.getCloud();
if (cloud != null) {
cloudCamera = cloud.createCloudCamera();
}
API description
void queryCloudServiceStatus(String devId, ITuyaResultCallback<CloudStatusBean> callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
callback | The callback. |
Example
cloudCamera.queryCloudServiceStatus(devId, new ITuyaResultCallback<CloudStatusBean>() {
@Override
public void onSuccess(CloudStatusBean result) {
//Get cloud storage status
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Data model of CloudStatusBean
Parameter | Description |
---|---|
status | The status code. Valid values:
|
API description
void getCloudDays(String devId, String timezoneId, ITuyaResultCallback<List<CloudDayBean>> callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
timezoneId | The time zone ID. |
Example
cloudCamera.getCloudDays(devId, TimeZone.getDefault().getID(), new ITuyaResultCallback<List<CloudDayBean>>() {
@Override
public void onSuccess(List<CloudDayBean> result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Data model of CloudDayBean
Parameter | Description |
---|---|
uploadDay | The date. |
currentDayStart | The start time of a period in which video clips are returned. |
currentDayEnd | The end time of a period in which video clips are returned. |
API description
void getTimeLineInfo(String devId, long timeGT, long timeLT, ITuyaResultCallback<List<TimePieceBean>> callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
timeGT | The 10-digit start timestamp. |
timeLT | The 10-digit end timestamp. |
callback | The callback. |
Example
CloudDayBean dayBean = dayBeanList.get(0);
cloudCamera.getTimeLineInfo(devId, dayBean.getCurrentStartDayTime(), dayBean.getCurrentDayEndTime(), new ITuyaResultCallback<List<TimePieceBean>>() {
@Override
public void onSuccess(List<TimePieceBean> result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
API description
void getMotionDetectionInfo(String devId, long timeGT, long timeLT, int offset, int limit, ITuyaResultCallback<List<TimeRangeBean>> callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
timeGT | The 10-digit start timestamp. |
timeLT | The 10-digit end timestamp. |
offset | The page number starting from which target data is returned. Default value: 0 . |
limit | The maximum number of entries to be returned at a time. Default value: -1 to return all data. |
callback | The callback. |
Example
CloudDayBean dayBean = dayBeanList.get(0);
cloudCamera.getMotionDetectionInfo(devId, dayBean.getCurrentStartDayTime(), dayBean.getCurrentDayEndTime(), offset, limit, new ITuyaResultCallback<List<TimeRangeBean>>() {
@Override
public void onSuccess(List<TimeRangeBean> result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
The screenshots of cloud storage events are encrypted before they can be displayed by the image encryption component. For more information, see Encrypted Images.
This API method is no longer maintained. You can integrate with Cloud Storage UI BizBundle to implement the subscription.
API description
public void buyCloudStorage(Context mContext, DeviceBean deviceBean, String homeId, ICloudManagerCallback callback) {
CameraCloudManager.getInstance().getCloudStorageUrl(mContext, deviceBean, homeId);
}
Parameters
Parameter | Description |
---|---|
mContext | The context. |
deviceBean | The information about the device. |
homeId | The home ID. |
callback | The callback. |
Example
cameraCloudSDK.buyCloudStorage(CameraCloudStorageActivity.this,
TuyaHomeSdk.getDataInstance().getDeviceBean(devId),
String.valueOf(FamilyManager.getInstance().getCurrentHomeId()), new ICloudManagerCallback() {
@Override
public void onError(int i) {
}
@Override
public void onSuccess(Object o) {
String uri = (String) o;
Intent intent = new Intent(CameraCloudStorageActivity.this, WebViewActivity.class);
intent.putExtra("Uri",uri);
startActivity(intent);
}
});
Error code | Description |
---|---|
10100 | Failed to get the data of SECRET . |
10101 | Failed to get the data of AUTH . |
10110 | Other errors have occurred while processing your request. |
10010 | Failed to get the authentication information. |
10011 | Failed to get the video clip (authentication information) on the specified date. |
Creates a device object.
API description
void createCloudDevice(String cachePath, String devId)
Parameters
Parameter | Description |
---|---|
cachePath | The path through which video data is cached. |
devId | The device ID. |
Example
cloudCamera.createCloudDevice(cachePath, devId);
API description
void deinitCloudCamera();
Example
cloudCamera.deinitCloudCamera();
API description
public void onDestroy();
Example
cloudCamera.onDestroy();
Registers a listener with ITYCloudCamera
. Otherwise, video images cannot be displayed as expected.
API description
void registerP2PCameraListener(AbsP2pCameraListener listener);
Parameters
Parameter | Description |
---|---|
listener | The callback that is executed when a P2P smart camera listener is registered. |
Example
cloudCamera.registerP2PCameraListener(new AbsP2pCameraListener() {
@Override
public void onSessionStatusChanged(Object camera, int sessionId, int sessionStatus) {
super.onSessionStatusChanged(camera, sessionId, sessionStatus);
}
});
API description
void removeOnP2PCameraListener();
Example
cloudCamera.removeOnP2PCameraListener();
API description
void generateCloudCameraView(IRegistorIOTCListener view);
Parameters
Parameter | Description |
---|---|
view | The player component. |
Example
cloudCamera.generateCloudCameraView(mVideoView);
API description
void playCloudDataWithStartTime(long mStartTime, long mEndTime, boolean isEvent, OperationCallBack callback, OperationCallBack playFinishedCallBack);
Parameters
Parameter | Description |
---|---|
mStartTime | The 10-digit start timestamp. |
mEndTime | The 10-digit end timestamp of the period in which video clips are played back. By default, it is the end timestamp of the current date. |
isEvent | Indicates whether motion detection video clips are played back. Default value: false . |
callBack | The playback callback. |
playFinishedCallBack | The callback that is used when playback is ended. |
Example
cloudCamera.playCloudDataWithStartTime(startTime, endTime, isEvent,
new OperationCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data, Object camera) {
// The callback that is executed when video clips are being played back. `playing` is returned.
}
@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) {
// The callback that is executed when playback is ended. `playCompleted` is returned.
}
@Override
public void onFailure(int sessionId, int requestId, int errCode, Object camera) {
}
});
API description
int pausePlayCloudVideo(OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
callBack | The callback. |
Example
cloudCamera.pausePlayCloudVideo(new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
API description
int resumePlayCloudVideo(OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
callBack | The callback. |
Example
cloudCamera.resumePlayCloudVideo(new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
API description
int stopPlayCloudVideo(OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
callBack | The callback. |
Example
cloudCamera.stopPlayCloudVideo(new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
API description
void startCloudDataDownload(long startTime, long stopTime, String folderPath, String mp4FileName,
OperationCallBack callback, ProgressCallBack progressCallBack, OperationCallBack finishedCallBack);
Parameters
Parameter | Description |
---|---|
startTime | The 10-digit start timestamp of the period in which video clips are downloaded. |
stopTime | The 10-digit end timestamp of the period in which video clips are downloaded. |
folderPath | The path through which the video clips are stored. |
mp4FileName | The name of the target video file. |
callback | The callback. |
progressCallBack | The callback for the download progress. |
finishedCallBack | The callback that is executed when download is ended. |
API description
void stopCloudDataDownload(OperationCallBack callBack);
Parameters
Parameter | Description |
---|---|
callBack | The callback. |
API description
void deleteCloudVideo(long timeGT, long timeLT, String timeZone, final ITuyaResultCallback<String> listener);
Parameters
Parameter | Description |
---|---|
timeGT | The 10-digit start timestamp. |
timeLT | The end time. |
timeZone | The time zone. |
listener | The callback. |
API description
int startRecordLocalMp4(String folderPath, String fileName, OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
folderPath | The directory in which the video file is stored. |
fileName | The name of the video file. |
callBack | The callback. |
Example
cloudCamera.startRecordLocalMp4(IPCCameraUtils.recordPath(devId), String.valueOf(System.currentTimeMillis()), new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
Toast.makeText(CameraCloudStorageActivity.this, "record start success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
API description
int stopRecordLocalMp4(OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
callBack | The callback. |
Example
cloudCamera.stopRecordLocalMp4(new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
Toast.makeText(CameraCloudStorageActivity.this, "record end success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
Cloud-stored video playback supports additional features, such as the audio switch and screenshots.
API description
int getCloudMute();
Example
cloudCamera.getCloudMute()
API description
void setCloudMute(final int mute, OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
mute | Specifies whether to mute the video. Valid values:
|
callBack | The callback. |
Example
cloudCamera.setCloudMute(mute, new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
soundState = Integer.valueOf(data);
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
API description
int snapshot(String absoluteFilePath, OperationDelegateCallBack callBack);
Parameters
Parameter | Description |
---|---|
absoluteFilePath | The URL of the screenshot file. |
callBack | The callback. |
Example
cloudCamera.snapshot(IPCCameraUtils.recordSnapshotPath(devId), new OperationDelegateCallBack() {
@Override
public void onSuccess(int sessionId, int requestId, String data) {
Toast.makeText(CameraCloudStorageActivity.this, "snapshot success", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int sessionId, int requestId, int errCode) {
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback