public class RtmpClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RtmpClient.RtmpIOException |
Modifier and Type | Field and Description |
---|---|
static int |
RTMP_READ_DONE
RTMP read has received an EOF or READ_COMPLETE from the server
|
Constructor and Description |
---|
RtmpClient() |
Modifier and Type | Method and Description |
---|---|
void |
close()
closes the connection.
|
boolean |
isConnected() |
void |
open(java.lang.String url,
boolean isPublishMode)
opens the rtmp url
|
boolean |
pause(boolean pause) |
int |
read(byte[] data,
int offset,
int size)
read data from rtmp connection
|
void |
setReceiveTimeout(int receiveTimeoutInMs)
Sets the socket's receive timeout value
|
void |
setSendTimeout(int sendTimeoutInMs)
Sets the socket's send timeout value
|
int |
write(byte[] data)
Sends data to server
|
int |
write(byte[] data,
int offset,
int size)
Sends data to server
|
public static final int RTMP_READ_DONE
public void setSendTimeout(int sendTimeoutInMs)
sendTimeoutInMs
- The send timeout value for the rtmp socket in milliseconds.
Parameter expects a non-zero positive integer and will reset timeout to the default value
(10000 ms) if zero or a negative integer is passed.public void setReceiveTimeout(int receiveTimeoutInMs)
receiveTimeoutInMs
- The receive timeout value for the rtmp socket in milliseconds.
Parameter expects a non-zero positive integer and will reset timeout to the default value
(10000 ms) if zero or a negative integer is passed.public void open(java.lang.String url, boolean isPublishMode) throws RtmpClient.RtmpIOException
url
- url of the streamisPublishMode
- if this is an publication it is true,
if connection is for getting stream it is falseRtmpClient.RtmpIOException
- if open failspublic int read(byte[] data, int offset, int size) throws RtmpClient.RtmpIOException, java.lang.IllegalStateException
data
- buffer that will be filledoffset
- offset to read datasize
- size of the data to be readRTMP_READ_DONE
, it means stream is complete
and close function can be called.RtmpClient.RtmpIOException
- if connection to server is lostjava.lang.IllegalStateException
- if call to open(String, boolean)
was unsuccessful or
missingpublic int write(byte[] data) throws RtmpClient.RtmpIOException, java.lang.IllegalStateException
data
- The data to write to serverRtmpClient.RtmpIOException
- if connection to server is lostjava.lang.IllegalStateException
- if call to open(String, boolean)
was unsuccessful or
missingpublic int write(byte[] data, int offset, int size) throws RtmpClient.RtmpIOException, java.lang.IllegalStateException
data
- data to write to serveroffset
- The offset from where data will be accessed to write to serversize
- The number of bytes to write to serverRtmpClient.RtmpIOException
- if connection to server is lostjava.lang.IllegalStateException
- if call to open(String, boolean)
was unsuccessful or
missingpublic boolean pause(boolean pause) throws RtmpClient.RtmpIOException, java.lang.IllegalStateException
pause
- if pause is true then stream is going to be paused
If pause is false, it unpauses the stream and it is ready to to play againRtmpClient.RtmpIOException
- if connection is lostjava.lang.IllegalStateException
- if call to open(String, boolean)
was unsuccessful or
missingpublic boolean isConnected()
public void close()