API - Play
ShopLive.setAccessKey
Shoplive Android SDK
를 사용할 수 있도록 AccessKey
를 설정합니다.
void setAccessKey(@NonNull String accessKey)
fun setAccessKey(accessKey: String)
매개변수 | 설명 |
---|---|
accesskey | ShopLive 담당자에게 받은 AccessKey |
샘플 코드
ShopLive.setAccessKey("{AccessKey}")
- 적용 가이드
ShopLive.play
CampaignKey
를 사용하여 동영상을 재생합니다.
void play(@NonNull String campaignKey)
void play(@NonNull String campaignKey, @Nullable String referrer)
void play(@NonNull String campaignKey, Boolean keepWindowStateOnPlayExecuted)
void play(@NonNull String campaignKey, Boolean keepWindowStateOnPlayExecuted, @Nullable String referrer)
fun play(campaignKey: String)
fun play(campaignKey: String, referrer: String? = null)
fun play(campaignKey: String, keepWindowStateOnPlayExecuted: Boolean)
fun play(campaignKey: String, keepWindowStateOnPlayExecuted: Boolean, referrer: String? = null)
매개변수 | 설명 |
---|---|
campaignKey | 재생할 동영상의 캠페인(방송) 키 재생할 동영상의 캠페인(방송) 키 없이 play 함수를 호출하면 기본 캠페인(방송)을 재생합니다. |
keepWindowStateOnPlayExecuted | 재생중인 플레이어의 실행 모드(pip, fullscreen)을 유지한 상태로 재생을 시작할 지 여부. 기본값(false) true: 재생중인 플레이어의 실행 모드를 유지합니다. false: fullscreen으로 실행됩니다. |
referrer | 진입경로 통계를 측정할 수 있는 파라미터 |
샘플 코드
ShopLive.play("{campaignKey}")
// or
ShopLive.play("{campaignKey}", false or true) // 기본값 false
// or
ShopLive.play("{campaignKey}", "{진입경로}")
// or
ShopLive.play("{campaignKey}", false or true, "{진입경로}")
- 적용 가이드
ShopLive.showPreview
캠페인(방송) 키를 사용하여 미리보기 뷰로 영상을 무음 재생합니다.
isOsPip
를 true
로 설정하고 방송 화면에 진입하면 PIP 화면 모드로 전환됩니다.
안드로이드 권한 요청이 필요한 API입니다.
void showPreview(@NonNull String campaignKey) // 필요 권한: 다른 앱 위에 표시
void showPreview(@NonNull String campaignKey, Boolean isOsPip)
fun showPreview(campaignKey: String) // 필요 권한: 다른 앱 위에 표시
fun showPreview(campaignKey: String, isOsPip: Boolean)
매개변수 | 설명 |
---|---|
campaignKey | 캠페인(방송) 키 |
isOsPip | OS PIP로 전환 여부true : 방송 화면 진입 후 PIP 화면 모드로 전환 |
isOsPip
는 true
만 설정할 수 있습니다.
샘플 코드
// 일반 View로 미리보기를 재생합니다.
ShopLive.showPreview("{CampaignKey}")
// PIP View로 미리보기를 재생합니다.
ShopLive.showPreview("{CampaignKey}", true)
ShopLive.hidePreview
재생 중인 미리보기 화면을 숨깁니다.
void hidePreview()
fun hidePreview()
샘플 코드
ShopLive.hidePreview()
ShopLive.resumePreview
숨겨진 미리보기 화면을 다시 표시합니다.
void resumePreview()
fun resumePreview()
샘플 코드
ShopLive.resumePreview()
ShopLive.showPreviewPopup
캠페인(방송) 키를 사용하여 미리 보기 뷰로 영상을 무음 재생합니다.
void showPreviewPopup(@NonNull ShopLivePreviewData data)
void showPreviewPopup(@NonNull Activity activity, @NonNull String accessKey, @NonNull String campaignKey)
fun showPreviewPopup(data: ShopLivePreviewData)
fun showPreviewPopup(activity: Activity, accessKey: String, campaignKey: String)
매개변수 | 설명 |
---|---|
activity | activity |
accessKey | 고객사 key |
campaignKey | 방송 key |
maxHeight | 최대 높이 (기본 180dp) |
maxWidth | 최대 너비 (기본 180dp) |
marginTop | margin Top (기본 16dp) |
marginBottom | margin Bottom (기본 16dp) |
marginLeft | margin Left (기본 16dp) |
marginRight | margin Right (기본 16dp) |
canTransition | 화면 전환 애니메이션 여 |
canVibrated | 미리 보기를 화면 밖으로 이동했을 때 진동 여부 |
useCloseButton | 미리 보기의 닫기 버튼 노출 여부 |
enabledSwipeOut | Preview를 화면 밖으로 이동하여 종료 시킬 지 여부 |
position | 미리 보기 위치 지정 |
referrer | 진입 시점 tracking |
onClickListener | 미리 보기 클릭 이벤트 |
샘플 코드
ShopLive.showPreviewPopup(ShopLivePreViewData(this@YourActivity, accessKey, campaignKey))
ShopLive.showPreviewPopup(this@YourActivity, “${accessKey}”, “${campaignKey}”)
- 적용 가이드
ShopLive.hidePreviewPopup
재생 중인 팝업형 미리 보기를 숨깁니다.
void 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)
매개변수 | 설명 |
---|---|
owner | LifecycleOwner |
setOnCloseListener
미리보기 종료 이벤트를 받을 수 있습니다.
fun setOnCloseListener(onCloseListener: OnCloseListener)
setOnDimensionRatioListener
미리보기 화면의 가로 세로 비율을 얻을 수 있습니다.
fun setOnDimensionRatioListener(onDimensionRatioListener: OnDimensionRatioListener)
Updated 4 months ago