WZCameraPreview

Superclass:
NSObject
Declared In:

Introduction

The WZCameraPreview class wraps a camera and a preview for previewing the video captured from a camera device



Methods

+deviceCameras
-initWithViewAndConfig:config:
-isSwitchCameraAvailableForConfig:
+numberOfDeviceCameras
-otherCamera
-startPreview
-stopPreview
-switchCamera

deviceCameras


+ (nonnull NSArray<WZCamera *> *) deviceCameras; 
Return Value

The array of WZCamera objects

Discussion

An array of WZCamera objects available on this device


initWithViewAndConfig:config:


- (nonnull instancetype) initWithViewAndConfig:(nonnull UIView *)containingView 
        config:(nonnull WowzaConfig *)aConfig; 
Parameters
containingView

The view to which the preview layer will be added

aConfig

The configuration settings for the camera and preview

Return Value

An initialized WZCameraPreview object

Discussion

Initialize a WZCameraPreview object


isSwitchCameraAvailableForConfig:


- (BOOL) isSwitchCameraAvailableForConfig:(nonnull WZMediaConfig *)config; 
Parameters
config

The WZMediaConfig for which to test the other camera's support

Return Value

YES if the other camera supports the given WZMediaConfig, otherwise NO

Discussion

Use to determine if there is another camera on the device and if so, does it support the given WZMediaConfig


numberOfDeviceCameras


+ (NSInteger) numberOfDeviceCameras; 
Return Value

Count of the number of cameras available

Discussion

The number of cameras available on this device


otherCamera


- (nullable WZCamera *) otherCamera; 
Return Value

A reference to the camera not currently in use, or nil if there is only one camera.

Discussion

Get a reference to the camera not currently in use, if the device has more than one camera.


startPreview


- (void) startPreview; 
Discussion

Start previewing the video stream


stopPreview


- (void) stopPreview; 
Discussion

Stop previewing the video stream


switchCamera


- (nonnull WZCamera *) switchCamera; 
Return Value

The camera switched to, or the current camera of the other camera either doesn't exist, or doesn't support the current config.

Discussion

Switch to the 'other' camera if there is another camara, and if the other camera supports the current config.


Typedefs

NS_ENUM
WZCameraPreviewGravity

NS_ENUM


typedef NS_ENUM(NSUInteger, WZCameraPreviewGravity) { 
    WZCameraPreviewGravityResizeAspect = 0, WZCameraPreviewGravityResizeAspectFill, 
    WZCameraPreviewGravityResize 
}; 
Constants
WZCameraPreviewGravityResizeAspect

Preserve aspect ratio; fit within layer bounds.

WZCameraPreviewGravityResizeAspectFill

Preserve aspect ratio; fill layer bounds.

WZCameraPreviewGravityResize

Stretch to fill layer bounds.

Discussion

Describes how the video preview should fill the video preview frame.

See Also


WZCameraPreviewGravity


typedef NS_ENUM(NSUInteger, WZCameraPreviewGravity) { 
    WZCameraPreviewGravityResizeAspect = 0, WZCameraPreviewGravityResizeAspectFill, 
    WZCameraPreviewGravityResize 
}; 
Constants
WZCameraPreviewGravityResizeAspect

Preserve aspect ratio; fit within layer bounds.

WZCameraPreviewGravityResizeAspectFill

Preserve aspect ratio; fill layer bounds.

WZCameraPreviewGravityResize

Stretch to fill layer bounds.

Discussion

Describes how the video preview should fill the video preview frame.

See Also


Properties

camera
cameras
config
previewActive
previewGravity
previewLayer

camera


@property (nonatomic,
    nullable) WZCamera* camera; 
Discussion

The active camera


cameras


@property (nonatomic,
    readonly,
    nullable) NSArray<WZCamera *> *cameras; 
Discussion

The array of WZCamera objects available on this device


config


@property (nonatomic,
    nonnull) WowzaConfig *config; 
Discussion

The active config for the camera


previewActive


@property (nonatomic,
    readonly,
    getter=isPreviewActive) BOOL previewActive; 
Discussion

Is video previewing currently active


previewGravity


@property (nonatomic,
    assign) WZCameraPreviewGravity previewGravity; 
Discussion

The preview gravity to use for displaying the video preview; describes how the prview will fill the given view bounds


previewLayer


@property (nonatomic,
    readonly,
    nullable) AVCaptureVideoPreviewLayer *previewLayer; 
Discussion

The AV Foundation preview layer. Will be null until startPreview is called.