WOWZCameraPreview

Superclass:
NSObject
Declared In:

Introduction

The WOWZCameraPreview class allows you to preview video captured from a camera device.



Methods

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

deviceCameras


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

The array of WOWZCamera objects.

Discussion

Gets an array of the WOWZCamera objects available on the 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 the preview.

Return Value

An initialized WOWZCameraPreview object.

Discussion

Initializes a WOWZCameraPreview object.


isSwitchCameraAvailableForConfig:


Parameters
config

The WOWZMediaConfig to test for support by the other camera.

Return Value

Yes if the device has another camera that supports the specified WOWZMediaConfig, no otherwise.

Discussion

Indicates whether another camera is available on the device and whether that camera supports the specified WOWZMediaConfig.


numberOfDeviceCameras


+ (NSInteger) numberOfDeviceCameras; 
Return Value

The number of cameras available.

Discussion

Gets the number of cameras available on the device.


otherCamera


- (nullable WOWZCamera *) otherCamera; 
Return Value

The reference to the camera not in use, or nil if there's only one camera.

Discussion

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


startPreview


- (void) startPreview; 
Discussion

Starts previewing the video stream.


stopPreview


- (void) stopPreview; 
Discussion

Stops previewing the video stream.


switchCamera


- (nonnull WOWZCamera *) switchCamera; 
Return Value

The device's other camera, if it exists and supports the current config; otherwise, the same camera.

Discussion

Switches to the device's other camera.


Typedefs

NS_ENUM
WOWZCameraPreviewGravity

NS_ENUM


typedef NS_ENUM(NSUInteger, WOWZCameraPreviewGravity) { 
    WOWZCameraPreviewGravityResizeAspect = 0, WOWZCameraPreviewGravityResizeAspectFill, 
    WOWZCameraPreviewGravityResize 
}; 
Constants
WOWZCameraPreviewGravityResizeAspect

Preserve aspect ratio; fit within layer bounds.

WOWZCameraPreviewGravityResizeAspectFill

Preserve aspect ratio; fill layer bounds.

WOWZCameraPreviewGravityResize

Stretch to fill layer bounds.

Discussion

Describes how the video should fill the preview frame.

See Also


WOWZCameraPreviewGravity


typedef NS_ENUM(NSUInteger, WOWZCameraPreviewGravity) { 
    WOWZCameraPreviewGravityResizeAspect = 0, WOWZCameraPreviewGravityResizeAspectFill, 
    WOWZCameraPreviewGravityResize 
}; 
Constants
WOWZCameraPreviewGravityResizeAspect

Preserve aspect ratio; fit within layer bounds.

WOWZCameraPreviewGravityResizeAspectFill

Preserve aspect ratio; fill layer bounds.

WOWZCameraPreviewGravityResize

Stretch to fill layer bounds.

Discussion

Describes how the video should fill the preview frame.

See Also


Properties

camera
cameras
config
previewActive
previewGravity
previewLayer

camera


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

The active camera.


cameras


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

The array of WOWZCamera objects available on the device.


config


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

The active config for the camera.


previewActive


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

Indicates whether a video is actively previewing.


previewGravity


@property (nonatomic,
    assign) WOWZCameraPreviewGravity previewGravity; 
Discussion

The preview gravity to use to display the video preview. Preview gravity describes how the video should fill the available screen area.


previewLayer


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

The AV Foundation preview layer. Null until startPreview is called.