# Share & Deeplinking(iOS)

### Set shared base URL <a href="#set-shared-base-url" id="set-shared-base-url"></a>

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](https://docs.firework.com/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/customization-ios/video-player#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.

<figure><img src="/files/cwPksoePGW0DwUXsuljq" alt="" width="188"><figcaption></figcaption></figure>

### Enable the share link to launch the app <a href="#enable-the-share-link-to-launch-the-app" id="enable-the-share-link-to-launch-the-app"></a>

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:

1. <https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app>

### 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.

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

#### Configuration for opening video player <a href="#configuration-for-opening-video-player" id="configuration-for-opening-video-player"></a>

Please consult [Player configurations (iOS)](/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/customization-ios/player-configurations-ios.md)

### Customize the entire share URL

1. Set `FireworkVideoShareDelegate` delegate:

```swift
FireworkVideoSDK.shareDelegate = <FireworkVideoShareDelegate delegate>
```

2. Implement `handleCustomizingShareURL(_:fromVideo:shareURLCompletionHandler:)`:

```swift
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)
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firework.com/firework-for-developers/ios-sdk/integration-guide-for-ios-sdk/share-and-deeplinking-ios.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
