Skip to content

Usage Instructions

All the steps in this page are mandatory for successful integration of the Adori iOS SDK.

1. Steps

1.1 Import the dependencies

1
2
import AdoriPlayerUI
import AdoriAPIService

1.2 Conform to AdoriPlayerDelegate

1
2
3
class ViewController: UIViewController, AdoriPlayerDelegate {

}

1.3 Setup Adori Player SDK configuration

  • Call setupSDK with the brand color and a secondary color
1
2
3
4
5
6
AdoriPlayer.shared.setupSDK(
        brandColor: "#808080",
        secondaryColor: "#FFFFFF",
        requiresPlayerView: *true*,
        parent: *self*
)
  • Setup the conformance to the player delegate
1
AdoriPlayer.shared.playerDelegate = self
  • If you have a login setup, call the setUserId

If this is not set and the user clicks on an interaction, for eg. a like button etc, the user will be shown a snack bar with a message to login, handle in the showLogin() function when that happens

1
AdoriPlayer.shared.setUserId(userId: "user_XYZ")
  • When an episode is clicked, call the playEpisode with the below details
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
AdoriPlayer.shared.playEpisode(
        uid: "IRATvhWXzWyt3kT4",
        name: "The Candid Frame podcast: An interactive snippet",
        audioUrl: "https://static.adorilabs.com/audiotracks/v1/1117-IRATvhWXzWyt3kT4_adorified.mp3",
        imageUrl: "https://cdn.images.adorilabs.com/v1/5ea65178-e28e-4eeb-a0e0-8d8f6fcadc4f.jpeg",
        showName: "Adori Demos: Interactive Podcast Snippets",
        showImageThumbnailUrl: "https://cdn.images.adorilabs.com/v1/7b76e5b6-98c1-44a9-a02c-89da2f607893_th.jpeg",
        durationMillis: 119985,
        isLiked: *false*,
        isPlaylisted: *false*,
        startTime: 0,
        stopTime: -1,
        isBookmarkClip: *false*,
        parentVC: *self*
)

1.4 Listen to Delegate callbacks for Tag Interaction

  • Apart from the Player based delegates, you can listen to interactions on the tag itself like the 'Save Tag' and 'Share Tag' events.
1
func tagInteracted(interactedObject: InteractedTagObject)

The InteractedTagObject looks like below

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
public struct InteractedTagObject: Codable {

    // Is the interaction save / share
    public let interactionEvent: InteractionEvent

    // Experience ID of the Tag
    public let experienceId: String

    // Episode ID of the Tag
    public let episodeId: String

    // Offset of the tag from the beginning of the audio
    public let offsetMillis: TimeInterval

    // The TagObject
    public let tagObject: TagObject

}

The above method is returned when the user interacts with the save / share button on the tag. The InteractedTagObject looks like below with all the associated information

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
public struct TagObject: Codable {
    /// The unique id for a particular tag.
    public let id: String
    /// The string specifying the caption of the tag.
    public let caption: String?
    /// The string that specifies a longer text content that needs to be displayed with the tag.
    public let noteText: String?
    /// The call to action url for the tag.
    public let url: String?
    /// The action that can be performed on the tag.
    public let actions: Actions
    /// The `Image` object that has all the specifications of the tag background image.
    public let backgroundImage: Image?
    /// The `Image` object that has all the specifications of the tag background video.
    public let backgroundVideo: Video?
    /// The `TagLocationInfo` object has all the specifications with respect to the location CTA.
    public let location: TagLocationInfo?
    /// The `TagInfoContact` object has all the specifications with respect to the call CTA.
    public let contact: TagInfoContact?
}
The client application will use the InteractionEvent information to determine if the tag save or share was clicked. Based on this information, the client app will save the data or bring up an appropriate share sheet

Next Steps