view_tubi_exo_player.xml


Overview

`view_tubi_exo_player.xml` is an Android layout resource file that defines the visual structure for a custom video player interface based on **ExoPlayer**, an open-source media player library for Android. This layout is designed specifically to integrate with the ExoPlayer UI components and provides the necessary views to display video content, subtitles, artwork, and player controls in a polished and responsive manner.

This file uses the `` tag to efficiently combine its views into a parent container without adding an unnecessary extra view hierarchy layer, optimizing layout performance.


Detailed Explanation

Root Element: <merge>


Key UI Components Defined

1. AspectRatioFrameLayout (id: exo_content_frame)


2. View (id: exo_controller_placeholder)


3. FrameLayout (id: exo_overlay)


Implementation Details and Usage


Interaction With Other System Components


Example Usage Snippet (Kotlin)

val playerView = LayoutInflater.from(context).inflate(R.layout.view_tubi_exo_player, parent, false) as ViewGroup
val exoContentFrame = playerView.findViewById<AspectRatioFrameLayout>(R.id.exo_content_frame)

// Assuming `exoPlayer` is initialized
exoPlayer.setVideoSurfaceView(SurfaceView(context).also {
    exoContentFrame.addView(it, 0) // Insert as first child dynamically
})

// Controller and overlays managed by the player view class that inflates this layout.

Visual Diagram: Component Structure of view_tubi_exo_player.xml

componentDiagram
    component "AspectRatioFrameLayout\n(exo_content_frame)" {
        [Video Surface (dynamic)]
        [View: exo_shutter]
        [ImageView: exo_artwork]
        [SubtitleView: exo_subtitles]
    }
    component "View\n(exo_controller_placeholder)"
    component "FrameLayout\n(exo_overlay)"

    "AspectRatioFrameLayout\n(exo_content_frame)" <|-- "Video Surface (dynamic)"
    "view_tubi_exo_player.xml" --> "AspectRatioFrameLayout\n(exo_content_frame)"
    "view_tubi_exo_player.xml" --> "View\n(exo_controller_placeholder)"
    "view_tubi_exo_player.xml" --> "FrameLayout\n(exo_overlay)"

Summary