WZPlayer

Superclass:
NSObject
Declared In:

Introduction

WZPlayer is a class used for playing a WOWZ stream from Engine or Cloud. WZPlayer handles decompressing audio and video, playing audio through the device speaker and displaying video frames in a UIView.



Methods

-play:callback:
-registerDataSink:eventName:
-stop
-unregisterDataSink:eventName:

play:callback:


- (void) play:(nonnull WowzaConfig *)config callback:(nullable id<WZStatusCallback>)statusCallback; 
Parameters
config

The WowzaConfig specifying the host, port, app name and stream name to play

statusCallback

A callback that will be invoked with playback session status updates and errors.

Discussion

Start playing the video stream.


registerDataSink:eventName:


- (void) registerDataSink:(nonnull id<WZDataSink>)sink 
        eventName:(nonnull NSString *)eventName; 
Parameters
sink

An object conforming to the WZAudioEncoderSink protocol

eventName

The name of the data event the client wishes to listen for

Discussion

Registers an object that conforms to the WZDataSink protocol with WZPlayer. The WZDataSink protocol methods will be called when video player is active and a data event is received from the server.


stop


- (void) stop; 
Discussion

Stop playing the video stream


unregisterDataSink:eventName:


- (void) unregisterDataSink:(nonnull id<WZDataSink>)sink 
        eventName:(nonnull NSString *)eventName; 
Parameters
sink

An object conforming to the WZDataSink protocol

Discussion

Unregisters an object that conforms to the WZDataSink protocol with WZPlayer.


Typedefs

NS_ENUM
WZPlayerViewGravityResizeAspect

NS_ENUM


typedef NS_ENUM(NSUInteger, WZPlayerViewGravity) { 
    WZPlayerViewGravityResizeAspect = 0, WZPlayerViewGravityResizeAspectFill, 
    WZPlayerViewGravityResize 
}; 
Constants
WZPlayerViewGravityResizeAspect

Preserve aspect ratio; fit within layer bounds.

WZPlayerViewGravityResizeAspectFill

Preserve aspect ratio; fill layer bounds.

WZPlayerViewGravityResize

Stretch to fill layer bounds.

Discussion

Describes how the video in the player view should fill the view frame.

See Also


WZPlayerViewGravityResizeAspect


typedef NS_ENUM(NSUInteger, WZPlayerViewGravity) { 
    WZPlayerViewGravityResizeAspect = 0, WZPlayerViewGravityResizeAspectFill, 
    WZPlayerViewGravityResize 
}; 
Constants
WZPlayerViewGravityResizeAspect

Preserve aspect ratio; fit within layer bounds.

WZPlayerViewGravityResizeAspectFill

Preserve aspect ratio; fill layer bounds.

WZPlayerViewGravityResize

Stretch to fill layer bounds.

Discussion

Describes how the video in the player view should fill the view frame.

See Also


Properties

avSyncUsesFrameRateAdjustment
currentTime
metaData
muted
playerView
playerViewGravity
playing
prerollDuration
volume

avSyncUsesFrameRateAdjustment


@property (nonatomic,
    assign) BOOL avSyncUsesFrameRateAdjustment; 
Discussion

Whether to attempt to sync audio and video by adjusting the video framerate. Default value is NO. Setting this to YES may cause the video to appear accelerated or slow depending on where and when compensation is needed.


currentTime


@property (nonatomic,
    readonly) CMTime currentTime; 
Discussion

* The timecode of the most recent frame displayed by the player, relative to the starting timecode. Returns kCMTimeInvalid if the player is not currently playing, or if no frames have yet been received.


metaData


@property (nonatomic,
    readonly,
    nullable) WZDataMap *metaData; 
Discussion

The stream metadata for an actively playing stream


muted


@property (nonatomic,
    assign) BOOL muted; 
Discussion

Mute/unmute audio. Default is NO.


playerView


@property (nonatomic,
    unsafe_unretained,
    nonnull) UIView *playerView; 
Discussion

The UIView to which the video player will be added.


playerViewGravity


@property (nonatomic,
    assign) WZPlayerViewGravity playerViewGravity; 
Discussion

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


playing


@property (nonatomic,
    assign,
    readonly) BOOL playing; 
Discussion

The current play state of the WZPlayer instance.


prerollDuration


@property (nonatomic,
    assign) Float64 prerollDuration; 
Discussion

The amount of time to pre-roll (buffer) the video before playing. The default is 0. readonly for now since this feature is not ready to demo.


volume


@property (nonatomic,
    assign) Float32 volume; 
Discussion

The volume at which to play the audio. Allowed values are 0.0 (silent) to 1.0 (full volume). Any value outside this range is ignored. Default is 1.0.