API - Shortform

    API - Shortform


    Article summary

    Play - Shortform Detail View

    ShopLiveShortform.play(requestData : ShopLiveShortformCollectionData?)

    Play the Shortform detail view. (Plays the playlist associated with the 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

      field

      type

      description

      shortsId

      String?

      Shortform unique identifier

      shortsSrn

      String?

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

      tags

      [String]?

      Value for related tag search

      tagSearchOperator

      ShopLiveTagSearchOperator?

      Tag search options

      • OR : integrated search

      • AND : cross search

      brands

      [String]?

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

      shuffle

      Bool? // default = false

      Value for random playback (Default: false)

      referrer

      String?

      Value for tracking the path

    Shortform Detail View - Entire

    let requestCollectionData = ShopLiveShortformCollectionData()
    ShopLiveShortform.play(requestData: requestCollectionData)
    

    Shortform Detail View - Playback after clicking on the list

    let requestCollectionData = ShopLiveShortformCollectionData()
    requestCollectionData.shortsId = "{YOUR_SHORTS_ID}"
    requestCollectionData.shortsSrn = "{YOUR_SHORTS_SRN}"
    ShopLiveShortform.play(requestData: requestCollectionData)
    

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

    let requestCollectionData = ShopLiveShortformCollectionData()
    requestCollectionData.shortsId = "{YOUR_SHORTS_ID}"
    requestCollectionData.shortsSrn = "{YOUR_SHORTS_SRN}"
    requestCollectionData.tags = ["testTag1","testTag2"]
    requestCollectionData.tagSearchOperator = .OR
    ShopLiveShortform.play(requestData: requestCollectionData)
    

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

    let requestCollectionData = ShopLiveShortformCollectionData()
    requestCollectionData.shortsId = "{YOUR_SHORTS_ID}"
    requestCollectionData.shortsSrn = "{YOUR_SHORTS_SRN}"
    requestCollectionData.brands = ["brand1","brand2"]
    ShopLiveShortform.play(requestData: requestCollectionData)
    

    Shortform Detail View - Playback of related tag

    let requestCollectionData = ShopLiveShortformCollectionData()
    requestCollectionData.tags = ["testTag1","testTag2"]
    requestCollectionData.tagSearchOperator = .OR
    ShopLiveShortform.play(requestData: requestCollectionData)
    

    Shortform Detail View - Playback of related brand

    let requestCollectionData = ShopLiveShortformCollectionData()
    requestCollectionData.brands = ["brand1","brand2"]
    ShopLiveShortform.play(requestData: requestCollectionData)
    

    Play - Shortform Preview

    ShopLiveShortform.showPreview(requestData: ShopLiveShortformPreviewData?)

    Play the Shortform preview. (Playlist associated with ShopLiveShortformRelatedData)

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

    • ShopLiveShortformRelatedData

      field

      type

      description

      productId

      String?

      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

      [String]?

      Value for related tag search

      tagSearchOperator

      ShopLiveTagSearchOperator?

      Tag search options

      • OR : integrated search

      • AND : cross search

      brands

      [String]?

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

      shuffle

      Boolean? //default = false

      Value for random playback (Default: false)

      referrer

      String?

      Value for tracking the path

    • ShopLiveShortformPreviewData

      field

      type

      Description

      Default Value

      previewScale

      CGFloat?

      Sets the size of the short-form preview.

      N/A

      previewRadius

      CGFloat?

      Sets the corner radius of the short-form preview. (Default: 10)

      10

      previewPosition

      ShopLiveShortform.PreviewPosition?

      Specifies the initial display position of the short-form preview. (Default: BottomRight)

      BottomRight

      previewEdgeInset

      UIEdgeInset?

      Sets the padding of the preview in the short-form preview. (top, left, right, bottom) (Default: 16pt)

      (16, 16, 16, 16)

      previewFloatingOffset

      UIEdgeInset?

      Sets the area where the preview can move in the short-form preview. (Default: 0pt)

      (0, 0, 0, 0)

      isMuted

      Bool?

      Sets whether to mute the short-form preview. (Default: false)

      FALSE

      isEnabledVolumeKey

      Bool

      A feature has been added to the short-form preview that allow it to be unmuted based on the device’s volume  (default: false)

      FALSE

      maxCount

      Int?

      Sets the number of videos to be played in the preview of the short-form.

      N/A

      useCloseButton

      Bool?

      Sets whether to use the x button in the top left corner of the short-form preview. (Default: true)

      TRUE

      useCustomAction

      Bool

      Use this when you want to directly define the click event of the short-form preview. (Default: false)

      FALSE

      enableSwipeOut

      Bool?

      Sets whether to allow the short-form preview to be closed by swiping it off the screen. (Default: true)

      TRUE

      clickEventCallBack

      ( () → () ) ?

      You can receive an event that occurs when the short-form preview is clicked.

      By setting useCustomAction = true and defining the action in this event, you can directly define the click event of the preview.

      N/A

    Shortform Preview - ProductId Based

    let requestRelatedData = ShopLiveShortformRelatedData()
    requestRelatedData.productId = "{YOUR_PRODUCT_ID}"
    ShopLiveShortform.showPreview(requestData: requestRelatedData)
    

    Shortform Preview - SKU Based

    let requestRelatedData = ShopLiveShortformRelatedData()
    requestRelatedData.sku = "{YOUR_PRODUCT_SKU}"
    ShopLiveShortform.showPreview(requestData: requestRelatedData)
    

    Shortform Preview - Tag Based

    let requestRelatedData = ShopLiveShortformRelatedData()
    requestRelatedData.tags = ["tag1","tag2"]
    requestRelatedData.tagSearchOperator = .OR
    ShopLiveShortform.showPreview(requestData: requestRelatedData)
    

    Shortform Preview - Brand Based

    let requestRelatedData = ShopLiveShortformRelatedData()
    requestRelatedData.brands = ["brand1","brand2"]
    ShopLiveShortform.showPreview(requestData: requestRelatedData)
    

    Shortform Detail / Preview Close

    ShopLiveShortform.close()

    Close the currently running Shortform detail view or preview.

    ShopLiveShortform.close()
    

    Hide Button on Detail View

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

    By including one or more field values of ShopLiveShortformVisibleFullTypeData, you can configure the visibility of related buttons.

    • ShopLiveShortfromVisibleFullTypeData

      field

      type

      description

      Default Value

      isLikeButtonVisible

      Bool

      You can hide the like button.

      true

      isCommentButtonVisible

      Bool

      You can hide the comment button.

      true

      isShareButtonVisible

      Bool

      You can hide the share button.

      true

      isBookmarkVisible

      Bool

      You can hide the bookmark button.

      true

     var option = ShopLiveShortformVisibleFullTypeData()
     option.isLikeButtonVisible = true
     option.isCommentButtonVisible = true
     option.isShareButtonVisible = true
     option.isBookMarkVisible = true
     ShopLiveShortform.setVisibileFullTypeViews(options: option)
    

    Detailed shortform list - composed with a specific shortform ID

    ShopLiveShortform.play(shortformIdsData: ShopLiveShortformIdsData, delegate : ShortsCollectionViewDataSourceRequestDelegate)

    Compose a playlist using the shortformId received via the shortform API and play them in order.

    • ShopLiveShortformIdsData

      field

      type

      description

      ids

      [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

    • ShortsCollectionViewDataSourcRequestDelegate

      protocol ShortsCollectionViewDataSourceDelegate : AnyObject { 
           func onShortformListPagination(completion : @escaping((ShopLiveShortformIdsMoreData?,Error?) -> ()))
           func onShortformListPaginationError(error : Error)
      }

      The onShortformListPagination(completion:_) function is called when there are no more shortform IDs to display. In such cases, you can continue to supply shortform IDs continuously by using completion(ShopLiveShortformIdsMoreData).

    • ShopLiveShortformIdsMoreData

      field

      type

      description

      ids

      [String]?

      A list of shortform IDs (up to 30 items)

      hasMore

      Bool?

      Pagination availability

    Shortform Detail - Keep Video Ratio

    ShopLiveShortform.setResizeMode(options : ShopLiveResizeMode)

    You can maintain the aspect ratio of the video. (Default: .CENTER_CROP)

    ShopLiveShortform.setResizeModel(option : ShopLiveResizeMode)

    Connect API for a hybrid environment

    ShopLiveShortform.BridgeInterface.connect(_ webview: WKWebView)

    Connects Web and SDK in a hybrid environment.

    ShopLiveShortform.BridgeInterface.connect(webview)
    

    ShopLiveShortform.Delegate.setDelegate(_ handler: ShopLiveShortformReceiveHandlerDelegate?)

    Exchanges messages between Web and SDK in a hybrid environment.

    ShopLiveShortform.ShortsReceiveInterface.setHandler(self)
    
    class CustomerViewController : UIViewController,  ShopLiveShortformReceiveHandlerDelegate {
        func handleShare(shareUrl: String) {
            // Do something
        }
        func onError(error: Error) {
            // Do something
        }
        
        func onEvent(command: String, payload: String?) {
            // Do something
        }
        
        func onDidDisAppear() {
            // Do something
        }
        
        func onDidAppear() {
            // Do something
        }
    
        func handleProductItem(shortsId : String, shortsSrn : String, product : ProductData) { 
           // Do something
        }
    
        func handleProductBanner(shortsId : String, shortsSrn : String, scheme : String, shortsDetail : ShortsDetailData) { 
           // Do something
        }
    }
    


    What's Next