Share & Deeplinking(iOS)

Set shared base URL

If your website integrates our Web component, we suggest setting the website link (without query) as the shared base URL. For instance, if the link for the website integrating our Web component is https://example.com, you could set https://example.com as the shared base URL. For instructions on setting the shared base URL, please refer to Customize share base URL.

Once the share URL is configured as https://example.com, the sample video share URL will be: https://example.com?fw_video={video_encoded_id}&fw_channel={channel_name}&fw_playlist={playlist_encoded_id}. Users can share the video by clicking the share button.

For instance, if you set the shared base URL as https://example.com, you must ensure that links beginning with https://example.com function as universal links. This way, the user clicking the shared URL will trigger your app (if installed) to open. Please consult the following docs for more details:

Open video player

When a user clicks the share link, your app (if installed) will be opened. Then you can get the the share link and use openVideoPlayer API to open the video player.

VideoFeedViewController.openVideoPlayer(with: sharedLink, config, self, true) { result in
    print("Open VideoPlayer result \(result)")
}

Manually construct the shared URL

For instance, you might want to open the video player directly, bypassing the need for users to click a share link outside the app. Instead, you could trigger the video player to open when users click a button within the app. In this case, you could manually construct the shared URL and use openVideoPlayer API to open the video player.

Open single content player

As illustrated in the following code snippets, you can launch the video player to present a single video or livestream.

let videoId = "encoded_video_id";
let channelName = "channel_name";
// openVideoPlayer API does not verify the shared base URL
// You could use https://fw.tv
// or a customized shared base URL(such as https://example.com)
let sharedLink = "https://fw.tv?fw_video=\(videoId)&fw_channel=\(channelName)";
VideoFeedViewController.openVideoPlayer(with: sharedLink, config, self, true) { result in
    print("Open VideoPlayer result \(result)")
}

Open playlist player

As illustrated in the following code snippets, you can launch the video player to present all videos/livestreams within a playlist. The specified video will be positioned first.

let videoId = "encoded_video_id";
let channelName = "channel_name";
let playlistId = "encoded_playlist_id";
// openVideoPlayer API does not verify the shared base URL
// You could use https://fw.tv
// or a customized shared base URL(such as https://example.com)
let sharedLink = "https://fw.tv?fw_video=\(videoId)&fw_channel=\(channelName)&fw_playlist=\(playlistId)";
VideoFeedViewController.openVideoPlayer(with: sharedLink, config, self, true) { result in
    print("Open VideoPlayer result \(result)")
}

Configuration for opening video player

Please consult Player configurations (iOS)

Customize the entire share URL

  1. Set FireworkVideoShareDelegate delegate:

FireworkVideoSDK.shareDelegate = <FireworkVideoShareDelegate delegate>
  1. Implement handleCustomizingShareURL(_:fromVideo:shareURLCompletionHandler:):

func handleCustomizingShareURL(
    _ shareURL: String?,
    fromVideo video: VideoDetails,
    shareURLCompletionHandler: @escaping ShareURLHandler
) {
    let originalUrl = shareURL
    let videoID = video.videoID
    let videoType = video.videoType
    let liveStreamStatus = video.liveStreamStatus


    let customizedShareUrl = "Your customized share URL"

    // Return the customized share URL using shareURLCompletionHandler.
    // You can also invoke shareURLCompletionHandler
    // after the completion of asynchronous operations.
    shareURLCompletionHandler(customizedShareUrl)
}

Last updated

Was this helpful?