WZMediaConfig

Conforms to:
NSMutableCopying, NSCopying, NSCoding
Superclass:
NSObject
Declared In:

Introduction

The WZMediaConfig class provides configuration properties for the capture and encoding of video and audio



Methods

+AVCaptureSessionPresetFromPreset:
+CGSizeFromPreset:
+closestAVCaptureSessionPresetByWidth:
-copyTo:
-equals:
-initWithPreset:
-isLandscape
-isPortrait
-loadPreset:
+presetConfigs
+presets
-toAVCaptureSessionPreset
-toClosestAVCaptureSessionPreset
-toClosestPreset
-toPreset

AVCaptureSessionPresetFromPreset:


+ (nullable NSString *) AVCaptureSessionPresetFromPreset:(WZFrameSizePreset)wzPreset; 
Parameters
wzPreset

The WZFrameSizePreset to be converted.

Return Value

The AVFoundation AVCaptureSessionPreset string that corresponds to the given WZFrameSizePreset.

Discussion

Converts a WZFrameSizePreset to an AVFoundation AVCaptureSessionPreset string.


CGSizeFromPreset:


+ (CGSize) CGSizeFromPreset:(WZFrameSizePreset)preset; 
Parameters
preset

The WZFrameSizePreset to be converted.

Return Value

The CGSize which corresponds to the given WZFrameSizePreset.

Discussion

Converts a WZFrameSizePreset to the corresponding CGSize for that preset.


closestAVCaptureSessionPresetByWidth:


+ (nullable NSString *) closestAVCaptureSessionPresetByWidth:(NSUInteger)width; 
Parameters
width

The width being matched.

Return Value

The closest AVFoundation AVCaptureSessionPreset string matching the given width.

Discussion

Given a width, returns the AVFoundation AVCaptureSessionPreset string that most closely matches that width.


copyTo:


- (void) copyTo:(nonnull WZMediaConfig *)other; 
Parameters
other

The WZMediaConfig being copied to

Discussion

Copy the reciever's settings to the given WZMediaConfig


equals:


- (BOOL) equals:(nonnull WZMediaConfig *)other; 
Parameters
other

The other WZMediaConfig to test against

Return Value

YES if both the receiver and given config are equal; otherwise NO

Discussion

Tests the reciever for equality to the given WZMediaConfig


initWithPreset:


- (nonnull instancetype) initWithPreset:(WZFrameSizePreset)preset; 
Parameters
preset

The frame size preset

Return Value

An instance of WZMediaConfig with the specified frame size and recommended bitrate for that frame size.

Discussion

Initialize a new WZMediaConfig with a given preset


isLandscape


- (BOOL) isLandscape; 
Return Value

Yes if the receiver's frame size is landscape; otherwise NO

Discussion

Determine whether the frame size for the receiver describes a landscape orientation


isPortrait


- (BOOL) isPortrait; 
Return Value

Yes if the receiver's frame size is portrait; otherwise NO

Discussion

Determine whether the frame size for the receiver describes a portrait orientation


loadPreset:


- (void) loadPreset:(WZFrameSizePreset)preset; 
Parameters
preset

The frame size preset

Discussion

Sets the frame size of the receiver with that described by a WZFrameSizePreset, as well as the recommended bitrate for that frame size.


presetConfigs


+ (nonnull NSArray *) presetConfigs; 
Return Value

The array of WZMediaConfig objects.

Discussion

Returns an array of WZMediaConfig objects for each WZFrameSizePreset.


presets


+ (nonnull NSArray *) presets; 
Return Value

The array of NSNumber values

Discussion

Returns an array of NSNumber values for each WZFrameSizePreset


toAVCaptureSessionPreset


- (nullable NSString *) toAVCaptureSessionPreset; 
Return Value

The corresponding AVFoundation AVCaptureSessionPreset string for this config.

Discussion

Get the receiver's corresponding AVFoundation AVCaptureSessionPreset string


toClosestAVCaptureSessionPreset


- (nonnull NSString *) toClosestAVCaptureSessionPreset; 
Return Value

The closest corresponding AVFoundation AVCaptureSessionPreset string.

Discussion

Get the receiver's closest corresponding AVFoundation AVCaptureSessionPreset string


toClosestPreset


- (WZFrameSizePreset) toClosestPreset; 
Return Value

The closest corresponding WZFrameSizePreset

Discussion

Get the receiver's closest corresponding WZFrameSizePreset


toPreset


- (WZFrameSizePreset) toPreset; 
Return Value

The corresponding WZFrameSizePreset

Discussion

Get the receiver's corresponding WZFrameSizePreset


Typedefs

NS_ENUM
NS_ENUM
NS_ENUM
NS_ENUM
WZAudioChannels
WZBroadcastOrientation
WZBroadcastScaleMode
WZFrameSizePreset

NS_ENUM


private

typedef NS_ENUM(NSUInteger, WZFrameSizePreset) { WZFrameSizePreset352x288, WZFrameSizePreset640x480, WZFrameSizePreset1280x720, WZFrameSizePreset1920x1080, WZFrameSizePreset3840x2160, WZFrameSizePresetCount };
Constants
WZFrameSizePreset352x288

352 x 288 frame size.

WZFrameSizePreset640x480

640 x 480 frame size.

WZFrameSizePreset1280x720

1280 x 720 frame size (720p).

WZFrameSizePreset1920x1080

1920 x 1080 frame size (1080p).

WZFrameSizePreset3840x2160

3840 x 2160 frame size (UHD 4K).

WZFrameSizePresetCount

Count of known frame sizes

Discussion

Frame size presets availabe at compile time. Note that not all of these presets are guarenteed to be supported by a particular device or device camera.

See Also


NS_ENUM


private

typedef NS_ENUM(NSUInteger, WZBroadcastOrientation) { WZBroadcastOrientationSameAsDevice, WZBroadcastOrientationAlwaysLandscape, WZBroadcastOrientationAlwaysPortrait };
Constants
WZBroadcastOrientationAlwaysLandscape

Always broadcast in landscape orientation.

WZBroadcastOrientationAlwaysPortrait

Always broadcast in portrait orientation.

WZBroadcastOrientationSameAsDevice

The broadcast orientation will be set according to the orientation of the device at broadcast start time.

Discussion

Describes the orientation of the broadcasted video.

See Also


NS_ENUM


private

typedef NS_ENUM(NSUInteger, WZBroadcastScaleMode) { WZBroadcastScaleModeAspectFit, WZBroadcastScaleModeAspectFill };
Constants
WZBroadcastScaleModeAspectFit

Captured frames that don't fit within the requested broadcast frame size will be scaled to fit within the broadcast frame

WZBroadcastScaleModeAspectFill

Captured frames that don't fit within the requested broadcast frame size will be scaled up to completely fill the broadcast frame.

Discussion

Describes how captured frames that don't exactly fit the requested broadcast frame size will be adjusted to fit within the requested frame size.

See Also


NS_ENUM


private

typedef NS_ENUM(NSUInteger, WZAudioChannels) { WZAudioChannelsMono = 1, WZAudioChannelsStereo = 2 };
Constants
WZAudioChannelsMono

Mono, or single channel.

WZAudioChannels

Stereo, or two-channel.

Discussion

Number of audio channels. Note that not all of these channel counts are guarenteed to be supported by a particular device.

See Also


WZAudioChannels


private

typedef NS_ENUM(NSUInteger, WZAudioChannels) { WZAudioChannelsMono = 1, WZAudioChannelsStereo = 2 };
Constants
WZAudioChannelsMono

Mono, or single channel.

WZAudioChannels

Stereo, or two-channel.

Discussion

Number of audio channels. Note that not all of these channel counts are guarenteed to be supported by a particular device.

See Also


WZBroadcastOrientation


private

typedef NS_ENUM(NSUInteger, WZBroadcastOrientation) { WZBroadcastOrientationSameAsDevice, WZBroadcastOrientationAlwaysLandscape, WZBroadcastOrientationAlwaysPortrait };
Constants
WZBroadcastOrientationAlwaysLandscape

Always broadcast in landscape orientation.

WZBroadcastOrientationAlwaysPortrait

Always broadcast in portrait orientation.

WZBroadcastOrientationSameAsDevice

The broadcast orientation will be set according to the orientation of the device at broadcast start time.

Discussion

Describes the orientation of the broadcasted video.

See Also


WZBroadcastScaleMode


private

typedef NS_ENUM(NSUInteger, WZBroadcastScaleMode) { WZBroadcastScaleModeAspectFit, WZBroadcastScaleModeAspectFill };
Constants
WZBroadcastScaleModeAspectFit

Captured frames that don't fit within the requested broadcast frame size will be scaled to fit within the broadcast frame

WZBroadcastScaleModeAspectFill

Captured frames that don't fit within the requested broadcast frame size will be scaled up to completely fill the broadcast frame.

Discussion

Describes how captured frames that don't exactly fit the requested broadcast frame size will be adjusted to fit within the requested frame size.

See Also


WZFrameSizePreset


private

typedef NS_ENUM(NSUInteger, WZFrameSizePreset) { WZFrameSizePreset352x288, WZFrameSizePreset640x480, WZFrameSizePreset1280x720, WZFrameSizePreset1920x1080, WZFrameSizePreset3840x2160, WZFrameSizePresetCount };
Constants
WZFrameSizePreset352x288

352 x 288 frame size.

WZFrameSizePreset640x480

640 x 480 frame size.

WZFrameSizePreset1280x720

1280 x 720 frame size (720p).

WZFrameSizePreset1920x1080

1920 x 1080 frame size (1080p).

WZFrameSizePreset3840x2160

3840 x 2160 frame size (UHD 4K).

WZFrameSizePresetCount

Count of known frame sizes

Discussion

Frame size presets availabe at compile time. Note that not all of these presets are guarenteed to be supported by a particular device or device camera.

See Also


Properties

audioBitrate
audioChannels
audioEnabled
audioSampleRate
backgroundBroadcastEnabled
broadcastScaleMode
broadcastVideoOrientation
capturedVideoRotates
frameSize
frameSizeLabel
videoBitrate
videoBitrateLowBandwidthScalingFactor
videoEnabled
videoFrameBufferSizeMultiplier
videoFrameRate
videoFrameRateLowBandwidthSkipCount
videoHeight
videoKeyFrameInterval
videoPreviewRotates
videoWidth

audioBitrate


@property (nonatomic,
    assign) NSUInteger audioBitrate; 
Discussion

The desired audio bitrate. Note that the actual bitrate might be different from the desired rate.


audioChannels


@property (nonatomic,
    assign) NSUInteger audioChannels; 
Discussion

The desired number of audio channels


audioEnabled


@property (nonatomic,
    assign) BOOL audioEnabled; 
Discussion

Enable or disable audio for the configuration.


audioSampleRate


@property (nonatomic,
    assign) NSUInteger audioSampleRate; 
Discussion

The desired audio sample rate. Note that the actual sample rate might be different from the desired rate. Set this property to 0 to have WowzaGoCoder select the optimal sample rate based on the current hardware capabilities. The default value is 0.


backgroundBroadcastEnabled


@property (nonatomic,
    assign) BOOL backgroundBroadcastEnabled; 
Discussion

Set whether or not broadcasting when the app is in the background is enabled. If enabled, the host application must support the audio background mode (this is set in your app target's Capabilities tab, in the "Background Modes" section). In this case, the app will continue to record and broadcast the live audio stream. Since the camera cannot capture in the background on iOS, a blank or frozen video frame will be broadcast while the app is in the background. The default value is NO.


broadcastScaleMode


@property (nonatomic,
    assign) WZBroadcastScaleMode broadcastScaleMode; 
Discussion

Set the desired scale mode for captured frames that don't fit the requested broadcast frame size. See WZBroadcastScaleMode for allowed values. Default is WZBroadcastScaleModeAspectFit.


broadcastVideoOrientation


@property (nonatomic,
    assign) WZBroadcastOrientation broadcastVideoOrientation; 
Discussion

Set the desired broadcast orientation for a broadcast session. See WZBroadcastOrientation for allowed values. Default is WZBroadcastOrientationSameAsDevice.


capturedVideoRotates


@property (nonatomic,
    assign) BOOL capturedVideoRotates; 
Discussion

Set whether or not to rotate video frames to match the orientation of the device.


frameSize


@property (nonatomic,
    readonly) CGSize frameSize; 
Discussion

The video frame size, in CGSize format


frameSizeLabel


@property (nonatomic,
    readonly,
    nonnull) NSString *frameSizeLabel; 
Discussion

A human-readable string describing the video frame size


videoBitrate


@property (nonatomic,
    assign) NSUInteger videoBitrate; 
Discussion

The desired video bitrate. Note that the actual bitrate might be reduced if network bandwidth cannot keep up with the desired bitrate.


videoBitrateLowBandwidthScalingFactor


@property (nonatomic,
    assign) Float32 videoBitrateLowBandwidthScalingFactor; 
Discussion

The factor by which to scale the desired bitrate in low bandwidth conditions. Valid range is 0.0 to 1.0; any other value will be ignored. Setting a value of

  1. 0 indicates that the encoder should choose the best value; setting a value of

  2. 0 indicates that bitrate will never be throttled. The default is 0.75


videoEnabled


@property (nonatomic,
    assign) BOOL videoEnabled; 
Discussion

Enable or disable video for the configuration.


videoFrameBufferSizeMultiplier


@property (nonatomic,
    assign) NSUInteger videoFrameBufferSizeMultiplier; 
Discussion

The value by which to multiply the video frame rate to derive the number of video frames to buffer before the encoder starts to throttle bitrate and/or frame rate. For example: if the frame rate is 30 and the videoFrameBufferSizeMultiplier is 5, the encoder will buffer 150 (5 * 30) frames before throttling. Setting a value of 0 indicates that the encoder should choose the best value. The default is 4.


videoFrameRate


@property (nonatomic,
    assign) NSUInteger videoFrameRate; 
Discussion

The desired frame rate for the configuration. Note that the actual frame rate might be reduced if network bandwidth cannot keep up with the desired frame rate.


videoFrameRateLowBandwidthSkipCount


@property (nonatomic,
    assign) NSUInteger videoFrameRateLowBandwidthSkipCount; 
Discussion

The number of frames to skip when the encoder cannot keep up with the broadcaster. In low bandwidth conditions the encoder will skip frames to conserve bandwidth but still send consistent frames so the encoder can produce smooth playback. The maximum number of frames that can be skipped is equal to the key frame interval minus one - i.e. setting this to 29 with a key frame interval of 30 will produce a key frame only stream, setting to 1 will never skip frames. The default is 2 meaning skip 1 of every 2 frames


videoHeight


@property (nonatomic,
    assign) NSUInteger videoHeight; 
Discussion

The video frame height for the configuration.


videoKeyFrameInterval


@property (nonatomic,
    assign) NSUInteger videoKeyFrameInterval; 
Discussion

The video key frame interval.


videoPreviewRotates


@property (nonatomic,
    assign) BOOL videoPreviewRotates; 
Discussion

Set whether or not the video session should rotate to match the orientation of the device.


videoWidth


@property (nonatomic,
    assign) NSUInteger videoWidth; 
Discussion

The video frame width for the configuration.