API - Play

ShopLive.setAccessKey

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

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

샘플 코드

ShopLive.setAccessKey("{AccessKey}")

ShopLive.play

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

fun play(context: Context, campaignKey: String)
fun play(context: Context, campaignKey: String, referrer: String? = null) 
fun play(context: Context, campaignKey: String, keepWindowStateOnPlayExecuted: Boolean)
fun play(context: Context, campaignKey: String, keepWindowStateOnPlayExecuted: Boolean, referrer: String? = null) 
매개변수설명
contextContext
campaignKey재생할 동영상의 캠페인(방송) 키
재생할 동영상의 캠페인(방송) 키 없이 play 함수를 호출하면 기본 캠페인(방송)을 재생합니다.
keepWindowStateOnPlayExecuted재생중인 플레이어의 실행 모드(pip, fullscreen)을 유지한 상태로 재생을 시작할 지 여부. 기본값(false)
true: 재생중인 플레이어의 실행 모드를 유지합니다.
false: fullscreen으로 실행됩니다.
referrer진입경로 통계를 측정할 수 있는 파라미터

샘플 코드

ShopLive.play(context, "{campaignKey}")
// or
ShopLive.play(context, "{campaignKey}", false or true) // 기본값 false
// or
ShopLive.play(context, "{campaignKey}", "{진입경로}")
// or
ShopLive.play(context, "{campaignKey}", false or true, "{진입경로}")

ShopLive.showPreviewPopup

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

fun showPreviewPopup(data: ShopLivePreviewData)
매개변수설명
activityactivity
accessKey고객사 key
campaignKey방송 key
maxHeight최대 높이 (기본 180dp)
maxWidth최대 너비 (기본 180dp)
marginTopmargin Top (기본 16dp)
marginBottommargin Bottom (기본 16dp)
marginLeftmargin Left (기본 16dp)
marginRightmargin Right (기본 16dp)
canTransition화면 전환 애니메이션 여
canVibrated미리 보기를 화면 밖으로 이동했을 때 진동 여부
useCloseButton미리 보기의 닫기 버튼 노출 여부
enabledSwipeOutPreview를 화면 밖으로 이동하여 종료 시킬 지 여부
position미리 보기 위치 지정
referrer진입 시점 tracking
onClickListener미리 보기 클릭 이벤트

샘플 코드

ShopLive.showPreviewPopup(ShopLivePreViewData(this@YourActivity, accessKey, campaignKey))
ShopLive.showPreviewPopup(this@YourActivity, “${accessKey}”, “${campaignKey}”)

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)