기본 사용법

가장 간단한 사용법은 Composable VpePlayer 입니다. 라이선스 체크, 옵션 머지, 컨트롤바, 자막, DRM, 전체화면, PiP 를 SDK 가 내부에서 처리하므로 컨트롤러를 직접 만들 필요가 없습니다.

Map 옵션

옵션을 Map<String, Any?> 로 전달합니다. 공개 API 호출부에는 @OptIn(UnstableApi::class) 를 붙입니다.

Screen.kt
import com.navercloud.vpe.player.VpePlayer
import androidx.media3.common.util.UnstableApi
import androidx.compose.runtime.Composable

@OptIn(UnstableApi::class)
@Composable
fun Screen() {
    VpePlayer(
        accessKey = "YOUR_ACCESS_KEY",
        platform = "pub",   // 기본 "pub"
        stage = "prod",     // 기본 "prod"
        options = mapOf(
            "autostart" to true,
            "muted" to true,
            "aspectRatio" to "16:9",
            "objectFit" to "contain",
            "playlist" to listOf(mapOf(
                "file" to "https://.../master.m3u8",
                "description" to mapOf("title" to "샘플 영상", "profile_name" to "NCP")
            ))
        )
    )
}

JSON 문자열 옵션

<VpePlayer> 와 동일한 스키마의 JSON 문자열을 optionsJson 으로 그대로 전달할 수 있습니다. 서버에서 내려준 옵션 JSON 을 변환 없이 사용할 때 유용합니다.

VpePlayer(
    accessKey = "YOUR_ACCESS_KEY",
    optionsJson = """
      { autostart: true, muted: true, aspectRatio: "16/9",
        playlist: [{ file: "https://.../master.m3u8", description: { title: "샘플" } }] }
    """.trimIndent()
)

JSON 은 느슨한 파싱을 지원합니다 — 키 따옴표 생략({ file: ... }), 후행 콤마, // 주석, 작은따옴표 허용. Map 방식과 결과는 동일합니다.

VpePlayer(...) Composable 은 컨트롤러를 내부에서 생성하고 자동으로 해제합니다. 명령형 제어가 필요하면 컨트롤러 제어 페이지를 참고하세요.
Android SDKBeta