IVSImageDevice

Objective-C

@protocol IVSImageDevice <IVSDevice>

Swift

protocol IVSImageDevice : IVSDevice

This represents an IVSDevice that provides video samples.

  • Sets the current rotation of the video device. This will be used to transform the output stream

    This is handled automatically when attaching a camera via an IVSDeviceDescriptor.

    Declaration

    Objective-C

    - (void)setHandsetRotation:(float)rotation;

    Swift

    func setHandsetRotation(_ rotation: Float)

    Parameters

    rotation

    The rotation in radians

  • Gets a view that will render a preview image of this device.

    Note

    this must be called on the main thread

    Declaration

    Objective-C

    - (nullable IVSImagePreviewView *)previewViewWithError:
        (NSError *_Nullable *_Nullable)outError;

    Swift

    func previewView() throws -> IVSImagePreviewView

    Parameters

    outError

    On input, a pointer to an error object. If an error occurs, the pointer is an NSError object that describes the error. If you don’t want error information, pass in nil.

  • Gets a view that will render a preview image of this device with the provided aspect ratio.

    Note

    this must be called on the main thread

    Declaration

    Objective-C

    - (nullable IVSImagePreviewView *)
        previewViewWithAspectMode:(IVSAspectMode)aspectMode
                            error:(NSError *_Nullable *_Nullable)outError;

    Swift

    func previewView(with aspectMode: IVSBroadcastConfiguration.AspectMode) throws -> IVSImagePreviewView

    Parameters

    aspectMode

    the aspect mode to apply to the image stream rendering on the view.

    outError

    On input, a pointer to an error object. If an error occurs, the pointer is an NSError object that describes the error. If you don’t want error information, pass in nil.

  • Set a callback to receive information about image frames as they move through this device. This will always be invoked on the main queue.

    Declaration

    Objective-C

    - (void)setOnFrameCallback:
        (nullable void (^)(IVSImageDeviceFrame *_Nonnull))callback;

    Swift

    func setOnFrameCallback(_ callback: ((IVSImageDeviceFrame) -> Void)?)

    Parameters

    callback

    that takes a IVSImageDeviceFrame

  • Create an AVSampleBufferDisplayLayer that will have sample buffers rendered to. The SDK handles all rendering and flushing and the host application should avoid calling anything that directly deals with rendering media samples.

    Note

    this does not respect the setHandsetRotation API. Any rotation will need to be applied manually to the layer, including the automatic front facing camera mirroring.

    Declaration

    Objective-C

    - (nonnull AVSampleBufferDisplayLayer *)createSampleBufferDisplayLayer;

    Swift

    func createSampleBufferDisplayLayer() -> AVSampleBufferDisplayLayer