English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Cloud Storage UI BizBundle

Last Updated on : 2022-03-01 08:33:08download

Cloud-based storage of video data can be implemented for IP cameras (IPCs). You can integrate with Cloud Storage UI BizBundle and allow users to subscribe to the Cloud Storage for Videos service. Then, after the subscription, users can view and play cloud-stored video footage.

Before you start

  • Before the integration, get familiar with the preparation and process to integrate the UI BizBundle. For more information, see Integrate with Framework.

  • The file ty_custom_config.json is added to your main project directory, and the value of tyAppKey is specified as required. This avoids the failure to load the subscription page of the Cloud Storage for Videos service.

Integrate with the UI BizBundle

Add the components of the Cloud Storage UI BizBundle to the Podfile and run the command pod update.

source "https://github.com/TuyaInc/TuyaPublicSpecs.git"
source 'https://cdn.cocoapods.org/'

target 'your_target_name' do
# Adds the UI BizBundle.
pod 'TuyaSmartCloudServiceBizBundle'
end

Navigate to the subscription page

Step 1: Import the required header file

ObjC:

#import <TYModuleServices/TYCameraCloudServiceProtocol.h>

Swift:

Add the following content to the bridging header file xxx_Bridging-Header.h:

#import <TYModuleServices/TYCameraCloudServiceProtocol.h>

Step 2: Navigate to the subscription page

API description

  • Before the API call, make sure that the user has logged in to the app.

  • Each subscription to the Cloud Storage for Videos service is mapped to a unique device. To get the cloud storage service page, TuyaSmartDeviceModel of the device is required.

  • The Cloud Storage for Videos service page is returned as UIViewController. UINavigationController must be used to call the push or present method.

    • The Cloud Storage for Videos service is strongly correlated with user information.
    • The subscription page depends on the navigation controller, and navigation content settings are required. Therefore, the navigation controller must encapsulate the subscription page and navigation content.

Example

ObjC:

id<TYCameraCloudServiceProtocol> impl = [[TuyaSmartBizCore sharedInstance] serviceOfProtocol:@protocol(TYCameraCloudServiceProtocol)];
[impl requestCloudServicePageWithDevice:self.deviceModel completionBlock:^(__kindof UIViewController *page, NSError *error) {
	if (page) {
		[self.navigationController pushViewController:page animated:YES];
	}
}];

Swift:

let impl = TuyaSmartBizCore.sharedInstance().service(of: TYCameraCloudServiceProtocol.self)
(impl as? TYCameraCloudServiceProtocol)?.requestCloudServicePage(deviceModel, completionBlock: { (page, error) in
		guard let cloudServiceVc = page {
			print("\(error!)")
		return
	}
	yourNaviController.pushViewController(cloudServiceVc, animated: true)
})

View and play cloud-stored video footage

After the subscription to the Cloud Storage for Videos service, users can view and play cloud-stored video footage. For more information, see Cloud Storage.