关键示例

更新时间:2024-06-13 09:56:54下载pdf

涂鸦门锁 SDK 提供 Wi-Fi 智能门锁的实时视频查看和对讲等基础能力。

实时视频查看和对讲

演示录屏 接口 描述
ThingSmartWiFiLockDevice - (void)startPreviewWithDefinition :success:failure; 开始播放实时视频
ThingSmartWiFiLockDevice - (void)stopPreview; 停止播放实时视频
ThingSmartWiFiLockDevice - (void)startTalk;
- (void)stopTalk;
开启对讲/关闭对讲

当不再使用相关功能时,调用销毁方法,避免程序发生异常。拿到 ThingSmartWi-FiLockDevice 对象,分别调用 stopPreviewstopTalkdealloc 等方法进行销毁。

示例代码

实时视频查看请求

//初始化
self.lockDevice = [[ThingSmartWi-FiLockDevice alloc] initWithDeviceId:self.device.deviceModel.devId];
//设置代理
self.lockDevice.delegate = self;

[self.lockDevice startPreviewWithDefinition:0x2
     //TODO
  } failure:^(NSError *error) {
    //TODO
}];

[self.lockDevice stopPreview];

发起对讲请求

///Event Handler
- (void)buttonClick_StartTalk:(id)sender {
    BOOL isTalking = [self.lockDevice isTalking];
    BOOL isSupportedTalk = [self.lockDevice isSupportedTalk];

    if(!isTalking && isSupportedTalk){
        [self.lockDevice startTalk];
    }
}

- (void)dealloc {
   [self.lockDevice stopTalk];
}