diff --git a/theoplayer/how-to-guides/android/media3/getting-started.mdx b/theoplayer/how-to-guides/android/media3/getting-started.mdx index 32067c1a64a..6031c4ee6aa 100644 --- a/theoplayer/how-to-guides/android/media3/getting-started.mdx +++ b/theoplayer/how-to-guides/android/media3/getting-started.mdx @@ -16,39 +16,6 @@ Note that the integration is still under active development, see [the Known limi ### Add the Media3 integration dependency -Given that the Media3 integration is under active development, it is currently still published to our `snapshots` repository, so add the THEOplayer `snapshots` Maven repository in your **top-level** (project) `settings.gradle.kts` file. - - - - - ```groovy - dependencyResolutionManagement { - repositories { - google() - mavenCentral() - maven { url "https://maven.theoplayer.com/releases" } - // highlight-next-line - maven { url "https://maven.theoplayer.com/snapshots" } - } - } - ``` - - - ```kotlin - dependencyResolutionManagement { - repositories { - google() - mavenCentral() - maven { url = uri("https://maven.theoplayer.com/releases") } - // highlight-next-line - maven { url = uri("https://maven.theoplayer.com/snapshots") } - } - } - ``` - - - - Add the Media3 integration as a dependency in your module-level `build.gradle` file: @@ -78,10 +45,22 @@ Add the Media3 integration as a dependency in your module-level `build.gradle` f To make use of the Media3 integration, create and add the `Media3PlayerIntegration` to your `THEOplayerView`: -```kotlin -val media3PlayerIntegration = Media3PlayerIntegrationFactory.createMedia3PlayerIntegration() -theoplayerView.player.addIntegration(media3PlayerIntegration) -``` + + + + ```kotlin + val media3PlayerIntegration = Media3PlayerIntegrationFactory.createMedia3PlayerIntegration() + theoplayerView.player.addIntegration(media3PlayerIntegration) + ``` + + + ```java + Media3PlayerIntegration media3PlayerIntegration = Media3PlayerIntegrationFactory.createMedia3PlayerIntegration() + theoplayerView.getPlayer().addIntegration(media3PlayerIntegration) + ``` + + + Once the Media3PlayerIntegration is added to the player, all subsequent sources set on the player will use the Media3 pipeline. @@ -90,13 +69,13 @@ Once the Media3PlayerIntegration is added to the player, all subsequent sources ```kotlin val typedSource = TypedSource - .Builder("https://cdn.theoplayer.com/video/dash/big_buck_bunny/BigBuckBunny_10s_simple_2014_05_09.mpd") - .type(SourceType.DASH) - .build() + .Builder("https://cdn.theoplayer.com/video/dash/big_buck_bunny/BigBuckBunny_10s_simple_2014_05_09.mpd") + .type(SourceType.DASH) + .build() val sourceDescription = SourceDescription - .Builder(typedSource) - .build() + .Builder(typedSource) + .build() theoPlayerView.player.source = sourceDescription ``` @@ -104,13 +83,13 @@ Once the Media3PlayerIntegration is added to the player, all subsequent sources ```java TypedSource typedSource = new TypedSource - .Builder("https://cdn.theoplayer.com/video/dash/big_buck_bunny/BigBuckBunny_10s_simple_2014_05_09.mpd") - .type(SourceType.DASH) - .build(); + .Builder("https://cdn.theoplayer.com/video/dash/big_buck_bunny/BigBuckBunny_10s_simple_2014_05_09.mpd") + .type(SourceType.DASH) + .build(); SourceDescription sourceDescription = new SourceDescription - .Builder(typedSource) - .build(); + .Builder(typedSource) + .build(); theoPlayerView.getPlayer().setSource(sourceDescription); ``` @@ -119,27 +98,44 @@ Once the Media3PlayerIntegration is added to the player, all subsequent sources -By default, the `Media3PlayerIntegration` will play all types of sources except HESP and Millicast. +By default, the `Media3PlayerIntegration` will play all types of sources except Millicast. To modify the default behaviour, you can pass a custom `Media3PlayerIntegration.SourceSelectCallback` implementation when constructing the integration. -```kotlin -val media3PlayerIntegration = createMedia3PlayerIntegration(Media3PlayerIntegration.SourceSelectCallback { selectedSource, source -> - // selectedSource -> represents the TypedSource the player picked to play. - // source -> represents the SourceDescription passed to the player. - // return true -> the Media3 integration pipeline will be used to play the selected source. - // return false -> the default pipeline will be used to play the selected source. -}) -theoplayerView.player.addIntegration(media3PlayerIntegration) -``` + + + + ```kotlin + val media3PlayerIntegration = createMedia3PlayerIntegration(Media3PlayerIntegration.SourceSelectCallback { selectedSource, source -> + // selectedSource -> represents the TypedSource the player picked to play. + // source -> represents the SourceDescription passed to the player. + // return true -> the Media3 integration pipeline will be used to play the selected source. + // return false -> the default pipeline will be used to play the selected source. + }) + theoplayerView.player.addIntegration(media3PlayerIntegration) + ``` + + + ```java + Media3PlayerIntegration media3PlayerIntegration = Media3PlayerIntegrationFactory.createMedia3PlayerIntegration((selectedSource, source) -> { + // selectedSource -> represents the TypedSource the player picked to play. + // source -> represents the SourceDescription passed to the player. + // return true; -> the Media3 integration pipeline will be used to play the selected source. + // return false; -> the default pipeline will be used to play the selected source. + }); + theoplayerView.getPlayer().addIntegration(media3PlayerIntegration); + ``` + + + ## Known limitations As this integration is still under development, there are currently some known limitations and features that are still under development and not yet supported: -- The preload, ABR, network, metrics, latency and caching (offline playback) APIs are not yet implemented and return dummy values. -- HESP/THEOlive and Millicast playback are not yet supported, and will fall back to our existing playback pipeline. -- `TextTrack.cues`, `TextTrack.activeCues` and cue-related events are not yet supported. Although subtitles do render correctly to the screen, the content of these subtitles is not yet exposed through our API. +- The ABR, network, metrics and caching (offline playback) APIs are not yet implemented and return dummy values. +- The latency API is currently only supported for HESP/THEOlive streams. +- Millicast playback is not yet supported, and must always be handled by the [Millicast integration](../millicast/getting-started.mdx). - Certain player and source configuration parameters are not yet handled. - Certain player events may not yet be dispatched correctly. - There are some known issues with video track and quality switching.