API: Shortform

    API: Shortform


    Article summary

    Play Shortform Detail View

    With the ShopLiveShortform.play(context: Context, requestData: ShopLiveShortformCollectionData? = null), you can play the Shortform detail view of which playlist is associated with the ShopLiveShortformCollectionData.

    • You can play the related detail view by entering one or more property values of ShopLiveShortformCollectionData.

    • If ShopLiveShortformCollectionData is null, you can play the entire detail view.

    ShopLiveShortformCollectionData

    Property name

    Type

    Description

    shortsId

    String?

    Shortform unique identifier

    shortsCollectionId

    String?

    This is the global resource name assigned to Shortform for resource management. It is an internally used value in Shoplive.

    tags

    List?

    Value for related tag search

    tagSearchOperator

    ShopLiveShortformTagSearchOperator?

    Tag search options

    • OR : integrated search

    • AND : cross search

    brands

    List?

    Value for related brand search (searching both title and identifier)

    shuffle

    Boolean?

    Value for random playback (Default: false)

    referrer

    String?

    Value for tracking the path

    Shortform Detail View: All

    ShopLiveShortform.play(context)

    Shortform Detail View: Playback after clicking on the list

    ShopLiveShortform.play(context, ShopLiveShortformCollectionData().apply {
        shortsId = "{CLICKED_IN_LIST_SHORTS_ID}"
        shortsSrn = "{CLICKED_IN_LIST_SHORTS_SRN}"
    })

    Shortform Detail View: Playback after clicking on the related tag list

    ShopLiveShortform.play(context, ShopLiveShortformCollectionData().apply {
        shortsId = "{CLICKED_IN_LIST_SHORTS_ID}"
        shortsSrn = "{CLICKED_IN_LIST_SHORTS_SRN}"
        tags = "{CLICKED_IN_LIST_TAGS}"
        tagSearchOperator = "{CLICKED_IN_LIST_TAG_SEARCH_OPERATOR}"
    })

    Shortform Detail View: Playback after clicking on the related brand list

    ShopLiveShortform.play(context, ShopLiveShortformCollectionData().apply {
        shortsId = "{CLICKED_IN_LIST_SHORTS_ID}"
        shortsSrn = "{CLICKED_IN_LIST_SHORTS_SRN}"
        brands = "{CLICKED_IN_LIST_BRANDS}"
    })

    Shortform Detail view: Playback of related tag

    ShopLiveShortform.play(context, ShopLiveShortformCollectionData().apply {
        tags = "{YOUR_TAGS}"
        tagSearchOperator = "{YOUR_SEARCH_OPERATOR}"
    })

    Shortform Detail View: Playback of related brand

    ShopLiveShortform.play(context, ShopLiveShortformCollectionData().apply {
        brands = "{YOUR_BRANDS}"
    })

    Configure Intent for short-form content in detail

    With the ShopLiveShortform.intent(context: Context, requestData: ShopLiveShortformCollectionData? = null), you can use an intent to play the Shortform detailed view of which playlist is associated with ShopLiveShortformCollectionData.

    • You can play the related detail view by entering one or more of the field values of ShopLiveShortformCollectionData.

    • If ShopLiveShortformCollectionData is null, you can play the entire detail view.

    ShopLiveShortformCollectionData

    Property name

    Type

    Description

    shortsId

    String?

    Shortform unique identifier

    shortsCollectionId

    String?

    This is the global resource name assigned to Shortform for resource management. It is an internally used value in Shoplive.

    tags

    List?

    Value for related tag search

    tagSearchOperator

    ShopLiveShortformTagSearchOperator?

    Tag search options

    • OR: integrated search

    • AND: cross search

    brands

    List?

    Value for related brand search (searching both title and identifier)

    shuffle

    Boolean?

    Value for random playback (Default: false)

    referrer

    String?

    Value for tracking the path

    Shortform Detail View: Playback after clicking on the list

    val intent = ShopLiveShortform.intent(context, ShopLiveShortformCollectionData().apply {
        shortsId = "{CLICKED_IN_LIST_SHORTS_ID}"
        shortsSrn = "{CLICKED_IN_LIST_SHORTS_SRN}"
    })
    startActivity(intent)

    Shortform Detail View: Playback after clicking on the related tag list

    val intent = ShopLiveShortform.intent(context, ShopLiveShortformCollectionData().apply {
        shortsId = "{CLICKED_IN_LIST_SHORTS_ID}"
        shortsSrn = "{CLICKED_IN_LIST_SHORTS_SRN}"
        tags = "{CLICKED_IN_LIST_TAGS}"
        tagSearchOperator = "{CLICKED_IN_LIST_TAG_SEARCH_OPERATOR}"
    })
    startActivity(intent)

    Shortform Detail View: Playback after clicking on the related brand list

    val intent = ShopLiveShortform.intent(context, ShopLiveShortformCollectionData().apply {
        shortsId = "{CLICKED_IN_LIST_SHORTS_ID}"
        shortsSrn = "{CLICKED_IN_LIST_SHORTS_SRN}"
        brands = "{CLICKED_IN_LIST_BRANDS}"
    })
    startActivity(intent)

    Shortform Detail View: Playback of related tag

    val intent = ShopLiveShortform.intent(context, ShopLiveShortformCollectionData().apply {
        tags = "{YOUR_TAGS}"
        tagSearchOperator = "{YOUR_SEARCH_OPERATOR}"
    })
    startActivity(intent)

    Shortform Detail View:  Playback of related brand

    val intent = ShopLiveShortform.intent(context, ShopLiveShortformCollectionData().apply {
        brands = "{YOUR_BRANDS}"
    })
    startActivity(intent)

    Close detail view

    Close Shortform detail view.

    ShopLiveShortform.close()


    Hide Button on Detail View

    Configure whether to show buttons on the Shortform detail view screen.

    ShopLiveShortformVisibleFullTypeData

    Property name

    Type

    Description

    isLikeButtonVisible

    Boolean

    You can hide the like button. (Default: true)

    isCommentButtonVisible

    Boolean

    You can hide the comment button. (Default: true)

    isShareButtonVisible

    Boolean

    You can hide the share button. (Default: true)

    isBookmarkVisible

    Boolean

    You can hide the bookmark button. (Default: true)

    ShopLiveShortform.setVisibleFullTypeViews(ShopLiveShortformVisibleFullTypeData().apply {
        isLikeButtonVisible = true
        isCommentButtonVisible = true
        isShareButtonVisible = true
        isBookmarkVisible = true
    })


    Play Shortform Preview

    With the ShopLiveShortform.showPreview(activity: Activity, data: ShopLiveShortformRelatedData), you can play the Shortform  preview of which playlist is associated with the ShopLiveShortformRelatedData.

    • You can play the related preview by entering one or more of the property values of ShopLiveShortformRelatedData.

    ShopLiveShortformRelatedData

    Property name

    Type

    Description

    productId

    Long?

    Unique ID of the product, automatically issued upon product registration

    sku

    String?

    Unique SKU information of the product

    name

    String?

    Product name

    url

    String?

    URL of the product's detailed page

    tags

    List?

    Value for related tag search

    tagSearchOperator

    ShopLiveShortformTagSearchOperator?

    Tag search options

    • OR: integrated search

    • AND: cross search

    brands

    List?

    Value for related brand search (searching both title and identifier)

    shuffle

    Boolean

    Value for random playback (Default: false)

    referrer

    String?

    Value for tracking the path

    ShopLiveShortformPreviewData

    Property name

    Type

    Description

    width

    Int?  (px)

    The width of shortform preview (Default: 180dp)

    height

    Int? (px)

    The height of shortform preview (Default: 180dp)

    marginTop

    Int? (px)

    The marginTop of shortform preview (Default: 16dp)

    marginBottom

    Int? (px)

    The marginBottom of shortform preview (Default: 16dp)

    marginLeft

    Int? (px)

    The marginLeft of shortform preview (Default: 16dp)

    marginRight

    Int? (px)

    The marginRight of shortform preview (Default: 16dp)

    radius

    Int? (px)

    The radius of shortform preview (Default: 10dp)

    isMuted

    Bool?

    This is used to set the mute option for shortform preview. (Default: false)

    position

    ShopLivePreviewPositionConfig?

    This is used to set the initial display position for shortform preview. (Default: ShopLivePreviewPositionConfig.BOTTOM_RIGHT)

    maxCount

    Int?

    You use this to set the number of videos to play in the preview of a shortform.

    useCloseButton

    Boolean?

    This is used to enable or disable the x button in the top left corner of the short-form preview. (Default: true)

    useCustomAction

    Boolean

    This is used when you want to define the click events of the shortform preview manually. (Default: false)

    enableSwipeOut

    Boolean?

    This is used to allow or disallow closing the shortform preview by swiping it off the screen. (Default: true)

    conClickListener

    View.OnClickListener?

    You can receive events triggered when the shortform preview is clicked.

    By setting useCustomAction to true, you can define the behavior and manually handle the preview’s click events.

    Shortform Preview: ProductId based

    ShopLiveShortform.showPreview(activity: Activity, ShopLiveShortformRelatedData().apply {
        productId = "{PRODUCT_ID}"
    })

    Shortform Preview: SKU based

    ShopLiveShortform.showPreview(activity: Activity, ShopLiveShortformRelatedData().apply {
        sku = "{PRODUCT_SKU}"
    })

    Shortform Preview: Tag based

    ShopLiveShortform.showPreview(activity: Activity, ShopLiveShortformRelatedData().apply {
        tags = "{YOUR_TAGS}"
        tagSearchOperator = "{YOUR_SEARCH_OPERATOR}"
    })

    Shortform Preview: Brand based

    ShopLiveShortform.showPreview(activity: Activity, ShopLiveShortformRelatedData().apply {
        brands = "{YOUR_BRANDS}"
    })

    ShopLiveShortform.hidePreview

    Close the currently running Shortform preview.

    ShopLiveShortform.hidePreview()


    Create a list of shortform contents using a specific shortform ID

    Coroutine

    With the ShopLiveShortform.play(context: Context, shortformIdsData: ShopLiveShortformIdsData, moreSuspendListener: ShopLiveShortformMoreSuspendListener), you can create a playlist with the shortformId received through the short-form API and play them in order.

    ShopLiveShortformIdsData

    Property name

    Type

    Description

    ids

    List<String>?

    A list of shortform IDs (up to 30 items)

    currentId

    String?

    The item in the list that can currently be focused on

    referrer

    String?

    A value to track the referral path

    ShopLiveShortformMoreSuspendListener

    Property name

    Type

    Description

    onMore

    ShopLiveShortformIdsMoreData?

    A function to compose a paginated list using Coroutines

    ShopLiveShortformIdsMoreData

    Property name

    Type

    Description

    ids

    List<String>?

    A list of shortform IDs (up to 30 items)

    hasMore

    Boolean?

    Pagination availability

    ShopLiveShortform.play(context, ShopLiveShortformIdsData().apply {
        ids = "{YOUR_IDS}"
        currentId = "{YOUR_CURRENT_ID}"
    }, ShopLiveShortformMoreSuspendListener {
        val moreResponse =
            kotlin.runCatching {
                "{YOUR_MORE_API_RESPONSE}"
            }.getOrNull() ?: return@ShopLiveShortformMoreSuspendListener null
        val ids = moreResponse.shortsList?.mapNotNull { it.shortsId } ?: emptyList()
        val hasMore = moreResponse.hasMore
        return@ShopLiveShortformMoreSuspendListener ShopLiveShortformIdsMoreData().apply {
            this.ids = ids
            this.hasMore = hasMore
        }
    })

    Future

    With the ShopLiveShortform.play(context: Context, shortformIdsData: ShopLiveShortformIdsData, moreFutureListener: ShopLiveShortformMoreFutureListener), you can create a playlist with the shortformId received through the short-form API and play them in order.

    ShopLiveShortformIdsData

    Property name

    Type

    Description

    ids

    List<String>?

    A list of shortform IDs (up to 30 items)

    currentId

    String?

    The item in the list that can currently be focused on

    referrer

    String?

    A value to track the referral path

    ShopLiveShortformMoreFutureListener

    Property name

    Type

    Description

    onMore

    Future<ShopLiveShortformIdsMoreData?>

    A function to compose a paginated list using Futures

    ShopLiveShortformIdsMoreData

    Property name

    Type

    Description

    ids

    List<String>?

    A list of shortform IDs (up to 30 items)

    hasMore

    Boolean?

    Pagination availability


    API: Invoke detailed result values

    With the ShopLiveShortform.get(context: Context, collectionData: ShopLiveShortformCollectionData? = null, callback: ShopLiveShortformCollectionListener), you can check the results of the collection in callback format.

    • You can pre-process data in a reusable RecyclerView .

    ShopLiveShortformCollectionData

    Property name

    Type

    Description

    shortsId

    String?

    Shortform unique identifier

    shortsCollectionId

    String?

    This is the global resource name assigned to Shortform for resource management. It is an internally used value in Shoplive.

    tags

    List?

    Value for related tag search

    tagSearchOperator

    ShopLiveShortformTagSearchOperator?

    Tag search options

    • OR: integrated search

    • AND: cross search

    brands

    List?

    Value for related brand search (searching both title and identifier)

    shuffle

    Boolean?

    Value for random playback (Default: false)

    referrer

    String?

    Value for tracking the path

    ShopLiveShortformCollectionListener

    Function name

    Description

    onData(response: ShopLiveShortformCollectionResponse)

    When ShopLiveShortform.get is successful, you can receive and handle the response.

    onError(e: Exception)

    When ShopLiveShortform.get fails, you can handle the exception.


    val data = ShopLiveShortformCollectionData()
    ShopLiveShortform.get(context, data, object : ShopLiveShortformCollectionListener {
        // In background thread
        override fun onData(response: ShopLiveShortformCollectionResponse) {
            // Do something
        }
        override fun onError(e: Exception) {
            // Handle error
        }
    })

    API for Web & SDK connection in a hybrid environment

    With the ShopLiveShortform.connectBridgeInterface(activity: Activity, webView: WebView), uou can connect Web and SDK in a hybrid environment.

    ShopLiveShortform.connectBridgeInterface(activity, webView)

    With the ShopLiveShortform.receiveBridgeInterface(webView: WebView), you can exchange messages between Web and SDK in a hybrid environment.

    ShopLiveShortform.receiveBridgeInterface(webView)

    With the ShopLiveShortform.updateVisitedHistory(view: WebView?, url: String?, isReload: Boolean), you can automatically remove the preview when navigating to a web page.

    webView.webViewClient = object : WebViewClient() {
        ...
        // Required
        override fun doUpdateVisitedHistory(view: WebView?, url: String?, isReload: Boolean) {
            super.doUpdateVisitedHistory(view, url, isReload)
            ShopLiveShortform.updateVisitedHistory(view, url, isReload)
        }
        ...
    }


    What's Next