Class Stream
- java.lang.Object
-
- com.opentok.android.Stream
-
- All Implemented Interfaces:
java.lang.Comparable
public final class Stream extends java.lang.Object implements java.lang.Comparable
Represents an audio-video stream in an OpenTok session. TheSession.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 class
Stream.StreamVideoType
Defines values for thegetStreamVideoType()
method.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
compareTo(java.lang.Object o)
boolean
equals(java.lang.Object obj)
protected void
finalize()
Connection
getConnection()
Returns theConnection
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()
Deprecated.java.lang.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
).java.lang.String
toString()
-
-
-
Method Detail
-
getStreamId
public java.lang.String getStreamId()
Gets a unique identifier for this stream.- Returns:
- A unique identifier for this stream.
-
getCreationTime
public java.util.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 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:
Session.getConnection()
-
getName
public java.lang.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)
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 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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
-