public class RtspClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
RtspClient.Callback
The callback interface you need to implement to know what's going on with the
RTSP server (for example your Wowza Media Server).
|
Modifier and Type | Field and Description |
---|---|
static int |
ERROR_CONNECTION_FAILED
Message sent when the connection to the RTSP server failed.
|
static int |
ERROR_CONNECTION_LOST
Message sent when the connection with the RTSP server has been lost for
some reason (for example, the user is going under a bridge).
|
static int |
ERROR_WRONG_CREDENTIALS
Message sent when the credentials are wrong.
|
static int |
MESSAGE_CONNECTION_RECOVERED
Message sent when the connection with the RTSP server has been reestablished.
|
static java.lang.String |
TAG |
static int |
TRANSPORT_TCP
Use this to use TCP for the transport protocol.
|
static int |
TRANSPORT_UDP
Use this to use UDP for the transport protocol.
|
Constructor and Description |
---|
RtspClient() |
Modifier and Type | Method and Description |
---|---|
Session |
getSession() |
boolean |
isStreaming() |
void |
release() |
void |
setCallback(RtspClient.Callback cb)
Sets the callback interface that will be called on status updates of the connection
with the RTSP server.
|
void |
setCredentials(java.lang.String username,
java.lang.String password)
If authentication is enabled on the server, you need to call this with a valid login/password pair.
|
void |
setServerAddress(java.lang.String host,
int port)
Sets the destination address of the RTSP server.
|
void |
setSession(Session session)
The
Session that will be used to stream to the server. |
void |
setStreamPath(java.lang.String path)
The path to which the stream will be sent to.
|
void |
setTransportMode(int mode)
Call this with
TRANSPORT_TCP or 0 to choose the
transport protocol that will be used to send RTP/RTCP packets. |
void |
startStream()
Connects to the RTSP server to publish the stream, and the effectively starts streaming.
|
void |
stopStream()
Stops the stream, and informs the RTSP server.
|
public static final java.lang.String TAG
public static final int ERROR_CONNECTION_FAILED
public static final int ERROR_WRONG_CREDENTIALS
public static final int TRANSPORT_UDP
public static final int TRANSPORT_TCP
public static final int ERROR_CONNECTION_LOST
stopStream()
is not called.public static final int MESSAGE_CONNECTION_RECOVERED
stopStream()
is not called.public void setCallback(RtspClient.Callback cb)
cb
- The implementation of the RtspClient.Callback
interfacepublic void setSession(Session session)
Session
that will be used to stream to the server.
If not called before startStream()
, a it will be created.public Session getSession()
public void setServerAddress(java.lang.String host, int port)
host
- The destination addressport
- The destination portpublic void setCredentials(java.lang.String username, java.lang.String password)
username
- The loginpassword
- The passwordpublic void setStreamPath(java.lang.String path)
path
- The pathpublic void setTransportMode(int mode)
TRANSPORT_TCP
or 0 to choose the
transport protocol that will be used to send RTP/RTCP packets.
Not ready yet !public boolean isStreaming()
public void startStream()
setServerAddress(String, int)
and optionally setSession(Session)
and setCredentials(String, String)
before calling this.
Should be called of the main thread !public void stopStream()
public void release()