Javascript SDK
๏ปฟ
The Javascript SDK is in beta. For access, please contact sales.
The HotMic Javascript SDK is primarily used to allow the following activities from inside your web application:
- Get a list of streams
- Get information about a particular stream
- Let a user join a particular stream, using the information your provide and without them having to log into HotMic.
๏ปฟ
You do need to contact our sales team to install the javascript application. This Javascript SDK is designed to run in a frontend application, to communicate with the HotMic backend.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.
- API Key and JWT Secret: Will be provided by HotMic.
- We recommend accessing streams via Chromium based browsers: namely Chrome or Edge
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:
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.ย
You can also generate JWT tokens online! This is good for test purposes while getting started, or to use the sample app. Here is one way to do it. We do not recommend using this method with any sensitive data.
Go to https://jwt.io/๏ปฟ and scroll down add a payload like the following into the "Payload" section. Paste your secret into the "Verify Signature" section. This screenshot shows how it looks:
And here is a sample payload that should work for your application:
Then copy the code from the "Encoded" section of this page, and use that in the sample app.
Streams are returned in reverse chronological order. You can fetch 1 or more streams from HotMic with the following filters:
- that are live, scheduled, and/or video-on-demand replays.
- userID: the userid you want to filter the streams by:
- Type: string
- Default: NULL (all possible streams)
- limit: The max number of streams to return
- Type: integer
- Example: 40
- Default: 30
- skip: The number of results to skip you want to not return in the results, typically used for pagination.
- Type: integer
- Example: 10
- Default: 0
๏ปฟ
๏ปฟ
Each stream has a URL associated with it, hosted by HotMic. Users can go to the URL after getting the JWT token and authenticating. Generally speaking, for most customers you would want to:
- Show 1 or more streams to the user
- If the user taps a stream to join it, then authenticate and create the JWT token.
- Send the user to the URL of the stream.
note: add exit redirect/url.
note: how to handle hosts differently (just redirect to broadcast page?)
While URLs for streams are hosted on HotMic, we can do some themeing or branding of the stream
To support following and unfollowing users from inside the HotMic experience, contact sales
To support tipping hosts and joining their streams for a price, you can implement integrate with your payment provider and system for tipping. Contact sales for more information.