WOWZPlayer

Superclass:
NSObject
Declared In:

Introduction

Use the WOWZPlayer class to play streams from Wowza Streaming Engine or Wowza Streaming Cloud over the WOWZ protocol, as well as to play ultra low latency streams from Wowza Streaming Cloud. WOWZPlayer decompresses audio and video, plays audio through the device speaker, and displays video frames in a UIView.



Methods

-pauseHLSPlayback
-play:callback:
-registerDataSink:eventName:
-resetPlaybackErrorCount
-setupHLSWithView:
-startHLSPlayback
-stop
-stopHLSPlayback
-unregisterDataSink:eventName:

pauseHLSPlayback


-(void)pauseHLSPlayback; 
Discussion

Pauses the HLS fallback stream.


play:callback:


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

The WowzaConfig that specifes the host, port, app name, and stream name to play.

statusCallback

The callback to be invoked with playback session status updates and errors.

Discussion

Starts playing the stream.


registerDataSink:eventName:


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

An object that conforms to the WOWZAudioEncoderSink protocol.

eventName

The name of the data event that the client should listen for.

Discussion

Registers a WOWZDataSink object with WOWZPlayer. WOWZDataSink protocol methods are called when the player is active and a data event is received from the server.


resetPlaybackErrorCount


-(void)resetPlaybackErrorCount; 
Discussion

Resets the playback error count to zero.


setupHLSWithView:


-(void)setupHLSWithView:(UIView *_Nullable)viewToAttachTo; 
Discussion

Sets up the HLS fallback stream. Can be used with ultra low latency streams from Wowza Streaming Cloud; note, however, that Apple HLS streams experience greater latency than WebSocket streams.


startHLSPlayback


-(void)startHLSPlayback; 
Discussion

Starts playing the HLS fallback stream.


stop


- (void) stop; 
Discussion

Stops playing the stream.


stopHLSPlayback


-(void)stopHLSPlayback; 
Discussion

Stops playing the HLS fallback stream.


unregisterDataSink:eventName:


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

An object that conforms to the WOWZDataSink protocol.

Discussion

Unregisters a WOWZDataSink object from WOWZPlayer.


Typedefs

NS_ENUM
WOWZPlayerViewGravityResizeAspect

NS_ENUM


typedef NS_ENUM(NSUInteger, WOWZPlayerViewGravity) { 
    WOWZPlayerViewGravityResizeAspect = 0, WOWZPlayerViewGravityResizeAspectFill 
}; 
Constants
WOWZPlayerViewGravityResizeAspect

Preserve the video's aspect ratio and fit it within layer bounds.

WOWZPlayerViewGravityResizeAspectFill

Preserve the video's aspect ratio and fill layer bounds.

Discussion

Describes how the video is displayed in the player's available screen area.

See Also


WOWZPlayerViewGravityResizeAspect


typedef NS_ENUM(NSUInteger, WOWZPlayerViewGravity) { 
    WOWZPlayerViewGravityResizeAspect = 0, WOWZPlayerViewGravityResizeAspectFill 
}; 
Constants
WOWZPlayerViewGravityResizeAspect

Preserve the video's aspect ratio and fit it within layer bounds.

WOWZPlayerViewGravityResizeAspectFill

Preserve the video's aspect ratio and fill layer bounds.

Discussion

Describes how the video is displayed in the player's available screen area.

See Also


Properties

clientCallback
currentTime
metaData
muted
playerView
playerViewGravity
playing
prerollDuration
syncOffset
useHLSFallback
volume

clientCallback


@property (nonatomic,
    unsafe_unretained) NSObject<WOWZStatusCallback> *clientCallback; 
Discussion

Access to the client callback incase the order of deinit/dealloc needs to be manually controlled on the delegate callback.


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 a stream isn't playing or if the player hasn't received any frames.


metaData


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

The stream metadata for the stream that's playing.


muted


@property (nonatomic,
    assign) BOOL muted; 
Discussion

Mute or unmute the audio. The default is no, or unmuted.


playerView


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

The UIView to which the player should be added.


playerViewGravity


@property (nonatomic,
    assign) WOWZPlayerViewGravity playerViewGravity; 
Discussion

The gravity to use to display the video in the host view. Gravity describes how the video frame fills the available screen area.


playing


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

The playing state of the WOWZPlayer instance.


prerollDuration


@property (nonatomic,
    assign) Float64 prerollDuration; 
Discussion

The amount of time to buffer the video before playing. The default is 0 seconds; the maximum is 60 seconds.


syncOffset


@property (nonatomic,
    assign) Float32 syncOffset; 
Discussion

The sync offset to scrub video to sync. Specify a value between -1.0 and 3.0 seconds; any value outside of this range will be ignored. The default is 1.0.


useHLSFallback


@property (nonatomic,
    assign) BOOL useHLSFallback; 
Discussion

Play an Apple HLS stream as a fallback if the primary WOWZ-based conection is unsuccessful. Can be used with ultra low latency streams from Wowza Streaming Cloud; note, however, that Apple HLS streams experience greater latency than WebSocket streams.


volume


@property (nonatomic,
    assign) Float32 volume; 
Discussion

The volume to play the audio. Specify a value between 0.0 (silent) and 1.0 (full volume); any value outside of this range will be ignored. The default is 1.0.