ActionCamera

@objc public class ActionCamera: NSObject, AsyncSocketListener, NSURLSessionDownloadDelegate

Present an YI action camera.

This class presents an YI action camera. App can invoke its functions to control the camera. Like start recording, stop recording, take picture, read settings, set settings, etc. Before operating an camera, App need invoke ActionCamera.connect(connectionString:) to connect to the camera. After connect success (ActionCameraListener.onConnected() will be invoked), app can invoke other functions. Whenever app wants to disconnect from the camera, app can invoke ActionCamera.disconnect().

Any success or fail callback in commands are optional parameter. If you don’t care command execution result, you can pass nil.

  • Constructor of ActionCamera.

    When app creates an ActionCamera object, app need specify a listener which will receive the camera notifications and a message queue which will be used to dispatch the notification. Recommend app uses the same message queue as UI thread using. So that all notifications will be passed in UI thread and app can update UI directly in the callback of notifications.

    • Parameters:
      • listener: The listener will be used to receive notification from the camera.
      • workThreadQueue: The message queue will be used to dispatch camera notifications.

    Declaration

    Swift

    public init(listener: ActionCameraListener, dispatchQueue: DispatchQueue)

    Parameters

    listener

    The listener will be used to receive notification from the camera.

    workThreadQueue

    The message queue will be used to dispatch camera notifications.

  • Connect to a YI action camera.

    Invoke this function to connect to a YI action camera. Param connectionString represents the address of the remote camera. Format is:

    tcp:<ip address>:<port>
    

    If the camera has been connected or the previous connect operation hasn’t been finished. Nothing will happen. Otherwise connect operation will be executed asynchronously. If success, ActionCameraListener.onConnected() callback will be invoked. If fail, ActionCameraListener.onClosed(error:) callback will be invoked and parameter error will be set.

    Declaration

    Swift

    public func connect(connectionString connectionString: String)
  • Get rtsp url of camera. If camera is not connected, will return nil.

    Declaration

    Swift

    public func getRtspURL() -> String?
  • Download file from camera.

    • Parameters:
      • fileName: The file you want to download from camera.
      • destFilePath: The file destination file path. Need to be a full path.
      • success: This callback will be invoked multiple times to notify the progress.
      • fail: This callback will be invoked if download failed.

    Declaration

    Swift

    public func downloadFile(fileName fileName: String, destFilePath: String, success: ((DownloadTask) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    fileName

    The file you want to download from camera.

    destFilePath

    The file destination file path. Need to be a full path.

    success

    This callback will be invoked multiple times to notify the progress.

    fail

    This callback will be invoked if download failed.

  • Cancel current download task.

    Declaration

    Swift

    public func cancelDownlad() -> ActionCamera
  • Build QR code for doing live video

    • Parameters:
      • ssid: The SSID of the WIFI.
      • password: The password of the WIFI.
      • resolution: The resolution of live broadcast.
      • bitrate: The bitrate of live broadcast.
      • duration: The duration of live broadcast (unit is second). 0 means forever.
      • rtmpUrl: The rtmp url of live broadcast. Should be started with rtmp://.

    Declaration

    Swift

    public func buildLiveVideoQRCode(ssid ssid: String, password: String, resolution: LiveVideoResolution, bitrate: LiveVideoBitrate, duration: Int, rtmpUrl: String) throws -> CIImage

    Parameters

    ssid

    The SSID of the WIFI.

    password

    The password of the WIFI.

    resolution

    The resolution of live broadcast.

    bitrate

    The bitrate of live broadcast.

    duration

    The duration of live broadcast (unit is second). 0 means forever.

    rtmpUrl

    The rtmp url of live broadcast. Should be started with “rtmp://”.

  • Undocumented

    Declaration

    Swift

    @objc public class ActionCamera: NSObject, AsyncSocketListener, NSURLSessionDownloadDelegate
  • Disconnect from YI action camera.

    Invoke this function to disconnect from a YI action camera. This function will return immediately and the disconnect operation will be executed asynchronously. All pending commands will be cancelled (the fail callback of the command will be invoked and the code of error parameter will be set to ErrorCode.Cancelled). At the end, ActionCameraListener.onClosed(error:) callback will be invoked and error parameter will be set to nil.

    Declaration

    Swift

    public func disconnect()
  • Get photo white balance.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoWhiteBalance(success success: ((WhiteBalance) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo white balance.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoWhiteBalance(whiteBalance whiteBalance: WhiteBalance, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video white balance.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoWhiteBalance(success success: ((WhiteBalance) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video white balance.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoWhiteBalance(whiteBalance whiteBalance: WhiteBalance, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get photo iso.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoISO(success success: ((ISO) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo iso.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoISO(iso iso: ISO, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video iso.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoISO(success success: ((ISO) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video iso.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoISO(iso iso: ISO, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get photo exposure value.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoExposureValue(success success: ((ExposureValue) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo exposure value.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoExposureValue(ev ev: ExposureValue, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video exposure value.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoExposureValue(success success: ((ExposureValue) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video exposure value.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoExposureValue(ev ev: ExposureValue, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get photo shutter time.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoShutterTime(success success: ((ShutterTime) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo shutter time.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoShutterTime(shutterTime shutterTime: ShutterTime, success: (()->())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video field of view.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoFieldOfView(success success: ((FieldOfView) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video field of view.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoFieldOfView(fieldOfView fieldOfView: FieldOfView, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get metering mode.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getMeteringMode(success success: ((MeteringMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set metering mode.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setMeteringMode(meteringMode meteringMode: MeteringMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video quality.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoQuality(success success: ((Quality) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video quality.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoQuality(quality quality: Quality, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video color mode.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoColorMode(success success: ((ColorMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video quality.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoColorMode(colorMode colorMode: ColorMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get photo color mode.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoColorMode(success success: ((ColorMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo color mode.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoColorMode(colorMode colorMode: ColorMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video sharpness.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoSharpness(success success: ((Sharpness) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video sharpness.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoSharpness(sharpness sharpness: Sharpness, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get photo sharpness.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoSharpness(success success: ((Sharpness) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo sharpness.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoSharpness(sharpness sharpness: Sharpness, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get electronic image stabilization state.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getElectronicImageStabilizationState(success success: ((ToggleState) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set electronic image stabilization state.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setElectronicImageStabilizationState(state state: ToggleState, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video timestamp setting.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoTimestamp(success success: ((Timestamp) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set video timestamp setting.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoTimestamp(timestamp timestamp: Timestamp, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get photo timestamp setting.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoTimestamp(success success: ((Timestamp) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set photo timestamp setting.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoTimestamp(timestamp timestamp: Timestamp, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get video mute state.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoMuteState(success success: ((ToggleState) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set video mute state.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoMuteState(state state: ToggleState, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get LED mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getLEDMode(success success: ((LEDMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set LED mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setLEDMode(ledMode ledMode: LEDMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get video standard.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoStandard(success success: ((VideoStandard) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set video standard.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoStandard(videoStandard videoStandard: VideoStandard, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get screen auto lock

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getScreenAutoLock(success success: ((ScreenAutoLock) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set screen auto lock.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setScreenAutoLock(screenAutoLock screenAutoLock: ScreenAutoLock, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get auto power off.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getAutoPowerOff(success success: ((AutoPowerOff) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set auto power off.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setAutoPowerOff(autoPowerOff autoPowerOff: AutoPowerOff, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get video rotate mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoRotateMode(success success: ((VideoRotateMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set video rotate mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoRotateMode(mode mode: VideoRotateMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get buzzer volume.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getBuzzerVolume(success success: ((BuzzerVolume) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set buzzer volume.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setBuzzerVolume(buzzerVolume buzzerVolume: BuzzerVolume, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get record mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getRecordMode(success success: ((RecordMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set record mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setRecordMode(recordMode recordMode: RecordMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get capture mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getCaptureMode(success success: ((CaptureMode) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set capture mode.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setCaptureMode(captureMode captureMode: CaptureMode, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get time lapse video interval.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getTimeLapseVideoInterval(success success: ((TimeLapseVideoInterval) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set time lapse video interval.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setTimeLapseVideoInterval(interval interval: TimeLapseVideoInterval, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get time lapse photo interval.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getTimeLapsePhotoInterval(success success: ((TimeLapsePhotoInterval) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set time lapse video interval.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setTimeLapsePhotoInterval(interval interval: TimeLapsePhotoInterval, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get time lapse video duration.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func getTimeLapseVideoDuration(success success: ((TimeLapseVideoDuration) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Set time lapse video duration.

    • Parameters:
      • success: If command execute success, this callback will be invoked.
      • fail: If command execute fail, this callback will be invoked.

    Declaration

    Swift

    public func setTimeLapseVideoDuration(duration duration: TimeLapseVideoDuration, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command execute success, this callback will be invoked.

    fail

    If command execute fail, this callback will be invoked.

  • Get current video resolution.

    • Parameters:
      • success: If command executes success, this callback will be invoked and parameter is current video resolution.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getVideoResolution(success success: ((VideoResolution) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked and parameter is current video resolution.

    fail

    If command executes fail, this callback will be invoked.

  • Stop view finder.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func stopViewFinder(success success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get current video resolution.

    • Parameters:
      • success: If command executes success, this callback will be invoked and parameter is current video resolution.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setVideoResolution(resolution resolution: VideoResolution, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked and parameter is current video resolution.

    fail

    If command executes fail, this callback will be invoked.

  • Get camera file list.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getFileList(success success:(([File]) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Stop recording on camera.

    • Parameters:
      • success: If command executes success, this callback wil be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func stopRecording(success success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback wil be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set camera system mode.

    • Parameters:
      • mode: System mode supported by YI action camera.
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setSystemMode(mode mode: SystemMode, success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    mode

    System mode supported by YI action camera.

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get current photo resolution.

    • Parameters:
      • success: If command executes success, this callback will be invoked and parameter is current video resolution.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setPhotoResolution(photoResolution photoResolution: PhotoResolution, success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked and parameter is current video resolution.

    fail

    If command executes fail, this callback will be invoked.

  • Delete file from camera.

    • Parameters:
      • fileName: Filename you want to delete from camera.
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func deleteFile(fileName fileName: String, success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    fileName

    Filename you want to delete from camera.

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Set datetime to camera.

    • Parameters:
      • datetime: The datetime you want to set to camera.
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func setDateTime(datetime datetime: NSDate, success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    datetime

    The datetime you want to set to camera.

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Format sd card.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func formatSDCard(success success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get camera current status.

    • Parameters:
      • success: If command executes success, this callback will be invoked and parameter is current status of camera.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getStatus(success success: ((CameraStatus) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked and parameter is current status of camera.

    fail

    If command executes fail, this callback will be invoked.

  • Get current photo resolution.

    • Parameters:
      • success: If command executes success, this callback will be invoked and parameter is current photo size.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getPhotoResolution(success success: ((PhotoResolution) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked and parameter is current photo size.

    fail

    If command executes fail, this callback will be invoked.

  • Start view finder.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func startViewFinder(success success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Get camera settings.

    • Parameters:
      • success: If command executes success, this callback will be invoked and parameter is the settings of camera.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func getSettings(success success: ((ActionCameraSettings) -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked and parameter is the settings of camera.

    fail

    If command executes fail, this callback will be invoked.

  • Start recording immediately.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func startRecording(success success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Start recording at specific time.

    • Parameters:
      • hour: Start recording at this hour.
      • minute: Start recording at this minute.
      • second: Start recording at this second.
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func startRecording(hour hour: Int, minute: Int, second: Int,
                                   success: (() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    hour

    Start recording at this hour.

    minute

    Start recording at this minute.

    second

    Start recording at this second.

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.

  • Take a picture on camera.

    • Parameters:
      • success: If command executes success, this callback will be invoked.
      • fail: If command executes fail, this callback will be invoked.

    Declaration

    Swift

    public func capturePhoto(success success:(() -> ())?, fail: ((Error) -> ())?) -> ActionCamera

    Parameters

    success

    If command executes success, this callback will be invoked.

    fail

    If command executes fail, this callback will be invoked.