API: Shoplive Preview

    API: Shoplive Preview


    Article summary

    You can directly implement the preview through the ShoplivePreview or ShopliveSwipePrevew component provided by ShopLive.


    start

    Start preview playback.

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

    Parameter name

    Type

    Description

    accessKey

    String?

    Customer key

    campaignKey

    String?

    Broadcast key


    pause

    Pause the preview.

    fun pause()


    play

    Play the paused preview.

    fun play()


    release

    Turn off preview.

    fun release()


    setLifecycleObserver

    By registering a LifecycleOwner, the preview player can automatically play or pause according to the life cycle.

    fun setLifecycleObserver(owner: LifecycleOwner)

    Parameter name

    Type

    Description

    owner

    LifecycleOwner

    LifecycleOwner


    setOnCloseListener

    You can receive the preview end event.

    fun setOnCloseLisstener(onCloseListener: OnCloseListener)


    setOnDimensionRatioListener

    You can get the aspect ratio of the preview screen.

    fun setOnDimensionRatioListener(onDimensionRatioListener: OnDimensionRatioListener)


    useCloseButton

    You can enable a Close button in Preview.

    fun useCloseButton(use: Boolean)


    destroy

    You can release the preview memory.

    fun destroy()


    What's Next