API - Play

ShopLive.setAccessKey

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

fun setAccessKey(accessKey: String)
매개변수설명
accesskeyShopLive 담당자에게 받은 AccessKey

샘플 코드

ShopLive.setAccessKey("{AccessKey}")

ShopLive.play

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

fun play(context: Context, data: ShopLivePlayerData)
fun intentPlay(context: Context, data: ShopLivePlayerData): Intent
fieldtypedescription
contextContextContext
dataShopLivePlayerDataPlay 관련 기능 data

ShopLivePlayerData

fieldtypedescription
campaignKeyString재생할 동영상의 캠페인(방송) 키 (필수)
keepWindowStateOnPlayExecutedBoolean재생중인 플레이어의 실행 모드(pip, fullscreen)을 유지한 상태로 재생을 시작할 지 여부. 기본값(true)

true: 재생중인 플레이어의 실행 모드를 유지합니다.
false: fullscreen으로 실행됩니다.
referrerString?진입경로 통계를 측정할 수 있는 파라미터

샘플 코드

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

ShopLive.showPreviewPopup

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

fun showPreviewPopup(data: ShopLivePreviewData)
fieldtypedescription
activityActivityactivity
dat기aShop트LivePreviewDataPreview 관련 data

ShopLivePlayerData

fieldtypedescription
campaignKeyString재생할 동영상의 캠페인(방송) 키 (필수)
maxHeightInt최대 높이 (기본 180dp)
maxWidthInt최대 너비 (기본 180dp)
marginTopIntmargin Top (기본 16dp)
marginBottomIntmargin Bottom (기본 16dp)
marginLeftIntmargin Left (기본 16dp)
marginRightIntmargin Right (기본 16dp)
canTransitionBoolean화면 전환 애니메이션 여부
canVibratedBoolean미리 보기를 화면 밖으로 이동했을 때 진동 여부
useCloseButtonBoolean미리보기의 닫기 버튼 노출 여부
enabledSwipeOutBoolean미리보를 화면 밖으로 이동하여 종료 시킬 지 여부
useCustomActionBoolean바로 방송 상세화면으로 이동 하지 않고 onClickListener의 이벤트로 전달
positionShopLivePreviewPositionConfig미리 보기 위치 지정
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
radiusfloat코너 radius (기본 10dp)
referrerString?진입 시점 tracking
onInitializeListenerShopLivePreview.OnInitializeListener미리보기 그려질때 이벤트
onRenderedFirstFrameListenerShopLivePreview.OnRenderedFirstFrameListener미리보기 영상 송출될 때 이벤트
onClickListenerView.OnClickListener?미리보기 클릭 이벤트
onCloseListenerShopLivePreview.OnCloseListener?미리보기 닫힘 이벤트
onCampaignListenerShopLivePreview.OnCampaignListener?캠페인 정보 이벤트
onBrandListenerShopLivePreview.OnBrandListener?브랜드 정보 이벤트

ShopLive.setPreviewTransitionAnimation

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

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

샘플 코드

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()

샘플 코드

ShopLive.hidePreviewPopup()

ShopLivePreview

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


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

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

fun start(accessKey: String?, campaignKey: String?)
매개변수설명
accessKey고객사 key
campaignKey방송 key

pause

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

fun pause()

play

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

fun play()

release

미리보기를 해제합니다.

fun release()

setLifecycleObserver

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

fun setLifecycleObserver(owner: LifecycleOwner)
매개변수설명
ownerLifecycleOwner

setOnCloseListener

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

fun setOnCloseListener(onCloseListener: OnCloseListener)

setOnDimensionRatioListener

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

fun setOnDimensionRatioListener(onDimensionRatioListener: OnDimensionRatioListener)