Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions advertising-optiview-ads/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

}
Expand All @@ -45,6 +46,7 @@ kotlin {
}

dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(project(":common"))
implementation(libs.compose.runtime)
implementation(platform(libs.compose.bom))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.theoplayer.sample.ads.optiviewads

import com.theoplayer.android.api.ads.theoads.TheoAdDescription
import com.theoplayer.android.api.source.SourceDescription
import com.theoplayer.android.api.source.SourceType
import com.theoplayer.android.api.source.TypedSource

object OptiviewAdsSourceManager {
val THEOADS: SourceDescription by lazy {
SourceDescription.Builder(
TypedSource.Builder("https://example.com/manifest.m3u8")
.type(SourceType.HLS)
.hlsDateRange(true) // The flag needs to be set to `true` as the ad markers are done using `EXT-X-DATERANGE` tags.
.build()
).ads(
TheoAdDescription(
networkCode = "network-code-here",
customAssetKey = "asset-key-here",
backdropDoubleBox = "https://example.com/double.box.svg",
backdropLShape = "https://example.com/L-shape.svg"
)
).build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PlayerActivity : ComponentActivity() {

LaunchedEffect(player) {
// Configuring the player with a SourceDescription object.
theoPlayer.source = SourceManager.THEOADS
theoPlayer.source = OptiviewAdsSourceManager.THEOADS

// Set autoplay to start video whenever player is visible.
theoPlayer.isAutoplay = true
Expand Down
2 changes: 0 additions & 2 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ dependencies {
implementation(libs.material3)
implementation(libs.ui)
api(libs.theoplayer)
api(libs.theoplayer.connector.theoads)
api(libs.theoplayer.connector.millicast)
}
32 changes: 2 additions & 30 deletions common/src/main/java/com/theoplayer/sample/common/SourceManager.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.theoplayer.sample.common

import com.theoplayer.android.api.ads.theoads.TheoAdDescription
import com.theoplayer.android.api.millicast.MillicastSource
import com.theoplayer.android.api.source.GoogleDaiTypedSource
import com.theoplayer.android.api.source.SourceDescription
import com.theoplayer.android.api.source.SourceType
Expand All @@ -18,8 +16,7 @@ import com.theoplayer.android.api.theolive.TheoLiveSource
import java.util.Collections


class SourceManager private constructor() {
companion object {
object SourceManager {
val BIP_BOP_HLS: SourceDescription by lazy {
SourceDescription
.Builder(
Expand Down Expand Up @@ -269,37 +266,12 @@ class SourceManager private constructor() {
.build()
).build()
}
val THEOADS: SourceDescription by lazy {
SourceDescription.Builder(
TypedSource.Builder("https://example.com/manifest.m3u8")
.type(SourceType.HLS)
.hlsDateRange(true) // The flag needs to be set to `true` as the ad markers are done using `EXT-X-DATERANGE` tags.
.build()
).ads(
TheoAdDescription(
networkCode = "network-code-here",
customAssetKey = "asset-key-here",
backdropDoubleBox = "https://example.com/double.box.svg",
backdropLShape = "https://example.com/L-shape.svg"
)
).build()
}

val THEOLIVE: SourceDescription by lazy {
SourceDescription.Builder(
TheoLiveSource(
src = "ar5c53uzm3si4h4zgkzrju44h",
)
).build()
}
val MILLICAST: SourceDescription by lazy {
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()
}
}
}
2 changes: 2 additions & 0 deletions google-dai/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

}
Expand All @@ -45,6 +46,7 @@ kotlin {
}

dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(project(":common"))
implementation(libs.compose.runtime)
implementation(platform(libs.compose.bom))
Expand Down
2 changes: 2 additions & 0 deletions google-ima/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

}
Expand All @@ -45,6 +46,7 @@ kotlin {
}

dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)
implementation(project(":common"))
implementation(libs.compose.runtime)
implementation(platform(libs.compose.bom))
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
appcompat = "1.7.1"
constraintlayout = "2.2.1"
desugarJdkLibs = "2.1.5"
gson = "2.13.2"
media = "1.7.1"
recyclerview = "1.4.0"
Expand All @@ -26,6 +27,7 @@ serialization = "1.10.0"
[libraries]
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
desugar-jdk-libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugarJdkLibs" }
gradle-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "gradle" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.theoplayer.sample.streaming.millicast

import com.theoplayer.android.api.millicast.MillicastSource
import com.theoplayer.android.api.source.SourceDescription

object MillicastSourceManager {
val MILLICAST: SourceDescription by lazy {
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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PlayerActivity : ComponentActivity() {
theoplayerView.settings.setAllowBackgroundPlayback(true)

// Configuring the player with a SourceDescription object.
theoPlayer.source = SourceManager.MILLICAST
theoPlayer.source = MillicastSourceManager.MILLICAST

// Set autoplay to start video whenever player is visible.
theoPlayer.isAutoplay = true
Expand Down