Skip to content

Attributes

Shared Attributes

These attributes apply to <py-audio>, <py-video>, and <py-player>.

AttributeTypeDefaultDescription
srcstringURL to the media file
titlestringTitle displayed in the player
themestring"auto"Color theme: auto light dark midnight nord sunset forest
accentstring"#378ADD"Accent color (any CSS color value)
tracksstringJSON array of track/chapter objects
playliststringURL to an M3U or M3U8 playlist file
layoutstring"normal"Layout preset: normal minimal album-art compact podcast visualizer playlist-first
allow-uploadbooleanPresence enables local file upload
stringsstringJSON object of UI string overrides

Layout-specific Attributes

AttributeTypeDefaultLayoutsDescription
posterstringalbum-art, podcastArtwork/thumbnail image URL
artiststringalbum-art, playlist-firstArtist name display
skip-backnumber15podcastSkip back seconds
skip-forwardnumber30podcastSkip forward seconds

Video-specific Attributes

These attributes apply to <py-video> only.

AttributeTypeDefaultDescription
posterstringThumbnail shown before playback
aspect-ratiostring"16/9"Video aspect ratio
autoplaybooleanStart playing automatically
mutedbooleanStart muted (required for autoplay in most browsers)
loopbooleanLoop playback

Smart Wrapper Attribute

AttributeTypeDefaultDescription
typestringForce "audio" or "video" — overrides auto-detection

Attribute Examples

html
<!-- Basic audio -->
<py-audio src="audio.mp3" title="My Podcast" theme="dark"></py-audio>

<!-- Full audio with tracks -->
<py-audio
  src="podcast.mp3"
  layout="podcast"
  theme="nord"
  accent="#5e81ac"
  title="Tech Talk"
  poster="episode.jpg"
  skip-back="15"
  skip-forward="30"
  tracks='[{"name":"Intro","time":"0:00"},{"name":"Main","time":"2:30"}]'
></py-audio>

<!-- Video with all options -->
<py-video
  src="video.mp4"
  poster="thumb.jpg"
  title="My Video"
  aspect-ratio="16/9"
  theme="midnight"
></py-video>

<!-- Smart wrapper with forced type -->
<py-player src="stream.m3u8" type="video"></py-player>

Track Format

Flat tracks (single file)

json
[
  { "name": "Intro",   "time": "0:00" },
  { "name": "Main",    "time": "2:30" },
  { "name": "Outro",   "time": "28:00" }
]

Multi-file playlist

json
[
  {
    "name": "Episode 1",
    "src": "ep1.mp3",
    "chapters": [
      { "name": "Intro", "time": "0:00" },
      { "name": "Main",  "time": "3:00" }
    ]
  },
  {
    "name": "Episode 2",
    "src": "ep2.mp3"
  }
]

Time format: mm:ss or hh:mm:ss.