API - Play

    API - Play


    기사 요약

    ShopLive.setAccessKey

    Shoplive Android SDK를 사용할 수 있도록 AccessKey를 설정합니다.

    fun setAccessKey(accessKey: String)

    Parameter name

    Type

    Description

    accesskey

    String

    ShopLive 담당자에게 받은 AccessKey

    Sample code

    ShopLive.setAccessKey("{AccessKey}")


    ShopLive.play

    CampaignKey를 사용하여 동영상을 재생합니다.

    fun play(context: Context, data: ShopLivePlayerData)
    fun intentPlay(context: Context, data: ShopLivePlayerData): Intent

    Parameter name

    Type

    Description

    context

    Context

    Context

    data

    ShopLivePlayerData

    Play 관련 기능 data

    ShopLivePlayerData

    Property name

    Type

    Description

    campaignKey

    String

    재생할 동영상의 캠페인(방송) 키 (필수)

    keepWindowStateOnPlayExecuted

    Boolean

    재생 중인 플레이어의 실행 모드(pip, fullscreen)을 유지한 상태로 재생을 시작할 지 여부. 기본값(false)

    • true: 재생중인 플레이어의 실행 모드를 유지합니다.

    • false: fullscreen으로 실행됩니다.

    referrer

    String?

    진입경로 통계를 측정할 수 있는 파라미터

    Sample code

    ShopLive.play(this, ShopLivePlayerData(campaignKey).apply {
        keepWindowStateOnPlayExecuted = false
        referrer = "referrer"
    })


    ShopLive.showPreviewPopup

    캠페인(방송) 키를 사용하여 미리 보기 뷰로 영상을 무음 재생합니다.

    fun showPreviewPopup(activity: Activity, data: ShopLivePreviewData)

    Parameter name

    Type

    Description

    activity

    Activity

    Activity

    data

    ShopLivePreviewData

    Preview 관련 data

    ShopLivePreviewData

    Property name

    Type

    Description

    campaignKey

    String

    재생할 동영상의 캠페인(방송) 키 (필수)

    maxHeight

    Int

    최대 높이 (기본 180dp)

    maxWidth

    Int

    최대 너비 (기본 180dp)

    marginTop

    Int

    margin Top (기본 16dp)

    marginBottom

    Int

    margin Bottom (기본 16dp)

    marginLeft

    Int

    margin Left (기본 16dp)

    marginRight

    Int

    margin Right (기본 16dp)

    isMuted

    Boolean

    음소거 기능 (기본 false)

    canTransition

    Boolean

    화면 전환 애니메이션 여부

    canVibrated

    Boolean

    미리 보기를 화면 밖으로 이동했을 때 진동 여부

    useCloseButton

    Boolean

    미리 보기의 닫기 버튼 노출 여부

    enabledSwipeOut

    Boolean

    Preview를 화면 밖으로 이동하여 종료 시킬 지 여부

    useCustomAction

    Boolean

    바로 방송 상세화면으로 이동하지 않고 onClickListener의 이벤트로 전달

    position

    ShopLivePreviewPositionConfig

    미리 보기 위치 지정

    TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT

    isEnabledVolumeKey

    Boolean

    디바이스 볼륨에 따라 음소거 해제될 수 있는 기능이 추가되었습니다. (기본 false)

    referrer

    String?

    진입 시점 tracking

    onClickListener

    View.OnClickListener?

    미리 보기 클릭 이벤트

    onCloseListener

    ShopLivePreview.OnCloseListener?

    미리 보기 닫힘 이벤트

    ShopLive.setPreviewTransitionAnimation

    Preview 기능 중 useCustomAction을 사용할 때 transitionAnimation을 사용할 수 있습니다.

    fun setPreviewTransitionAnimation(activity: Activity, view: View?)

    Sample code

    ShopLive.showPreviewPopup(this, ShopLivePreviewData(campaignKey).apply {
        useCloseButton = true
        enabledSwipeOut = true
        useCustomAction = true
        onClickListener = OnClickListener { view ->
            ShopLive.setPreviewTransitionAnimation(this@MainActivity, view)
            ShopLive.play(this@MainActivity, ShopLivePlayerData(campaignKey).apply {
                referrer = viewModel.getReferrerText()
            })
        }
        onCloseListener = ShopLivePreview.OnCloseListener { view ->
            view.destroy()
        }
    })


    ShopLive.hidePreviewPopup

    재생 중인 팝업형 미리 보기를 숨깁니다.

    fun hidePreviewPopup()

    Sample code

    ShopLive.hidePreviewPopup()


    ShopLivePreview

    ShopLive에서 제공하는 ShopLivePreview 또는 ShopLiveSwipePreview 컴포넌트를 통해서 프리뷰를 직접 구현할 수 있습니다.

    start

    미리보기 재생을 시작합니다.

    fun start(accessKey: String?, campaignKey: String?)

    Parameter name

    Type

    Description

    accessKey

    String?

    고객사 key

    campaignKey

    String?

    방송 key

    pause

    미리보기를 일시정지 합니다.

    fun pause()

    play

    일시정지 된 미리보기를 재생합니다.

    fun play()

    release

    미리보기를 해제합니다.

    fun release()

    setLifecycleObserver

    LifecycleOwner를 등록하면 라이프 사이클에 맞게 미리보기 플레이어가 자동으로 play 또는 pause 할 수 있습니다.

    fun setLifecycleObserver(owner: LifecycleOwner)

    Parameter name

    Type

    Description

    LifecycleOwner

    owner

    LifecycleOwner

    setOnCloseListener

    미리보기 종료 이벤트를 받을 수 있습니다.

    fun setOnCloseListener(onCloseListener: OnCloseListener)

    setOnDimensionRatioListener

    미리보기 화면의 가로 세로 비율을 얻을 수 있습니다.

    fun setOnDimensionRatioListener(onDimensionRatioListener: OnDimensionRatioListener)


    What's Next