HotMic offers an iOS SDK so you can let users inside your application watch your streams. This allows you to drive users to your own application, to retain control over your users, unlike in Twitch and Facebook,
To learn more, we recommend looking at our Sample App, which is the fastest way to see the iOS SDK in action inside a sample application.
Then, we recommend reviewing our SDK Installation Guide, found here: iOS SDK Installation Guide
HotMic offers a sample app to see how to use our iOS SDK in your application. Here is a step-by-step guide to downloading and running the HotMic SDK sample applications for iOS.
For security, when using the SDK your app controls authentication with a JWT Token, which you pass to HotMic.
JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. - jwt.io
You will receive an API Secret from HotMic, which you will use to create the token. The token will be used to authenticate the user, as well as provide information such as their name, an avatar, a unique ID, or another information which is needed by the SDK.
This is the expected format of the JWT token:
Note, the user_id field should be consistent for each invocation of the SDK for that particular user.
Here are instructions on how to install the iOS SDK. If you ever have issues installing the iOS SDK, please contact our team.
The name of our SDK is HotMicMediaPlayer. HotMicMediaPlayer allows you to integrate the HotMic player experience into your app. Use this framework to create a HMPlayerViewController for a specific stream and present it full screen.
Accessibility support including Dynamic Type, VoiceOver, etc
When integrating HotMicMediaPlayer into your app, you must disclose the data it and its dependencies collect on the App Store:
HotMicMediaPlayer has the following dependencies:
If your team is already using 1 or more of these dependencies, please contact us so we can ensure to get you the right version of the HotMicMediaPlayer SDK that matches your dependencies.
Add the following to your Podfile, then run pod repo update and then pod install
Add the following keys to your target’s Info tab:
Add the following capabilities to your app’s target:
HotMic supports two types of in-app purchases in the player experience: tip the host and join the stream. You can support these in your app as well. You will need to configure these in App Store Connect, then be sure to submit them to Apple for review alongside your app update.
You will need an API key for your app to use the HotMic service. You will also need to create an authorization token. HotMic will provide you with the key and information on how to create the token in the appropriate format.
Initialize HMMediaPlayer with your API key and authorization token. This must be done before any other functions are called in HMMediaPlayer, so we recommend performing initialization in your AppDelegate’s didFinishLaunchingWithOptions. If needed, it can be called again later, for example if the token changes.
A UUID provided by HotMic.
Use any JWT library to create a token. Format is as follows:
You can fetch streams from HotMic that are live, scheduled, and/or video-on-demand replays. You can optionally choose to get streams created by a specific user. Pagination is supported via optional limit and skip parameters.
Initialize a HMPlayerViewController and present it:
Setting the modalPresentationStyle to a value other than fullScreen is not allowed.
The player view controller is presented in portrait mode, then after presentation it will support rotating to landscape. Note that the player may force rotate to portrait in the experience, for example, if a tall sheet needs to be presented.
To support returning to the full-screen player experience from PiP, call HMPlayerViewController’s restorePiPView(:) function and then present the player view controller full screen:
To be informed when the user taps an ad in the stream, implement the following HMPlayerViewControllerDelegate function:
To support following and unfollowing users from inside the HotMic experience, you can implement the HMMediaPlayerUserProfileDelegate protocol. If you do not implement this delegate, the follow/unfollow buttons will not be shown.
When a user profile is shown, the following function is called to get the “is following” state for the currently logged in user. Provide a success result with true if the logged in user is following the provided user, false if they are not following, or nil if follow/unfollow is not available for the provided user. Provide a failure result with an Error if one occurred.
When the user taps the follow or unfollow button, the following function is called allowing you to record the new following state. Provide an Error to the completion handler if one occurs.
To support tipping hosts and joining their streams for a price, you can implement the HMMediaPlayerInAppPurchaseDelegate protocol and integrate it with your StoreKit in-app purchase code. If you do not implement this delegate, users cannot tip hosts, but can still join the host for free.
When the user opens the tip sheet, the following function will be called to get the SKProducts available to purchase for a host ID. Your app should fetch the products that are applicable to this host from the App Store.
When the user wishes to purchase a tip, the following function will be called. Your app should initiate the in-app purchase process. If the purchase is successful, your app should then submit the tip purchase information including the App Store receipt via HMMediaPlayer’s submitTipPurchase function. HotMic will verify this purchase is legitimate and record the tip if validated. Be sure to provide an error if one occurs in this process, such as if the device cannot make payments, a purchase is already in progress, the transaction was canceled, the transaction failed, failed to get transaction info, no purchase info was found, failed to verify, or failed to process. The completion handler allows you to specify if you want this error’s localizedDescription to be shown to the user and if a button should be provided to retry submitting their purchase information if that request fails. We strongly recommend persisting the purchase information on the device and avoid marking the SKPaymentTransaction finished until the purchase has been successfully submitted, as this allows you to retry submitting the information when StoreKit informs you there is a not-yet-finished purchased transaction.
When the user wishes to retry submitting their purchase information, the following function will be called. Your app should look up the purchase information with the provided product identifier and submit it via HMMediaPlayer’s submitTipPurchase function.
To support join stream in-app purchases, very similar functions as those for tips are available and should be used in the same way.
If you reach out to us we would be happy to provide you with more information and example code from our in-app purchase manager that will allow you to implement this the same way we did.
To be notified of analytics events as they occur throughout the experience, you can implement the HMMediaPlayerAnalyticsEventObserving protocol. Documentation for event names and info keys and values is not yet available.