Component Name
YouTubeVideo
Builder Function Name
create_youtube_video_manager
Description
Embeds a YouTube video based on the provided video ID, handling loading states and error messages. Supports theme customization and responsive resizing.
Use like example
Config
Property | Type | Default | Description |
---|---|---|---|
id | string or null | generated unique ID | A unique identifier for the YouTubeVideo component. If not provided, a unique ID is generated automatically. |
video_id | string | The unique identifier of the YouTube video to embed. This is required for rendering the video. | |
is_dark_theme | boolean | false | Determines the theme of the embedded video. If true, applies a dark theme; otherwise, a light theme is used. |
Methods
Method | Description | Parameters | Returns |
---|---|---|---|
render_video | Attempts to load and render the YouTube video by checking the availability of the video thumbnail. Sets error messages if the video fails to load. | No Params | |
resize_video | Adjusts the size of the video container to maintain a 16:9 aspect ratio, ensuring responsiveness based on the container's width. | No Params |
Returned Properties
Property | Type | Description |
---|---|---|
id | string | The unique identifier of the YouTubeVideo component. |
video_id | string | The YouTube video ID being embedded. |
theme | string | The current theme of the embedded video ('dark' or 'light'). |