com.opentok.android.Stream
All Implemented Interfaces:
: Comparable
public final class Stream extends Object implements Comparable
Represents an audio-video stream in an OpenTok session. The
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.
Nested Class Summary
Nested Classes
Modifier and Type
Class
Description
static enum
Stream.StreamVideoType
Defines values for the getStreamVideoType() method.
Method Summary
All MethodsInstance MethodsConcrete MethodsDeprecated Methods
Modifier and Type
Method
Description
int
compareTo(Object o)
boolean
equals(Object obj)
protected void
finalize()
Connection
getConnection()
Returns the Connection object corresponding to this Stream.
Date
getCreationTime()
Returns the time when this stream first joined the OpenTok session.
String
getName()
The name of the stream.
Session
getSession()
Deprecated.
String
getStreamId()
Gets a unique identifier for this stream.
Stream.StreamVideoType
getStreamVideoType()
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).
boolean
hasCaptions()
Whether this stream has captions (true) or not (false).
int
hashCode()
boolean
hasVideo()
Whether this stream has video (true) or not (false).
String
toString()
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
Method Details
getStreamId
public String getStreamId()
Gets a unique identifier for this stream.
Returns: : A unique identifier for this stream.
getCreationTime
public Date getCreationTime()
Returns the time when this stream first joined the OpenTok session.
hasVideo
public boolean hasVideo()
Whether this stream has video (true) or not (false).
Returns: : true or false, indicating if the stream has video or not.
hasAudio
public boolean hasAudio()
Whether this stream has audio (true) or not (false).
Returns: : true or false, indicating if the stream has audio or not.
hasCaptions
public boolean hasCaptions()
Whether this stream has captions (true) or not (false).
Returns: : true or false, indicating if the stream has captions or not.
getConnection
public Connection getConnection()
Returns the 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.
Returns:
: The Connection object corresponding to this Stream.
See Also:
: - Session.getConnection()
getName
public String getName()
The name of the stream.
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.
Returns: : The name of the stream.
getVideoWidth
public int getVideoWidth()
The width of the stream, in pixels.
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.
Returns: : The width, in pixels.
getVideoHeight
public int getVideoHeight()
The height of the stream, in pixels.
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.
Returns: : The height, in pixels.
getSession
@Deprecated public Session getSession()
Deprecated.
Starting in version 2.17.0, this method will return null. The SDK does not save the relation between a given stream and the session in which it was created.
Returns: : null
getStreamVideoType
public Stream.StreamVideoType getStreamVideoType()
Returns: : Specifies the type of video for this stream. This is set one of the following values:
- `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).
- `StreamVideoType.StreamVideoTypeCustom` — The custom stream
video type applies only to Web generated streams.
See Also:
: - PublisherKit.setPublisherVideoType(PublisherKit.PublisherKitVideoType type)
toString
public String toString()
Overrides:
: toString in class Object
finalize
protected void finalize() throws Throwable
Overrides:
: finalize in class Object
Throws:
: Throwable
equals
public boolean equals(@Nullable Object obj)
Overrides:
: equals in class Object
hashCode
public int hashCode()
Overrides:
: hashCode in class Object
compareTo
public int compareTo(Object o)
Specified by:
: compareTo in interface Comparable