public abstract class BaseVideoRenderer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
BaseVideoRenderer.Frame
Defines a frame of a video stream.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STYLE_VIDEO_FILL
A value for the
STYLE_VIDEO_SCALE style, specfying that the video
scales to fill the entire area of the renderer, with cropping as needed). |
static java.lang.String |
STYLE_VIDEO_FIT
A value for the
STYLE_VIDEO_SCALE style, specfying that the video
shrinks, as needed, so that the entire video is visible with pillarboxing. |
static java.lang.String |
STYLE_VIDEO_SCALE
A value for the
key parameter of the
setStyle(String key, String value) ,
SubscriberKit.setStyle(String key, String value) , and
PublisherKit.setStyle(String key, String value) methods, used
to determine the scaling of the video. |
Constructor and Description |
---|
BaseVideoRenderer() |
Modifier and Type | Method and Description |
---|---|
abstract android.view.View |
getView()
Returns the View containing the video.
|
abstract void |
onFrame(BaseVideoRenderer.Frame frame)
Called when a frame is rendered for the stream.
|
abstract void |
onPause()
Call this method when the activity pauses.
|
abstract void |
onResume()
Call this method when the activity resumes.
|
abstract void |
onVideoPropertiesChanged(boolean videoEnabled)
Called when the stream changes between having video and not having video (audio-only).
|
abstract void |
setStyle(java.lang.String key,
java.lang.String value)
Set a style for this video renderer.
|
public static final java.lang.String STYLE_VIDEO_SCALE
key
parameter of the
setStyle(String key, String value)
,
SubscriberKit.setStyle(String key, String value)
, and
PublisherKit.setStyle(String key, String value)
methods, used
to determine the scaling of the video. Valid values
for this key are BaseVideoRenderer.STYLE_VIDEO_FILL
(the video scales to
fill the entire area of the renderer, with cropping as needed) and
BaseVideoRenderer.STYLE_VIDEO_FIT
(the video shrinks, as needed, so that
the entire video is visible with pillarboxing).public static final java.lang.String STYLE_VIDEO_FILL
STYLE_VIDEO_SCALE
style, specfying that the video
scales to fill the entire area of the renderer, with cropping as needed).public static final java.lang.String STYLE_VIDEO_FIT
STYLE_VIDEO_SCALE
style, specfying that the video
shrinks, as needed, so that the entire video is visible with pillarboxing.public abstract void onFrame(BaseVideoRenderer.Frame frame)
frame
- The video frame. Call the getBuffer method
of this
object to get the frame data, which is in I420 format.public abstract void setStyle(java.lang.String key, java.lang.String value)
STYLE_VIDEO_SCALE
. You can set a value for this key to determine
the scaling of the video. The following values are supported:
STYLE_VIDEO_FILL
— The video scales to fill the entire
area of the renderer, with cropping as needed.
STYLE_VIDEO_FIT
— The video shrinks, as needed, so
that the entire video is visible, with pillarboxing (the default setting).
You can extend this class and override this method to support other styles and behaviors.
key
- The style to set.value
- The value you are setting the style to.public abstract void onVideoPropertiesChanged(boolean videoEnabled)
videoEnabled
- Whether the stream has video (true
)
or not (false
).public abstract android.view.View getView()
public abstract void onPause()
onResume()
public abstract void onResume()
onPause()