API - Option

    API - Option


    Article summary

    ShopLive.setUser

    Setting user information for Shoplive.

    fun setUser(user: ShopLiveUser)
    

    enum ShopLiveUserGender

    type

    explanation

    Male

    male

    Female

    female

    Neutral

    No gender specified


    ShopLive.setAuthToken

    This is the security authentication token (JWT) string of the authenticated user using Shoplive.
    For user authentication, enter the authenticated user's security authentication token (JWT) string.

    fun setAuthToken(authToken: String)
    

    ShopLive.getAuthToken

    Returns the JWT token string for user authentication.

    fun getAuthToken(): String
    

    ShopLive.setPIPRatio

    This is the default screen scale when starting PIP screen mode.
    When you start PIP screen mode after playing for the first time, PIP screen mode starts with the specified screen scale.

    fun setPIPRatio(ratio: ShopLivePIPRatio)
    

    enumShopLivePIPRatio

    RATIO_1X1

    1 x 1

    RATIO_1X2

    1 x 2

    RATIO_2X3

    2 x 3

    RATIO_3X4

    3 x 4

    RATIO_9X16

    9 x 16


    ShopLive.setKeepAspectOnTabletPortrait

    Set the Shoplive screen ratio in tablet portrait mode. 
    true: Maintain aspect ratio (default)
    false: Fullscreen

    fun setKeepAspectOnTabletPortrait(isKeepAspectOnTabletPortrait: Boolean)
    

    parameter

    explanation

    isKeepAspectOnTabletPortrait

    true: Maintain screen ratio : Fill screen


    false


    ShopLive.setKeepPlayVideoOnHeadphoneUnplugged

    The video stops when the earphones (or headset) are disconnected.
    You can set the video to play continuously or leave it muted upon your needs

    • To change to silent mode when Bluetooth earphones (or headset) are disconnected, you need to declare BLUETOOTH_CONNECT in AndroidManifest.xml and then grant runtime permission before entering the broadcast, if you want to set it with setKeepPlayVideoOnHeadphoneUnplugged(true, true).

    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    
    fun setKeepPlayVideoOnHeadphoneUnplugged(isKeepPlayVideoOnHeadphoneUnplugged: Boolean)
    fun setKeepPlayVideoOnHeadphoneUnplugged(isKeepPlayVideoOnHeadphoneUnplugged: Boolean, isMute: Boolean)
    

    parameter

    description

    isKeepPlayVideoOnHeadphoneUnplugged

    true: Continue playing video : Pause video


    false

    isMute

    true: Process system volume mute : Maintain system volume playback


    false


    ShopLive.setAutoResumeVideoOnCallEnded

    When you return to the video after ending the call, the video will continue to play.
    However, you can set the video to pause if necessary.

    Required permissions:READ_PHONE_STATE

    fun setAutoResumeVideoOnCallEnded(isAutoResumeVideoOnCallEnded: Boolean)
    

    parameter

    explanation

    isAutoResumeVideoOnCallEnded

    true: Continue playing video


    false: Pause video


    ShopLive.setShareScheme

    When selecting "Share", set the URL or scheme to be passed.

    parameter

    explanation

    shareUrl

    share orschemeURL


    ShopLive.setLoadingProgressColor

    Set the video loading progress bar color.

    fun setLoadingProgressColor(@ColorInt colorInt: Int)
    

    field

    type

    colorInt

    ColorInt

    Color to set for progress bar


    ShopLive.setLoadingAnimation

    Set the video loading progress bar as an image animation.

    fun setLoadingAnimation(animationDrawable: Int)
    

    parameter

    explanation

    animationDrawable

    Image Array Resource


    ShopLive.setChatViewTypeface

    Set the chat font and chat send button font.

    • To apply the same font to both the chat and the chat send button, call the setChatViewTypeface(typeface) function.

      fun setChatViewTypeface(typeface: Typeface)
      

    parameter

    explanation

    typeface

    Common font for chat font and chat send button font

    sample code

    val nanumGothic = resources.getFont(R.font.nanumgothic)
    val nanumGothicBold = resources.getFont(R.font.nanumgothicbold)
    
    ShopLive.setChatViewTypeface(nanumGothic)
    

    ShopLive.setEnterPipModeOnBackPressed

    While watching a video, selecting (tapping) the back button to exit the screen will end the video. However, this option can be used to switch to Picture-in-Picture (PIP) mode and continue watching the video.

    fun setEnterPipModeOnBackPressed(isEnterPipModeOnBackPressed: Boolean)
    

    parameter

    description

    isEnterPipModeOnBackPressed

    true: Switch to PIP screen mode : End video


    false


    ShopLive.close

    Closing the player

    fun close()
    

    ShopLive.setAutoCloseWhenAppDestroyed

    You can set it so that the player does not close even if the root activity is terminated.

    The reason for using this option is to prevent the broadcast from ending when the root activity is relaunched using the Intent.FLAG_ACTIVITY_NEW_TASK option. It allows for the ShopLive.close function to be called directly to properly terminate the broadcast when the app is appropriately closing.

    • Default: Automatic termination

    • If not set, the player will close when the app is closed.

      fun setAutoCloseWhenAppDestroyed(isAutoClose: Boolean)
      

    parameter

    explanation

    isAutoClose

    true: Broadcast ends when app closes (default) : Broadcast does not end when app closes


    false


    ShopLive.startPictureInPicture

    Switch from full screen mode to PIP screen mode.

    fun startPictureInPicture()
    

    ShopLive.stopPictureInPicture

    Switch PIP screen mode to full screen mode.

    fun stopPictureInPicture()
    

    ShopLive.getStatus

    Getting Shoplive player status

    fun getStatus(): Status
    

    enum Status

    situation

    explanation

    None

    no status

    PIP

    picture-in-picture mode

    Full

    full screen mode


    ShopLive.isShowingPreviewPopup

    This is the information provided when successfully entering the Shoplive Preview.

    fun isSuccessCampaignJoin(): Boolean
    

    ShopLive.isSuccessCampaignJoin

    This is information provided when entry into the broadcast is successful.

    fun isSuccessCampaignJoin(): Boolean
    

    ShopLive.sendCommandMessage

    Delivers commands and payload to the server.
    You can pass commands and payloads in predefined formats. (Alternatively, you can define the command and payload in consultation with Shoplive.)

     fun sendCommandMessage(command: String, payload: Map<String, Any?>)
    

    parameter

    explanation

    command

    predefinedcommand

    payload

    predefinedpayload


    ShopLive.setMuteWhenPlayStart

    Set the sound to turn on or mute when you start Shoplive Player.
    (Default: Starts Shoplive Player with sound turned on.)

    fun setMuteWhenPlayStart(isMute: Boolean)
    

    parameter

    explanation

    isMute

    Whether to mute : Start with mute : Start with sound on


    true


    false


    ShopLive.setAppVersion

    Set the app version.
    Even if you don't call the API, the app version is read by default and passed to the server.
    Please contact your Shoplive representative to use this feature.

    fun setAppVersion(appVersion: String)
    

    parameter

    explanation

    appVersion

    app version


    ShopLive.setVisibleStatusBar

    You can hide the StatusBar on the screen.

    fun setVisibleStatusBar(isVisible: Boolean)
    

    parameter

    type

    explanation

    isVisible

    Boolean

    Set whether to hide the status bar : Show status bar (default value) : Hide status bar


    true


    false


    ShopLive.setSystemBarColor

    You can change the color of the SystemBar on your screen.

    fun setSystemBarColor(data: ShopLivePlayerSystemBarColorData)
    

    field

    type

    explanation

    data

    ShopLivePlayerSystemBarColorData

    SystemBar color data

    ShopLivePlayerSystemBarColorData

    field

    type

    description

    statusBarColor

    ColorInt

    You can change the StatusBar color.


    defaultShopLivePlayerSystemBarColorData.DEFAULT_COLOR

    navigationBarColor

    ColorInt

    You can change the SystemBar color.


    defaultShopLivePlayerSystemBarColorData.DEFAULT_COLOR

    sample code

    
    ShopLive.setSystemBarColor(ShopLivePlayerSystemBarColorData().apply {
        statusBarColor = Color.TRANSPARENT
    })
    

    ShopLive.setSoundFocusHandling

    If a phone call comes in while playing a video or the sound is suppressed due to the use of another app's player, you can receive the event and handle it directly.

    fun setSoundFocusHandling(listener: OnAudioFocusListener?)
    

    parameter

    explanation

    listener

    AudioFocusListener


    ShopLive.showDialogFragment

    Used to display the user's DialogFragment on the Shoplive Player screen.

    fun showDialogFragment(dialogFragment: DialogFragment)
    

    parameter

    explanation

    dialogFragment

    User's DialogFragment


    ShopLive.closeDialogFragment

    To close the dialog displayed using ShopLive.showDialogFragment(fragment).

    fun closeDialogFragment()
    


    ShopLive.setPlayerScreenCaptureEnabled

    You can prevent screenshots of the broadcast screen.

    fun setPlayerScreenCaptureEnabled(isEnabled: Boolean)
    

    parameter

    explanation

    isEnabled

    true: Activate screen capture function, false: Disable screen capture function


    ShopLive.setMixWithOthers

    When external audio is played, you can config the livestream audio.

    fun setMixWithOthers(isMixAudio: Boolean)
    

    parameter

    explanation

    isMixAudio

    true: Watch broadcast with external audio, false: Player pauses when external audio is played (default: true)


    ShopLive.setUtmSource

    You can track UTM Source. Data can be checked at Data Insights.

    fun setUtmSource(utmSource: String)
    

    parameter

    explanation

    utmSource

    It conveys where the inflow occurred.


    ShopLive.setUtmMedium

    You can track UTM Medium. Data can be checked at Data Insights.

    fun setUtmMedium(utmMedium: String)
    

    parameter

    explanation

    utmMedium

    It conveys how the inflow occurred. Google recommends setting the medium parameter to refer to the marketing method that led to the inflow. (ex. cpc, banner, email, blog, social etc.)


    ShopLive.setUtmCampaign

    You can track UTM Campaigns. Data can be checked at Data Insights.

    fun setUtmCampaign(utmCampaign: String)
    

    parameter

    explanation

    utmCampaign

    It tells you which advertising campaign the inflow occurred. It can be divided into Campaign Name, Campaign Term, and Campaign Content.


    ShopLive.setUtmContent

    You can track UTM Content. Data can be checked at Data Insights.

    fun setUtmContent(utmContent: String)
    

    parameter

    explanation

    utmContent

    It conveys what kind of content the inflow was caused by a posting/advertisement. It is mainly used as a subdivision of campaign parameters.


    ShopLive.addParameter

    You can add custom data before launching the player.

    fun addParameter(key: String, value: String)
    

    parameter

    explanation

    key

    Custom parameter key to apply additionally

    value

    Additional custom parameter value to apply

    ShopLive.removeParameter

    Before running the player, delete the custom data added with addParameter.

    fun removeParameter(key: String)
    

    parameter

    explanation

    key

    Parameter key to delete

    ShopLive.setNextActionOnHandleNavigation

    Set the next action of Shoplive Player when the user selects a link such as a product, notice, or banner.

    fun setNextActionOnHandleNavigation(type: ActionType)
    

    enumActionType

    parameter

    explanation

    PIP

    switch to PIP

    KEEP

    keep current status

    CLOSE

    close


    ShopLive.setEndpoint

    This is used when you need to utilize the Shoplive service from a specific landing page or URL, rather than the Web Landing page of the Shoplive Player. For instance, in cases where the Shoplive Landing page cannot be used due to security reasons, you can create a landing page on a specific domain.

    ※ The Web Landing page of the Shoplive Player can be implemented after consultation with Shoplive.

    fun setEndpoint(url: String)
    

    parameter

    explanation

    url

    Shoplive Player's Web Landing URL


    What's Next