MediaOutputScreenObject

Renders another media source's video composition inside a screen.

For RTMP playback, register the RTMP session factory first. Run the suspending session.connect() call from a coroutine. The example assumes an existing mixer and Android context.

StreamSession.Builder.registerFactory(RtmpStreamSessionFactory)
val session = StreamSession.Builder(context, Uri.parse("rtmps://example.com/live/stream"))
.setMode(StreamSession.Mode.PLAYBACK)
.build()
val video = MediaOutputScreenObject(context)
video.frame = Rect(0, 0, 160, 90)
video.videoSize = Size(1600, 900)
session.stream.registerOutput(video)
mixer.screen.addChild(video)
session.connect().getOrThrow()

When finished, close the session, unregister the output, and remove the object from the screen.

Constructors

Link copied to clipboard
constructor(context: Context, id: String? = null)

Properties

Link copied to clipboard

The rectangle computed by the most recent layout pass, in pixels.

Link copied to clipboard

The radius of the object's rounded corners, in composition pixels. Zero keeps square corners. The effective radius is limited to half of the object's shorter side.

Link copied to clipboard

A weak reference to the registered media source, or null when detached.

Link copied to clipboard

The display rotation, expressed as a Surface.ROTATION_* constant.

Link copied to clipboard
open override var elements: Map<String, String>

A key-value representation of this object for serialization.

Link copied to clipboard
open var frame: Rect

The requested layout rectangle, in pixels.

Link copied to clipboard

Specifies the alignment position along the horizontal axis.

Link copied to clipboard
val id: String

Unique identifier of this screen object.

Link copied to clipboard

The rotation and mirroring of the source image.

Link copied to clipboard

Whether to apply deviceOrientation when rotating the video.

Link copied to clipboard
open var isVisible: Boolean

Specifies the visibility of the object.

Link copied to clipboard

Margins used to position and size this object, in pixels.

Link copied to clipboard

The 4 × 4 model-view-projection matrix used for rendering.

Link copied to clipboard

The container that owns this object, or null when detached.

Link copied to clipboard

Whether the object needs another layout pass.

Link copied to clipboard

The destination surface for rendering the registered source's screen.

Link copied to clipboard
val target: Int
Link copied to clipboard
open var textureId: Int

OpenGL ES texture ID associated with this screen object.

Link copied to clipboard
var track: Int

The video track to render, matching the track passed to MediaMixer.attachVideo. Defaults to 0.

Link copied to clipboard
open override var type: String

Logical type of this screen object.

Link copied to clipboard

Specifies the alignment position along the vertical axis.

Link copied to clipboard

The effect applied when rendering this object.

Link copied to clipboard

How the video is scaled to fit its bounds.

Link copied to clipboard
open var videoSize: Size

The source video dimensions, in pixels.

Functions

Link copied to clipboard
open override fun append(buffer: MediaBuffer)

Receives a media buffer from the source. Consume or copy its payload before it is reused.

Link copied to clipboard
open fun draw(renderer: Renderer)

Draws the screen object.

Link copied to clipboard
open fun findById(id: String): ScreenObject?

Returns this object if its identifier matches, or null. Containers also search their descendants.

Link copied to clipboard

Returns packed scissor rectangles in local coordinates for the renderers.

Link copied to clipboard
open fun invalidateLayout()

Invalidates the current layout and triggers a layout update.

Link copied to clipboard
open override fun layout(renderer: Renderer)

Calculates the object bounds and updates its rendering layout.