Class Stream
- All Implemented Interfaces:
Comparable
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 -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
protected void
finalize()
Returns theConnection
object corresponding to this Stream.Returns the time when this stream first joined the OpenTok session.getName()
The name of the stream.Deprecated.Gets a unique identifier for this stream.int
The height of the stream, in pixels.int
The width of the stream, in pixels.boolean
hasAudio()
Whether this stream has audio (true
) or not (false
).boolean
Whether this stream has captions (true
) or not (false
).int
hashCode()
boolean
hasVideo()
Whether this stream has video (true
) or not (false
).toString()
-
Method Details
-
getStreamId
Gets a unique identifier for this stream.- Returns:
- A unique identifier for this stream.
-
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
Returns theConnection
object corresponding to this Stream.Compare the Connection object returned by the
getConnection()
method with the Connection object returned bySesssion.getConnection()
to see if the new stream is published by your client.- Returns:
- The
Connection
object corresponding to this Stream. - See Also:
-
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)
orSubscriberKit.setStyle(String key, String value)
(with thekey
parameter set toBaseVideoRenderer.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.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
- 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:
-
toString
-
finalize
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable
-