Red5Pro IOS Client SDK

 10.0.0
Core SDK for IOS
R5Stream Class Reference

The main stream class of Red5Pro. Utilizes the R5Connection to connect and communicate with a server instance. More...

#import <R5Stream.h>

Inherits NSObject.

Instance Methods

(id) - initWithConnection:
 
(void) - play:
 
(void) - play:withHardwareAcceleration:
 
(void) - play:withForcedRGBDecode:
 
(void) - publish:type:
 
(void) - stop
 
(void) - emptyPublishQueue
 
(AVCaptureVideoPreviewLayer *) - getPreviewLayer
 
(void) - attachAudio:
 
(void) - attachVideo:
 
(enum R5StreamMode) - mode
 
(void) - send:withParam:
 
(r5_stats *) - getDebugStats
 
(R5VideoSource *) - getVideoSource
 
(R5Microphone *) - getMicrophone
 
(CVPixelBufferRef) - getStreamPixelBuffer
 
(void *) - getStreamImageBytes
 
(UIImage *) - getStreamImage
 
(r5_stream_format- getStreamFormat
 
(void) - updateStreamMeta
 
(void) - setFrameListener:
 
(void) - setPlaybackAudioHandler:
 
(void) - recordWithName:
 
(void) - recordWithName:withProps:
 
(void) - endLocalRecord
 
(void) - deactivate_display
 
(void) - activate_display
 
(BOOL) - usesHardwareAcceleration
 

Properties

R5AudioControlleraudioController
 
R5Connectionconnection
 
NSObject< R5StreamDelegate > * delegate
 
NSObject * client
 
BOOL pauseAudio
 
BOOL pauseVideo
 
CVPixelBufferPoolRef pixelBufferPool
 
NSDictionary * pixelBufferAuxAttributes
 

Detailed Description

The main stream class of Red5Pro. Utilizes the R5Connection to connect and communicate with a server instance.

Method Documentation

◆ attachAudio:

- (void) attachAudio: (R5Microphone *)  microphone

Attach an audio input to this stream for publishing

Parameters
microphoneThe microphone to stream

◆ attachVideo:

- (void) attachVideo: (R5VideoSource *)  camera

Attach a video input to this stream for publishing

Parameters
cameraThe video source to stream

◆ deactivate_display

- (void) deactivate_display

Pauses processing of video frames

◆ emptyPublishQueue

- (void) emptyPublishQueue

Request to empty any queued packets for broadcast.

◆ getDebugStats

- (r5_stats *) getDebugStats

Get the current running stats for this stream

Returns
an r5_stats object for this stream

◆ getMicrophone

- (R5Microphone *) getMicrophone

Get the currently attached audio source

Returns
the attached audio source or nil

◆ getPreviewLayer

- (AVCaptureVideoPreviewLayer *) getPreviewLayer

Get the video preview layer for publising

Returns
the video preview layer if it exists

◆ getStreamFormat

- (r5_stream_format) getStreamFormat

Returns the format that the subscriber stream has been decoded to. *Use this APi in conjunction with getStreamImageBytes to determine format of bytes.

Returns
The format from the enumerated r5_stream_format.

◆ getStreamImage

- (UIImage *) getStreamImage

Get an image of the current stream

Returns
a UIImage containing the stream input/output

◆ getStreamImageBytes

- (void *) getStreamImageBytes

Returns the raw image bytes of a subscriber stream.

Returns
The raw image bytes.

◆ getStreamPixelBuffer

- (CVPixelBufferRef) getStreamPixelBuffer

Returns CVPixelBufferRef accessible upon hardware accelerated decoding. *Only returned for subscriber if specified playback as hardware accelerated.

Returns
CVPixelBufferRef

◆ getVideoSource

- (R5VideoSource *) getVideoSource

Get the currently attached video stream

Returns
the attached video source or nil

◆ initWithConnection:

- (id) initWithConnection: (R5Connection *)  conn

Initialize the stream. The connection is not established.

Parameters
connThe connection to utilize for the stream
Returns
a new Stream

◆ mode

- (enum R5StreamMode) mode

Get the current streaming mode of the stream

Returns
an R5Stream mode that will be one of the following:
  • r5_stream_mode_idle
  • r5_stream_mode_streaming
  • r5_stream_mode_publishing

◆ play:

- (void) play: (NSString *)  streamName

Subscribe to an existing stream

Parameters
streamNamename of the stream to subscribe to

◆ play:withForcedRGBDecode:

- (void) play: (NSString *)  streamName
withForcedRGBDecode: (BOOL)  forceRGB 

Subscribe to an existing stream and force RGB Software Scalar in decode.

Parameters
streamNamename of the stream to subscribe too
forceRGBflag to turn on software decoding frames to RGB pixel format (if false - default - decodes to YUV planar).

◆ play:withHardwareAcceleration:

- (void) play: (NSString *)  streamName
withHardwareAcceleration: (BOOL)  hw 

Subscribe to an existing stream and request hardware acceleration in decode. Decodes frame to CVPixelBuffer.

Parameters
streamNamename of the stream to subscribe too
hwflag to turn on hardware acceleration in decode process

◆ publish:type:

- (void) publish: (NSString *)  streamName
type: (enum R5RecordType)  type 

Publish to a new stream

Parameters
streamNameUnique name for this stream
typeR5RecordType type of publishing
  • R5RecordTypeLive - No recording
  • R5RecordTypeRecord - Record a new file
  • R5RecordTypeAppend - Append the recording to an existing recording if available

◆ send:withParam:

- (void) send: (NSString *)  methodName
withParam: (NSString *)  param 

Send a stream RPC to the server. Only available to publishing streams.

Parameters
methodNamename of the method to invoke on the server
paramparameter to pass to the server for this message.

◆ setFrameListener:

- (void) setFrameListener: (void(^)(void *, enum r5_stream_format, int, int, int))  listenerBlock

Sets a block to receive frame data from the renderer, Use R5VideoView instead where possible

Parameters
listenerBlockThe block of code to recieve the frame data

The parameters that the block receives are: void* A pointer to an array of color data. Note, this pointer is managed by the SDK, freeing it will likely cause problems. Depending on the format, you will need to handle the data appropriately: enum r5_stream_format The pixel format of the data. (1) r5_stream_format_rgb: RGB format - three values per pixel. (2) r5_stream_format_yuv_planar: YUV420p, 3 planes - returned data is an array of 3. (3) r5_stream_format_yuv_biplanar: YUV420v, 2 planes - returned data is CVPixelBuffer. int The size of the image data. int The width of the image described by the array. int The height of the image described by the array.

◆ setPlaybackAudioHandler:

- (void) setPlaybackAudioHandler: (void(^)(uint8_t *, int, double))  handlerBlock

Sets a handler to receive and optionally manipulate the audio stream data coming in for playback before sending to output.

Parameters
handlerBlockThe block of code to recieve the audio data

The parameters that the block receives are: uint8_t* A pointer to an array of samples of raw audio. This serves as both input and output, any modification to the array will modify the audio sent to the speakers. Note, this pointer is managed by the SDK, freeing it will likely cause problems. int The number of samples in the array - each sample is a single uint8 value. double The time since the stream began playing audio, in milliseconds.

◆ stop

- (void) stop

Stop all publishing and subscribing on this stream

◆ updateStreamMeta

- (void) updateStreamMeta

Send updated stream meta information

Property Documentation

◆ audioController

- (R5AudioController*) audioController
readwriteatomic

Audio Controller for Stream playback. Defaults to shared instance.

◆ client

- (NSObject*) client
readwriteatomic

Client object that will receive all RPC callbacks.

◆ connection

- (R5Connection*) connection
readatomicassign

The connection that the stream is communicating with.

◆ delegate

- (NSObject<R5StreamDelegate>*) delegate
readwriteatomic

The stream delegate to receive events for this connection.

◆ pauseAudio

- (BOOL) pauseAudio
readwriteatomic

Flag to "mute" audio for Publishing.

◆ pauseVideo

- (BOOL) pauseVideo
readwriteatomic

Flag to "mute" video for Publishing.


The documentation for this class was generated from the following file: