Getting started with Millicast on Android
Dolby Millicast delivers broadcast quality live streaming at sub-second latency, enabling interactivity and fan engagement. Using the THEOplayer Millicast integration, you can play your Millicast streams directly through THEOplayer.
Usage
- Follow our Getting Started guide to set up THEOplayer in your Android app.
- Add the
integration-millicast
dependency to your module'sbuild.gradle
. - Add the
MillicastIntegration
to the player. - Add a
MillicastSource
to your player's source.
Add the integration-millicast
dependency
Add the Millicast integration along with the Millicast SDK
to your module build.gradle
file, as demonstrated below:
dependencies {
// ...
implementation 'com.theoplayer.theoplayer-sdk-android:core:+'
implementation 'com.theoplayer.theoplayer-sdk-android:integration-millicast:+'
implementation "com.millicast:millicast-sdk-android:2.0.0"
// ...
}
Add the Millicast integration to the player
Create and add the MillicastIntegration
to your THEOplayerView
:
val millicastIntegration = MillicastIntegrationFactory.createMillicastIntegration()
theoplayerView.player.addIntegration(millicastIntegration)
Add a MillicastSource
After setting up a THEOplayerView
in your app's activity, set its source to a SourceDescription
containing a MillicastSource
.
You'll need a Millicast account ID and stream name to identify your Millicast stream:
import com.theoplayer.android.api.millicast.MillicastSource
theoplayerView.player.source = SourceDescription.Builder(
MillicastSource(
src = "multiview",
streamAccountId = "k9Mwad",
apiUrl = "https://director.millicast.com/api/director/subscribe",
subscriberToken = "<token>" // This is only required for subscribing to secure streams and should be omitted otherwise.
)
).build()
Add configuration
Optionally, you can provide additional configuration to the source, specific for working with Millicast streams.
To configure these settings, add an Option
object as the connectOptions
parameter of the source object
and specify the options.
In the example below, the configuration is used to disable any audio from the Millicast stream. For an exhaustive list of these options, visit the documentation.
import com.millicast.subscribers.Option
import com.theoplayer.android.api.millicast.MillicastSource
theoplayerView.player.source = SourceDescription.Builder(
MillicastSource(
// ...
connectOptions = Option(
disableAudio = true
)
)
).build()
Background playback
Currently there is a known issue where after an indeterminate amount of time background playback of Millicast sources can stop playing unexpectedly. This issue is being investigated and will be fixed in an upcoming release.
In order to play Millicast sources in the background, ensure you've configured allowing background playback using the setAllowBackgroundPlayback API on the player.