MediaPlayer
MediaPlayer 컴포넌트에 대한 문서 및 예제입니다.
언제 사용하나요
- 미디어 플레이어 컴포넌트는 오디오 또는 비디오 콘텐츠의 재생을 제어하는 데 사용할 수 있습니다. 미디어 재생, 일시 중지 및 탐색을 위한 표준 인터페이스를 제공합니다.
사용 예시
Night Drive
Synthwave Dream
1:45 -2:15
astro
<MediaPlayer
title="Night Drive"
artist="Synthwave Dream"
coverImage="https://images.unsplash.com/photo-1614613535308-eb5fbd3d2c17?q=80&w=200&auto=format&fit=crop"
isPlaying={true}
isLiked={true}
progress={45}
currentTime="1:45"
totalTime="-2:15"
/> 상태 및 모양
`isPlaying` 및 `isLiked` 속성을 사용하여 플레이어의 시각적 상태를 제어할 수 있습니다.
Morning Coffee
Lofi Chill
0:45 -3:15
astro
<MediaPlayer
title="Morning Coffee"
artist="Lofi Chill"
coverImage="https://images.unsplash.com/photo-1511379938547-c1f69419868d?q=80&w=200&auto=format&fit=crop"
isPlaying={false}
isLiked={false}
progress={12}
currentTime="0:45"
totalTime="-3:15"
/> API 참조
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| title | The title of the currently playing track. | string | 'Unknown Track' |
| artist | The artist of the currently playing track. | string | 'Unknown Artist' |
| coverImage | The URL for the album cover or thumbnail image. | string | '/designs/18.png' |
| progress | The current playback progress percentage (0-100). | number | 33 |
| currentTime | The formatted current playback time string (e.g., "1:23"). | string | '1:23' |
| totalTime | The formatted total or remaining time string (e.g., "-2:37"). | string | '-2:37' |
| isPlaying | Whether the media is currently playing. Toggles the play/pause icon. | boolean | false |
| isLiked | Whether the media is liked/favorited. Toggles the heart icon style. | boolean | false |
| class | Additional CSS classes to apply to the container. | string | - |