Red5Pro Android Client SDK

 7.3.0
Core SDK for Android
com.red5pro.streaming.R5Stream Class Reference

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

Classes

class  R5Stats
 
enum  RecordType
 
enum  StreamMode
 

Public Member Functions

 R5Stream (R5Connection connection)
 
void restrainAudio (boolean restrain)
 
void restrainVideo (boolean restrain)
 
StreamMode getStreamMode ()
 
void attachMic (R5Microphone mic)
 
void play (final String streamName)
 
void play (final String streamName, final boolean useHardwareAcceleration)
 
void playWithForcedRGBDecode (final String streamName)
 
R5Microphone getAudioSource ()
 
boolean getNetworkIsReady ()
 
void publish (String streamName, RecordType recordType)
 
void updateStreamMeta ()
 
void stop ()
 
void setView (SurfaceView view)
 
R5VideoSource getVideoSource ()
 
void beginLocalRecording (Context context, String fileName)
 
void beginLocalRecordingWithProperties (Context context, String fileName, Map< String, Integer > props)
 
void endLocalRecording ()
 
void attachCamera (R5VideoSource videosource)
 
void setListener (R5ConnectionListener listener)
 
R5ConnectionListener getListener ()
 
void removeListener ()
 
synchronized void sendBlankAudio (SDPTrack track, long withRTPTime, int type)
 
synchronized void write (IDataSource source, byte[] outData, int startPosition, int length, long withRTPTime, int type)
 
synchronized void write (IDataSource source, byte[] outData, int startPosition, int length, long withRTPTime, int type, boolean mBit)
 
void setFrameListener (R5FrameListener frameListener)
 
void setPlaybackAudioHandler (R5PlaybackAudioHandler playbackAudioHandler)
 
Bitmap getStreamImage ()
 
R5Stats getStats ()
 
native void setLogLevel (int level)
 Set the logging level for Red5 Pro.
 
void send (String method, Map< Object, Object > parameters)
 
void setScaleMode (int _mode)
 
int getScaleMode ()
 
native String getDebugInfo ()
 Return debug information for this stream.
 
native double getBufferedTime ()
 
native double getBitrateSmoothed ()
 
native double getStatsBufferedTime ()
 
native int getOrientationMetadata ()
 

Public Attributes

R5Connection connection
 
R5AudioController audioController
 
Surface mSurface
 
Object client
 

Static Public Attributes

static int LOG_LEVEL_DEBUG = 0
 
static int LOG_LEVEL_INFO = 1
 
static int LOG_LEVEL_WARN = 2
 
static int LOG_LEVEL_ERROR = 3
 
static final String VideoBitrateKey = "R5VideoBitrateLocalRecord"
 
static final String AudioBitrateKey = "R5AudioBitrateLocalRecord"
 

Protected Member Functions

int recordTypeToInt (RecordType type)
 
RecordType intToRecordType (int type)
 
void onSdkLicenseVerificationSubscriber (int status, String streamName)
 
void onSdkLicenseVerificationPublisher (int status, String streamName, int recordType)
 
void onStreamEvent (int eventCode)
 
void onConfigurationStatus (int status, String msg)
 
void onRPCCallback (String methodName, String paramMap)
 
void onPublisherFlushEmptyCallback (String message)
 
void receiveFrameBytes (byte[] bytes, int width, int height)
 
void receiveFrameData (Object data, int format, int width, int height)
 
void receiveAudioBytes (short[] bytes, int size, double streamTimeMilliseconds)
 

Protected Attributes

boolean sdkValidationFailed = false
 

Detailed Description

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

Constructor & Destructor Documentation

com.red5pro.streaming.R5Stream.R5Stream ( R5Connection  connection)
inline

Create a new R5Stream instance

Parameters
connectionThe connection to utilize for the stream

Member Function Documentation

void com.red5pro.streaming.R5Stream.attachCamera ( R5VideoSource  videosource)
inline

Attach a video source to be published on the stream

Parameters
videosourceVideo source to stream
void com.red5pro.streaming.R5Stream.attachMic ( R5Microphone  mic)
inline

Attach an Audio Input for this stream

Parameters
micThe microphone to stream
void com.red5pro.streaming.R5Stream.beginLocalRecording ( Context  context,
String  fileName 
)
inline

Trigger a recording of the stream to be saved to device At API 16 or 17, this recording can only fill half of the available file size. Later apis do not have that restriction.

Parameters
contextThe application's context - required to access the file system
fileNameThe name of the file to write
void com.red5pro.streaming.R5Stream.beginLocalRecordingWithProperties ( Context  context,
String  fileName,
Map< String, Integer >  props 
)
inline

Trigger a recording of the stream to be saved to device At API 16 or 17, this recording can only fill half of the available file size. Later apis do not have that restriction.

Parameters
contextThe application's context - required to access the file system
fileNameThe name of the file to write
propsA collection of specific properties for recording, currently limited to Video and Audio bit rates
void com.red5pro.streaming.R5Stream.endLocalRecording ( )
inline

Call to stop recording of the stream to the device

R5Microphone com.red5pro.streaming.R5Stream.getAudioSource ( )
inline

Get the audio source attached to this stream

Returns
current attached audio source or NULL
boolean com.red5pro.streaming.R5Stream.getNetworkIsReady ( )
inline

Get if network connection successfully established

Returns
connection is established
R5Stats com.red5pro.streaming.R5Stream.getStats ( )
inline

Retrieves data about the stream for debugging and health monitoring

Returns
An object containing data about the stream
Bitmap com.red5pro.streaming.R5Stream.getStreamImage ( )
inline

Get a bitmap representation of the current stream

Returns
Sampled image of the stream
StreamMode com.red5pro.streaming.R5Stream.getStreamMode ( )
inline

Get Current mode of the stream

Returns
the current StreamMode
R5VideoSource com.red5pro.streaming.R5Stream.getVideoSource ( )
inline

Get the publishing video source for the stream

Returns
The publishing video source
void com.red5pro.streaming.R5Stream.onConfigurationStatus ( int  status,
String  msg 
)
inlineprotected

Configuration event handling

Parameters
statusStatus code (R5ConnectionEvent) of the event
msgString message of the event
void com.red5pro.streaming.R5Stream.onPublisherFlushEmptyCallback ( String  message)
inlineprotected

Publisher Buffer Flush Empty callback from JNI. This is used to flush all possible queued packets out the connection before disconnect.

void com.red5pro.streaming.R5Stream.onRPCCallback ( String  methodName,
String  paramMap 
)
inlineprotected

RPC Callback from JNI

Parameters
methodNameName of method to be called
paramMapParameter map of all paremeters
void com.red5pro.streaming.R5Stream.play ( final String  streamName)
inline

Subscribe to an existing stream

Parameters
streamNamename of the stream to subscribe too.
void com.red5pro.streaming.R5Stream.play ( final String  streamName,
final boolean  useHardwareAcceleration 
)
inline

Subscribe to an existing stream

Parameters
streamNamename of the stream to subscribe too.
useHardwareAccelerationflag to use hardware acceleration in decoding stream.
void com.red5pro.streaming.R5Stream.playWithForcedRGBDecode ( final String  streamName)
inline

Subscribe to an existing stream force non-hardware accelerated RGB scalar to decode.

Parameters
streamName
void com.red5pro.streaming.R5Stream.publish ( String  streamName,
RecordType  recordType 
)
inline

Publish to a new stream

Parameters
streamNameUnique name for this stream
recordTypetype of publishing
  • RecordType.Live - No recording
  • RecordType.Record - Record a new file
  • RecordType.Append - Append the recording to an existing recording if available
void com.red5pro.streaming.R5Stream.receiveFrameBytes ( byte[]  bytes,
int  width,
int  height 
)
inlineprotected

Receives frame data from the GL renderer

Parameters
bytesThe frame data from renderer as RGB byte array
void com.red5pro.streaming.R5Stream.receiveFrameData ( Object  data,
int  format,
int  width,
int  height 
)
inlineprotected

Receives frame data from the GL renderer

Parameters
dataObject Depending on the requested decode option, describes the current frame that would be output to a view (if present) format(1). Array of RGB data - three bytes per pixel format(2). YUV420p - Array of byte array, length of 3 - Y, Cb (U), Cr (V) format(3). YUV420v - Array of byte array, lenght of 2 - Y, CbCr (UV)
formatThe R5StreamFormat enum value.
widthThe width of the image provided by bytes.
heightThe height of the image provided by bytes.
void com.red5pro.streaming.R5Stream.removeListener ( )
inline

Remove the current R5ConnectionListener to stop handling events

void com.red5pro.streaming.R5Stream.restrainAudio ( boolean  restrain)
inline

Set flag to "mute" audio during Publishing session.

Parameters
restrainBoolean
void com.red5pro.streaming.R5Stream.restrainVideo ( boolean  restrain)
inline

Set flag to "mute" video during Publishing session.

Parameters
restrainBoolean
void com.red5pro.streaming.R5Stream.send ( String  method,
Map< Object, Object >  parameters 
)
inline

Invoke a method on all subscribing client with a composite string of key-values pairs. Publisher Only.

Parameters
methodThe name of the method to invoke on all subscribing clients.
parametersThe map of key-value pairs that will be concatenated each with '=' and delimited with ';'. e.g., "foo=bar;baz=qux;"
void com.red5pro.streaming.R5Stream.setFrameListener ( R5FrameListener  frameListener)
inline

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

Parameters
frameListenerObject to receive frame data

R5FrameListener.onBytesReceived has these three paramaters: byte[] bytes - Array of RGB data - three bytes per pixel - which describes the current frame that would be output to a view (if present) int width - The width of the image provided by bytes. int height - The height of the image provided by bytes.

void com.red5pro.streaming.R5Stream.setListener ( R5ConnectionListener  listener)
inline

Set the connection status listener to handle connection events

Parameters
listenerListener to handle events
void com.red5pro.streaming.R5Stream.setPlaybackAudioHandler ( R5PlaybackAudioHandler  playbackAudioHandler)
inline

Sets a handler to receive and optionally manipulate the audio stream data coming in for playback before sending to output. Note, this now functions identically to the function of the same name in R5AudioController

Parameters
playbackAudioHandlerObject which will receive the callback containing the outgoing array of audio samples.

R5PlaybackAudioHandler.processAudioPlayback has these three paramaters: byte[] bytes - 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 int size - The number of samples in the array - analogous to using bytes.length double streamTimeMilliSeconds - The time since the stream began playing audio, in milliseconds

void com.red5pro.streaming.R5Stream.setView ( SurfaceView  view)
inline

Set the surface to render the publisher preview on

Parameters
viewView to render publisher on
void com.red5pro.streaming.R5Stream.stop ( )
inline

Stop all publishing and subscribing on this stream

void com.red5pro.streaming.R5Stream.updateStreamMeta ( )
inline

Make call to send out metadata.

synchronized void com.red5pro.streaming.R5Stream.write ( IDataSource  source,
byte[]  outData,
int  startPosition,
int  length,
long  withRTPTime,
int  type 
)
inline

Write a packet on the stream (for internal use)

Parameters
sourceDataSource with full SDP information
outDataData to write on the stream
startPositionoffset to start at
lengthLength of data to write
withRTPTimeTimestamp (ms) to write on stream

Member Data Documentation

Object com.red5pro.streaming.R5Stream.client

Client object that will receive all RPC callbacks.


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