YoutubeVideo()

Embeds a YouTube video using an iframe. Supports responsive sizing to maintain aspect ratio on all screen sizes.

Syntax
Result = MaterialSB::YoutubeVideo(Source.s, Flags = #Media_Default, Parent = #Null)
Parameters
Source.s The YouTube embed URL (e.g., "https://www.youtube.com/embed/VIDEO_ID").
Flags Optional. Media flags for styling.
Parent Optional. Parent element. If #Null, uses the current parent from the stack.
Flags
FlagDescription
#Media_DefaultStandard embed (default)
#Media_ResponsiveResponsive container that maintains 16:9 aspect ratio
Return Value

Returns the container div element (contains the iframe).

Remarks

Use the YouTube embed URL format: https://www.youtube.com/embed/VIDEO_ID

The #Media_Responsive flag wraps the iframe in a container that maintains the proper aspect ratio on all screen sizes. This is recommended for most use cases.

Example
Procedure Main(Success)
  If Success
    MaterialSB::Row(MaterialSB::#Grid_Container)
      MaterialSB::Col(12, 8)
        MaterialSB::Card()
          MaterialSB::CardContent()
            MaterialSB::Append(MaterialSB::Header("Featured Video", 4))
            
            ; Responsive YouTube embed
            MaterialSB::YoutubeVideo("https://www.youtube.com/embed/dQw4w9WgXcQ", MaterialSB::#Media_Responsive)
            
            MaterialSB::Append(MaterialSB::Paragraph("Check out this amazing video!"))
          MaterialSB::CloseCurrentParent()
        MaterialSB::CloseCurrentParent()
      MaterialSB::CloseCurrentParent()
      
      MaterialSB::Col(12, 4)
        MaterialSB::Card()
          MaterialSB::CardContent()
            MaterialSB::Append(MaterialSB::Header("Tutorial", 5))
            
            ; Another video
            MaterialSB::YoutubeVideo("https://www.youtube.com/embed/abc123xyz", MaterialSB::#Media_Responsive)
            
          MaterialSB::CloseCurrentParent()
        MaterialSB::CloseCurrentParent()
      MaterialSB::CloseCurrentParent()
    MaterialSB::CloseCurrentParent()
  EndIf
EndProcedure

MaterialSB::Download(@Main())
See Also

Video(), Image()