public class TextureViewRenderer extends BaseVideoRenderer
BaseVideoRenderer.Frame
STYLE_VIDEO_FILL, STYLE_VIDEO_FIT, STYLE_VIDEO_SCALE
Constructor and Description |
---|
TextureViewRenderer(android.content.Context context)
Create a new textureview renderer.
|
Modifier and Type | Method and Description |
---|---|
android.view.View |
getView()
Returns the View containing the video.
|
void |
onFrame(BaseVideoRenderer.Frame frame)
Called when a frame is rendered for the stream.
|
void |
onPause()
Call this method when the activity pauses.
|
void |
onResume()
Call this method when the activity resumes.
|
void |
onVideoPropertiesChanged(boolean videoEnabled)
Called when the stream changes between having video and not having video (audio-only).
|
void |
setStyle(java.lang.String key,
java.lang.String value)
Set a style for this video renderer.
|
public TextureViewRenderer(android.content.Context context)
context
- App contextpublic void onFrame(BaseVideoRenderer.Frame frame)
BaseVideoRenderer
onFrame
in class BaseVideoRenderer
frame
- The video frame. Call the getBuffer method
of this
object to get the frame data, which is in I420 format.public void setStyle(java.lang.String key, java.lang.String value)
BaseVideoRenderer
BaseVideoRenderer.STYLE_VIDEO_SCALE
. You can set a value for this key to determine
the scaling of the video. The following values are supported:
BaseVideoRenderer.STYLE_VIDEO_FILL
— The video scales to fill the entire
area of the renderer, with cropping as needed.
BaseVideoRenderer.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.
setStyle
in class BaseVideoRenderer
key
- The style to set.value
- The value you are setting the style to.public void onVideoPropertiesChanged(boolean videoEnabled)
BaseVideoRenderer
onVideoPropertiesChanged
in class BaseVideoRenderer
videoEnabled
- Whether the stream has video (true
)
or not (false
).public android.view.View getView()
BaseVideoRenderer
getView
in class BaseVideoRenderer
public void onPause()
BaseVideoRenderer
onPause
in class BaseVideoRenderer
BaseVideoRenderer.onResume()
public void onResume()
BaseVideoRenderer
onResume
in class BaseVideoRenderer
BaseVideoRenderer.onPause()