Previous: Adori iOS SDK: Sample App
Advanced Usage Instructions
You can use the following instructions to add an interactive tag view controller to your own tag view without the embedded player controller
โ
Steps
1. Add imports
1.1 Import the dependencies
1 2 3 | import AdoriPlayerUI import AdoriAPIService import AdoriTagsUI |
1.2 Conform to AdoriTagsUIViewControllerUIDelegate
1 2 3 | class ViewController: UIViewController, AdoriTagsUIViewControllerUIDelegate { } |
2. Instantiate AdoriPlayer
1 | let player = AudioPlayerWrapper.shared |
3. Setup Adori Player SDK configuration
Call setupSDK with the brand color and a secondary color and make sure
requiresplayerview to false
1 2 3 4 5 6 | AdoriPlayer.shared.setupSDK( brandColor: "#808080", secondaryColor: "#FFFFFF", requiresPlayerView: *false*, parent: *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* ) |
Add the AdoriTagsUIViewController into your own tagView
1 2 3 4 5 6 | let adoriTagsViewController = AdoriTagsUIViewController() adoriTagsViewController.UIDelegate = self adoriTagsViewController.playerDelegate = player adoriTagsViewController.view.frame = self.tagView.bounds self.tagView.addSubview(adoriTagsViewController.view) self.addChild(adoriTagsViewController) |
Next Up: Adori iOS SDK FAQs