Stream
public final class Stream 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 types: Stream.StreamVideoType
Methods
| Name | Description |
|---|---|
compareTo(o) → {int} |
|
equals(obj) → {boolean} |
|
finalize() |
|
getConnection() → {Connection} |
Returns the Connection object corresponding to this Stream. |
getCreationTime() → {Date} |
Returns the time when this stream first joined the OpenTok session. |
getName() → {String} |
The name of the stream. |
getSession() → {Session} |
Starting in version 2.17.0, this method will return null. |
getStreamId() → {String} |
Gets a unique identifier for this stream. |
getStreamVideoType() → {Stream.StreamVideoType} |
|
getVideoHeight() → {int} |
The height of the publisher's capturer target resolution, in pixels, as last signaled to the session. |
getVideoWidth() → {int} |
The width of the publisher's capturer target resolution, in pixels, as last signaled to the session. |
hasAudio() → {boolean} |
Whether this stream has audio (true) or not (false). |
hasCaptions() → {boolean} |
Whether this stream has captions (true) or not (false). |
hasVideo() → {boolean} |
Whether this stream has video (true) or not (false). |
hashCode() → {int} |
|
toString() → {String} |
compareTo(o) → {int}
Parameters:
| Name | Type | Description |
|---|---|---|
o |
Object |
Returns:
int
equals(obj) → {boolean}
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
Object |
Returns:
boolean
finalize()
getConnection() → {Connection}
Returns the Connection object corresponding to this Stream.
Compare the Connection object returned by the Stream#getConnection method with the Connection
object returned by Sesssion.getConnection() to see if
the new stream is published by your client.
See:
: - Session#getConnection()
Returns:
The Connection object corresponding to this Stream.
getCreationTime() → {Date}
Returns the time when this stream first joined the OpenTok session.
Returns:
Date
getName() → {String}
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.
getSession() → {Session}
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.
Deprecated
Returns:
null
getStreamId() → {String}
Gets a unique identifier for this stream.
Returns:
A unique identifier for this stream.
getStreamVideoType() → {Stream.StreamVideoType}
See:
: - PublisherKit#setPublisherVideoType(PublisherKit.PublisherKitVideoType type)
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.
getVideoHeight() → {int}
The height of the publisher's capturer target resolution, in pixels, as last signaled to the session. This value is broadcast to all session participants and is readable on both the publishing and subscribing clients.
This value can change at runtime when the publisher changes the capture resolution, for example due to a device orientation change or a change in capture settings.
Note: This represents the publisher's capturer target resolution, not the resolution actually encoded or received by a subscriber. The publisher may encode at a lower resolution due to bandwidth or CPU constraints.
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, of the publisher's capturer target resolution.
getVideoWidth() → {int}
The width of the publisher's capturer target resolution, in pixels, as last signaled to the session. This value is broadcast to all session participants and is readable on both the publishing and subscribing clients.
This value can change at runtime when the publisher changes the capture resolution, for example due to a device orientation change or a change in capture settings.
Note: This represents the publisher's capturer target resolution, not the resolution actually encoded or received by a subscriber. The publisher may encode at a lower resolution due to bandwidth or CPU constraints.
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, of the publisher's capturer target resolution.
hasAudio() → {boolean}
Whether this stream has audio (true) or not (false).
Returns:
true or false, indicating if the stream has audio or not.
hasCaptions() → {boolean}
Whether this stream has captions (true) or not (false).
Returns:
true or false, indicating if the stream has captions or not.
hasVideo() → {boolean}
Whether this stream has video (true) or not (false).
Returns:
true or false, indicating if the stream has video or not.
hashCode() → {int}
Returns:
int
toString() → {String}
Returns:
String