Cloud Storage UI BizBundle

Last Updated on : 2023-09-19 03:01:05download

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 thing_custom_config.json is added to your main project directory, and the value of thingAppKey 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/tuya/tuya-pod-specs"
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'

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

Navigate to the subscription page

Step 1: Import the required header file

ObjC:

#import <ThingModuleServices/ThingCameraCloudServiceProtocol.h>

Swift:

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

#import <ThingModuleServices/ThingCameraCloudServiceProtocol.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, ThingSmartDeviceModel 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<ThingCameraCloudServiceProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingCameraCloudServiceProtocol)];
[impl requestCloudServicePageWithDevice:self.deviceModel completionBlock:^(__kindof UIViewController *page, NSError *error) {
    if (page) {
        [self.navigationController pushViewController:page animated:YES];
    }
}];

Swift:

let impl = ThingSmartBizCore.sharedInstance().service(of: ThingCameraCloudServiceProtocol.self)
(impl as? ThingCameraCloudServiceProtocol)?.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.