ShopLivePreview를 이용하여 원하는 위치에 직접 구현하기

기본 In App Preview 사용하기

Shoplive SDK에서 제공하는 ShopLivePreview를 이용하여 미리보기를 직접 구현할 수 있습니다.

// If only one of width or height is written, it is flexible.
<cloud.shoplive.sdk.ShopLivePreview
    android:id="@+id/preview"
    android:layout_width="something dimens"
    android:layout_height="something dimens" />
preview.start("{accessKey}", "{campaignKey}")
preview.setOnClickListener {     
    // Preview transition animation      
    ShopLive.setPreviewTransitionAnimation(requireActivity(), binding.preview)
    ShopLive.play(requireActivity(), campaignKey)
    preview.release()
}

// For lifecycle observing preview
preview.setLifecycleObserver(this.viewLifecycleOwner)

Swipe 동작으로 종료할 수 있는 In App Preview 사용하기

ShopLiveSwipePreview를 이용하면 swipe 하여 미리보기를 종료할 수 있습니다. 사용방식은 ShopLivePreview와 동일합니다.

<cloud.shoplive.sdk.ShopLiveSwipePreview
    android:id="@+id/swipePreview"
    android:layout_width="something dimens"
    android:layout_height="something dimens" />
swipePreview.start("{accessKey}", "{campaignKey}")
swipePreview.setOnPreviewClickListener {
// Preview transition animation
ShopLive.setPreviewTransitionAnimation(requireActivity(), binding.preview)
ShopLive.play(requireActivity(), campaignKey)
swipePreview.release()
}

// For lifecycle observing preview
swipePreview.setLifecycleObserver(this.viewLifecycleOwner)