Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v8.5.0 #421

Merged
merged 27 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a190c05
Add theoads flag to Ads configuration
tvanlaerhoven Oct 9, 2024
ccec4aa
Add hlsDateRange property to source description
tvanlaerhoven Oct 9, 2024
6685cee
Add changelog entry
tvanlaerhoven Oct 9, 2024
c41ef2e
Bump cookie and express in /example
dependabot[bot] Oct 10, 2024
35cffe7
Fix text track mode toggling
tvanlaerhoven Oct 10, 2024
bda0358
Add changelog entry
tvanlaerhoven Oct 10, 2024
4e9f5b4
Merge pull request #416 from THEOplayer/bugfix/texttrack_selection_web
tvanlaerhoven Oct 10, 2024
ba14fb0
Merge pull request #415 from THEOplayer/dependabot/npm_and_yarn/examp…
tvanlaerhoven Oct 14, 2024
60f4a6d
Bridge theoads properties
tvanlaerhoven Aug 14, 2024
5d91d10
Add theoads integration
tvanlaerhoven Aug 14, 2024
a15abb5
Apply consistent naming
tvanlaerhoven Sep 4, 2024
40d8869
Fix trivial warnings
tvanlaerhoven Sep 11, 2024
f599e29
Remove unstable api annotation
tvanlaerhoven Sep 4, 2024
bb162f6
Add THEOads demo source
tvanlaerhoven Oct 18, 2024
f885e3d
Add changelog entry
tvanlaerhoven Oct 18, 2024
6c5fa6c
Stop forcing player into inline mode when switching from/to fullscree…
wvanhaevre Oct 18, 2024
6dcd811
Add changelog entries
wvanhaevre Oct 18, 2024
9327eee
update gitignore
wvanhaevre Oct 18, 2024
47edadf
Add SdkVersions interface
wvanhaevre Oct 18, 2024
81e4e70
Add changelog entry
wvanhaevre Oct 18, 2024
8149991
Merge pull request #418 from THEOplayer/feature/sgai_android
tvanlaerhoven Oct 21, 2024
b02e547
Merge pull request #412 from THEOplayer/feature/theoads_config
tvanlaerhoven Oct 21, 2024
e8b4dfa
Merge pull request #419 from THEOplayer/bugfix/crash_on_fullscreen_to…
wvanhaevre Oct 21, 2024
a5cfa01
Merge branch 'develop' into feature/SdkVersions_interface
wvanhaevre Oct 21, 2024
5dc78ae
Merge pull request #420 from THEOplayer/feature/SdkVersions_interface
wvanhaevre Oct 21, 2024
665d763
Update changelog
tvanlaerhoven Oct 21, 2024
19b1e87
8.5.0
tvanlaerhoven Oct 21, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ ios/custom/Frameworks/tvos/*.xcframework
_site/
Gemfile.lock
vendor
.bundle
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [8.5.0] - 24-10-21

### Added

- Added `SdkVersion` interface to be used by the sdk and its connectors to report version info.
- Added the `THEOads` SGAI ad integration for Android. See [THEOads](https://www.theoplayer.com/product/theoads) for more details.

### Fixed

- Fixed an issue on Web where all text tracks other than the selected would be set to `disabled` when enabling a text track.
- Fixed an issue on iOS where the player would crash when changing the presentationMode from fullscreen to picture-in-picture during ad playout.

### Changed

- On iOS, after closing picture-in-picture the player returns back to the previous presentationMode instead of always returning to inline.

## [8.4.0] - 24-10-10

### Added

- Added a `posterStyle` property on `THEOplayerView` to allow overriding the default 16:9 poster style.
- Added a `theoads` property on `PlayerConfiguration.ads` to allow play-out of THEOads sources on Web platforms.
- Added a `hlsDateRange` property on `SourceDescription` to enable parsing and exposing date ranges from HLS playlists. This flag was already available on `PlayerConfiguration`, which applies for all HLS sources.

### Fixed

Expand Down
13 changes: 12 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ static def versionString(version) {
// Extensions
def enabledGoogleIMA = safeExtGet("THEOplayer_extensionGoogleIMA", 'false').toBoolean()
def enabledGoogleDAI = safeExtGet("THEOplayer_extensionGoogleDAI", 'false').toBoolean()
def enabledAds = enabledGoogleIMA || enabledGoogleDAI
def enabledTHEOads = safeExtGet("THEOplayer_extensionTHEOads", 'false').toBoolean()
def enabledAds = enabledGoogleIMA || enabledGoogleDAI || enabledTHEOads
def enabledCast = safeExtGet("THEOplayer_extensionCast", 'false').toBoolean()
def enabledMediaSession = safeExtGet("THEOplayer_extensionMediaSession", 'true').toBoolean()

Expand Down Expand Up @@ -61,6 +62,7 @@ android {
// Extension buildConfig fields
buildConfigField "boolean", "EXTENSION_GOOGLE_IMA", "${enabledGoogleIMA}"
buildConfigField "boolean", "EXTENSION_GOOGLE_DAI", "${enabledGoogleDAI}"
buildConfigField "boolean", "EXTENSION_THEOADS", "${enabledTHEOads}"
buildConfigField "boolean", "EXTENSION_ADS", "${enabledAds}"
buildConfigField "boolean", "EXTENSION_CAST", "${enabledCast}"
buildConfigField "boolean", "EXTENSION_MEDIASESSION", "${enabledMediaSession}"
Expand Down Expand Up @@ -139,6 +141,14 @@ dependencies {
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
}

if (enabledTHEOads) {
println('Enable THEOplayer THEOads extension.')
implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:${theoplayer_sdk_version}"
} else {
println('Disable THEOplayer THEOads extension.')
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:${theoplayer_sdk_version}"
}

if (enabledCast) {
println('Enable THEOplayer cast extension.')
implementation "com.theoplayer.theoplayer-sdk-android:integration-cast:${theoplayer_sdk_version}"
Expand All @@ -153,6 +163,7 @@ configurations.configureEach {
resolutionStrategy {
force "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:${theoplayer_sdk_version}"
force "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
force "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:${theoplayer_sdk_version}"
}
}

14 changes: 14 additions & 0 deletions android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegrationFactory
import com.theoplayer.android.api.ads.ima.GoogleImaIntegration
import com.theoplayer.android.api.ads.ima.GoogleImaIntegrationFactory
import com.theoplayer.android.api.ads.theoads.TheoAdsIntegration
import com.theoplayer.android.api.ads.theoads.TheoAdsIntegrationFactory
import com.theoplayer.android.api.cast.CastIntegration
import com.theoplayer.android.api.cast.CastIntegrationFactory
import com.theoplayer.android.api.event.EventListener
Expand Down Expand Up @@ -80,6 +82,7 @@ class ReactTHEOplayerContext private constructor(

var daiIntegration: GoogleDaiIntegration? = null
var imaIntegration: GoogleImaIntegration? = null
private var theoAdsIntegration: TheoAdsIntegration? = null
var castIntegration: CastIntegration? = null
var wasPlayingOnHostPause: Boolean = false
private var isHostPaused: Boolean = false
Expand Down Expand Up @@ -295,6 +298,17 @@ class ReactTHEOplayerContext private constructor(
} catch (e: Exception) {
Log.w(TAG, "Failed to configure Google DAI integration ${e.message}")
}
try {
if (BuildConfig.EXTENSION_THEOADS) {
theoAdsIntegration = TheoAdsIntegrationFactory.createTheoAdsIntegration(
playerView
).also {
playerView.player.addIntegration(it)
}
}
} catch (e: Exception) {
Log.w(TAG, "Failed to configure THEOAds integration ${e.message}")
}
try {
if (BuildConfig.EXTENSION_CAST) {
castIntegration = CastIntegrationFactory.createCastIntegration(
Expand Down
48 changes: 48 additions & 0 deletions android/src/main/java/com/theoplayer/source/SourceAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.theoplayer.source
import android.text.TextUtils
import android.util.Log
import com.google.gson.Gson
import com.theoplayer.android.api.ads.theoads.TheoAdDescription
import com.theoplayer.android.api.error.THEOplayerException
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.WritableMap
Expand All @@ -17,6 +18,7 @@ import com.theoplayer.android.api.source.addescription.GoogleImaAdDescription
import com.theoplayer.android.api.player.track.texttrack.TextTrackKind
import com.theoplayer.android.api.source.metadata.ChromecastMetadataImage
import com.theoplayer.BuildConfig
import com.theoplayer.android.api.ads.theoads.TheoAdsLayoutOverride
import com.theoplayer.android.api.error.ErrorCode
import com.theoplayer.android.api.source.AdIntegration
import com.theoplayer.android.api.source.dash.DashPlaybackConfiguration
Expand Down Expand Up @@ -52,7 +54,16 @@ private const val PROP_ADS = "ads"
private const val PROP_DASH = "dash"
private const val PROP_DASH_IGNORE_AVAILABILITYWINDOW = "ignoreAvailabilityWindow"
private const val PROP_HEADERS = "headers"
private const val PROP_AD_TAG_PARAMETERS = "adTagParameters"
private const val PROP_BACKDROP_DOUBLE_BOX = "backdropDoubleBox"
private const val PROP_BACKDROP_LSHAPE = "backdropLShape"
private const val PROP_CUSTOM_ASSET_KEY = "customAssetKey"
private const val PROP_OVERRIDE_LAYOUT = "overrideLayout"
private const val PROP_NETWORK_CODE = "networkCode"
private const val PROP_USE_ID3 = "useId3"

private const val ERROR_IMA_NOT_ENABLED = "Google IMA support not enabled."
private const val ERROR_THEOADS_NOT_ENABLED = "THEOads support not enabled."
private const val ERROR_UNSUPPORTED_CSAI_INTEGRATION = "Unsupported CSAI integration"
private const val ERROR_MISSING_CSAI_INTEGRATION = "Missing CSAI integration"

Expand Down Expand Up @@ -252,6 +263,9 @@ class SourceAdapter {
AdIntegration.GOOGLE_IMA.adIntegration -> parseImaAdFromJS(
jsonAdDescription
)
AdIntegration.THEO_ADS.adIntegration -> parseTheoAdFromJS(
jsonAdDescription
)
else -> {
throw THEOplayerException(
ErrorCode.AD_ERROR,
Expand Down Expand Up @@ -285,6 +299,40 @@ class SourceAdapter {
.build()
}

@Throws(JSONException::class)
private fun parseTheoAdFromJS(jsonAdDescription: JSONObject): TheoAdDescription {
if (!BuildConfig.EXTENSION_THEOADS) {
throw THEOplayerException(ErrorCode.AD_ERROR, ERROR_THEOADS_NOT_ENABLED)
}
return TheoAdDescription(
adTagParameters = parseAdTagParameters(jsonAdDescription.optJSONObject(PROP_AD_TAG_PARAMETERS)),
backdropDoubleBox = jsonAdDescription.optString(PROP_BACKDROP_DOUBLE_BOX),
backdropLShape = jsonAdDescription.optString(PROP_BACKDROP_LSHAPE),
customAssetKey = jsonAdDescription.optString(PROP_CUSTOM_ASSET_KEY),
networkCode = jsonAdDescription.optString(PROP_NETWORK_CODE),
overrideLayout = parseOverrideLayout(jsonAdDescription.optString(PROP_OVERRIDE_LAYOUT)),
useId3 = jsonAdDescription.optBoolean(PROP_USE_ID3),
)
}

private fun parseAdTagParameters(params: JSONObject?): Map<String, String> =
params?.keys()?.asSequence()
?.mapNotNull { key -> key to params.optString(key) }
?.toMap() ?: emptyMap()

private fun parseOverrideLayout(override: String?): TheoAdsLayoutOverride? {
if (override == null) {
return null
}
when (override) {
"single" -> return TheoAdsLayoutOverride.SINGLE
"single-if-mobile" -> return TheoAdsLayoutOverride.SINGLE
"l-shape" -> return TheoAdsLayoutOverride.LSHAPE
"double" -> return TheoAdsLayoutOverride.DOUBLE
}
return null
}

@Throws(JSONException::class)
private fun parseTextTrackFromJS(jsonTextTrack: JSONObject): TextTrackDescription {
val builder = TextTrackDescription.Builder(jsonTextTrack.optString(PROP_SRC))
Expand Down
1 change: 1 addition & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ THEOplayer_logMediaSessionEvents = true
THEOplayer_extensionGoogleIMA = true
THEOplayer_extensionGoogleDAI = true
THEOplayer_extensionCast = true
THEOplayer_extensionTHEOads = true
THEOplayer_extensionMediaSession = true

# Optionally limit timeUpdate rate, which could improve performance.
Expand Down
Loading
Loading