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.
Properties
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.
A weak reference to the registered media source, or null when detached.
The display rotation, expressed as a Surface.ROTATION_* constant.
Specifies the alignment position along the horizontal axis.
The rotation and mirroring of the source image.
Whether to apply deviceOrientation when rotating the video.
Margins used to position and size this object, in pixels.
The 4 × 4 model-view-projection matrix used for rendering.
The container that owns this object, or null when detached.
Whether the object needs another layout pass.
Specifies the alignment position along the vertical axis.
The effect applied when rendering this object.
How the video is scaled to fit its bounds.
Functions
Receives a media buffer from the source. Consume or copy its payload before it is reused.
Returns this object if its identifier matches, or null. Containers also search their descendants.
Returns packed scissor rectangles in local coordinates for the renderers.
Invalidates the current layout and triggers a layout update.