public class Stream extends java.lang.Object implements java.lang.Comparable<Stream>
Session.SessionListener.onStreamReceived(Session session, Stream stream)
method notifies you of new streams in the session:
public void receivedStream(Session session, Stream stream) { Subscriber subscriber = new Subscriber(context, stream); session.subscribe(subscriber); }
The Session.SessionListener.onStreamDropped(Session session, Stream stream)
method notifies
when streams are unpublished the session.
Modifier and Type | Class and Description |
---|---|
static class |
Stream.StreamVideoType
Defines values for the
getStreamVideoType() method. |
Modifier and Type | Field and Description |
---|---|
protected Connection |
connection |
protected java.util.Date |
creationTime |
protected boolean |
hasAudio |
protected boolean |
hasVideo |
protected java.lang.String |
name |
protected Session |
session |
protected java.lang.String |
streamId |
protected int |
videoHeight |
protected Stream.StreamVideoType |
videoType |
protected int |
videoWidth |
Modifier | Constructor and Description |
---|---|
protected |
Stream(java.lang.String streamId,
java.lang.String streamName,
int videoWidht,
int videoHeight,
boolean hasAudio,
boolean hasVideo,
Connection connection,
Session session,
int videoType) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Stream s) |
boolean |
equals(java.lang.Object o) |
Connection |
getConnection()
Returns the
Connection object corresponding to this Stream. |
java.util.Date |
getCreationTime()
Returns the time when this stream first joined the OpenTok session.
|
java.lang.String |
getName()
The name of the stream.
|
Session |
getSession()
The session (an
Session object) the stream is bound to. |
java.lang.String |
getStreamId()
Gets a unique identifier for this stream.
|
Stream.StreamVideoType |
getStreamVideoType()
Specifies the type of video for this stream.
|
int |
getVideoHeight()
The height of the stream, in pixels.
|
int |
getVideoWidth()
The width of the stream, in pixels.
|
boolean |
hasAudio()
Whether this stream has audio (
true ) or not (false ). |
int |
hashCode() |
boolean |
hasVideo()
Whether this stream has video (
true ) or not (false ). |
java.lang.String |
toString() |
protected java.lang.String streamId
protected java.util.Date creationTime
protected boolean hasVideo
protected boolean hasAudio
protected Connection connection
protected java.lang.String name
protected int videoWidth
protected int videoHeight
protected Session session
protected Stream.StreamVideoType videoType
protected Stream(java.lang.String streamId, java.lang.String streamName, int videoWidht, int videoHeight, boolean hasAudio, boolean hasVideo, Connection connection, Session session, int videoType)
public java.lang.String getStreamId()
public java.util.Date getCreationTime()
public boolean hasVideo()
true
) or not (false
).public boolean hasAudio()
true
) or not (false
).public Connection getConnection()
Connection
object corresponding to this Stream.
Compare the Connection object returned by the getConnection()
method with the Connection
object returned by Sesssion.getConnection()
to see if the new stream is published by your client.
Connection
object corresponding to this Stream.Session.getConnection()
public java.lang.String getName()
By default, this name appears when the user taps the video display of the stream.
However, you can call the SubscriberKit.setStyle(String key, String value)
or
SubscriberKit.setStyle(String key, String value)
(with the key
parameter
set to BaseVideoRenderer.STYLE_NAME_DISPLAY
) to change this behavior.
public int getVideoWidth()
For streams published using the scalable video feature, this is set to the width of the maximum resolution available for the stream. For more information on scalable video, see the documentation for the OpenTok Media Router.
public int getVideoHeight()
For streams published using the scalable video feature, this is set to the height of the maximum resolution available for the stream. For more information on scalable video, see the documentation for the OpenTok Media Router.
public Session getSession()
Session
object) the stream is bound to.public Stream.StreamVideoType getStreamVideoType()
StreamVideoType.StreamVideoTypeScreen
— The stream's video
encoding is optimized for screen sharing.StreamVideoType.StreamVideoTypeCamera
— The stream is not
optimized for screen sharing (for example, it uses a camera as the video source).public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(Stream s)
compareTo
in interface java.lang.Comparable<Stream>
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object