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

Feature/example app navigation #296

Open
wants to merge 61 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
4d252f2
Bridge theoads properties
tvanlaerhoven Aug 14, 2024
4042a9e
Add theoads integration
tvanlaerhoven Aug 14, 2024
d295e87
Apply consistent naming
tvanlaerhoven Sep 4, 2024
cba278d
Apply name changes
tvanlaerhoven Sep 4, 2024
1f39019
Remove unstable api annotation
tvanlaerhoven Sep 4, 2024
7bc5eb6
Fix trivial warnings
tvanlaerhoven Sep 4, 2024
2888930
Fix trivial warnings
tvanlaerhoven Sep 6, 2024
d90db91
Prepare encrypted event handling
wvanhaevre Aug 14, 2024
32fdeaf
remove onDimensionChange eventListener
wvanhaevre Aug 14, 2024
2014d9f
Add changelog entry
wvanhaevre Jun 27, 2024
5eacf40
Initial setup
wvanhaevre Mar 22, 2024
4ede7e9
Simplified minimal setup to source and play command
wvanhaevre Mar 25, 2024
a568399
Drop print
wvanhaevre Mar 25, 2024
c87079c
Add usePlayerfocus hook
wvanhaevre Mar 25, 2024
8d22206
Add comments and restructure code
wvanhaevre Mar 25, 2024
27868eb
Finalising initial setup
wvanhaevre Mar 26, 2024
e856841
Enable autoplay in extended setup
wvanhaevre Mar 26, 2024
382eaeb
Add PresentationMode sample
wvanhaevre Mar 26, 2024
a183921
For now, use single screen setup for TV and web platforms
wvanhaevre Mar 26, 2024
e9ca388
Added Sideloaded TextTracks and DRM samples
wvanhaevre Apr 12, 2024
657f7ed
Add samples for Conviva, Comscore, Nielsen, Adobe + extract config to…
wvanhaevre Apr 16, 2024
dfbc873
Simplify sample names
wvanhaevre Apr 16, 2024
a824377
Simplify sample button titles
wvanhaevre Apr 16, 2024
8d12e39
Converted to setup with drawer navigator
wvanhaevre Apr 17, 2024
f692bf1
Update webpack config for connector testing
wvanhaevre Apr 11, 2024
8461527
Start on Overview screen
wvanhaevre Apr 17, 2024
d811b47
Unmount the screens when selecting a different sample
wvanhaevre Apr 17, 2024
b21deee
Stop using usePlayerfocus hook with new unmountOnBlur setup
wvanhaevre Apr 17, 2024
742facd
Remove unused player state variable retrieval
wvanhaevre Apr 17, 2024
5e39c82
use plugin-transform-export-namespace-from instead of deprecated plug…
wvanhaevre Apr 19, 2024
5b0cd17
linting updates
wvanhaevre Apr 25, 2024
4a0c5ef
fix broken STT screen + update lock files and ios project
wvanhaevre Apr 29, 2024
b9b399d
Add basic controls to analytics samples
wvanhaevre Apr 29, 2024
fff244d
Back to simple stack navigator
wvanhaevre May 7, 2024
d5fb7ba
Update webpack config with DefinePlugin
wvanhaevre May 7, 2024
34a8639
Adjust button colors to platform needs
wvanhaevre May 7, 2024
8053bd7
Support sample urls for web
wvanhaevre May 7, 2024
24fd260
Adjust screen layout setup to support all platforms
wvanhaevre May 7, 2024
b153a94
simplify url paths
wvanhaevre May 8, 2024
68be770
make bg transparent
wvanhaevre May 8, 2024
393fbfd
Don't display headers on web
wvanhaevre May 8, 2024
22dc91c
Add some margin to overview page
wvanhaevre May 8, 2024
61a1967
make bg on screens transparent
wvanhaevre May 8, 2024
821ec2f
Use different bgColor on web versus mobile
wvanhaevre May 8, 2024
c083bd2
Add changelog entry
wvanhaevre May 8, 2024
d87018a
re-enable TV platform check
wvanhaevre May 8, 2024
327257d
disable hermes when using reanimated
wvanhaevre Jun 12, 2024
7a2e99c
Add Mux sample
wvanhaevre Jul 30, 2024
7fbf2ae
Update Conviva and Mux samples
wvanhaevre Aug 5, 2024
fb9ebf2
Bump mux
wvanhaevre Aug 6, 2024
40af023
Update HLS sources
wvanhaevre Aug 22, 2024
d90fa9f
Add flashlist sample
wvanhaevre Aug 22, 2024
f289e70
Update extended setup with interruption config
wvanhaevre Aug 22, 2024
fb5fe84
Flashlist improvements
wvanhaevre Aug 23, 2024
7d78806
Setup both reel and multi player flashlist sample
wvanhaevre Aug 23, 2024
854c206
Adjust flashlist sample setup for web
wvanhaevre Sep 2, 2024
248d311
silence undeterministic uuids warnings
wvanhaevre Sep 2, 2024
cfa614d
TEMP: disable Mux till THEOplayer 8 is supported
wvanhaevre Sep 12, 2024
d39cd4f
prettier fixes
wvanhaevre Sep 12, 2024
c701866
Update packages to 8.0 support
wvanhaevre Sep 12, 2024
d866993
Updtae iOS project and lockfile
wvanhaevre Sep 12, 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Added ActiveQualityChanged event support for iOS.
- Added `'root'` as an alternative id for the root div element in Web applications, supporting fullscreen presentation mode in Expo-based apps.
- Added `renderingTarget` property to `THEOplayer` API for Android, enabling the option to choose between either rendering to a `SurfaceView` (default) or `TextureView`.

Expand All @@ -182,6 +183,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [7.4.0] - 24-06-11

### Changed

- Updated the example app to a stack navigation based setup with sample screens for different features.

### Added

- Added support for `SourceDescription.poster` for Android & iOS.
Expand Down
14 changes: 13 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,16 @@ 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:${theoplayer_sdk_version}"
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:${theoplayer_sdk_version}"
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 Down
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
38 changes: 38 additions & 0 deletions android/src/main/java/com/theoplayer/source/SourceAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ 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.TheoAdDescription
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,15 @@ 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_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 +262,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 +298,31 @@ 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(
networkCode = jsonAdDescription.optString(PROP_NETWORK_CODE),
backdropDoubleBox = jsonAdDescription.optString(PROP_BACKDROP_DOUBLE_BOX),
backdropLShape = jsonAdDescription.optString(PROP_BACKDROP_LSHAPE),
customAssetKey = jsonAdDescription.optString(PROP_CUSTOM_ASSET_KEY),
overrideLayout = parseOverrideLayout(jsonAdDescription.optString(PROP_OVERRIDE_LAYOUT)),
useId3 = jsonAdDescription.optBoolean(PROP_USE_ID3),
)
}

private fun parseOverrideLayout(layout: String?): TheoAdsLayoutOverride? {
return when (layout) {
"single" -> TheoAdsLayoutOverride.SINGLE
"l-shape" -> TheoAdsLayoutOverride.LSHAPE
"double" -> TheoAdsLayoutOverride.DOUBLE
"single-if-mobile" -> null /* Not supported yet */
else -> 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
2 changes: 2 additions & 0 deletions example/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ module.exports = {
},
},
],
'@babel/plugin-transform-export-namespace-from',
'react-native-reanimated/plugin',
],
};
32 changes: 32 additions & 0 deletions example/ios/PodConfig.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
def nielsen_source
source 'https://github.com/NielsenDigitalSDK/nielsenappsdk-ios-specs-dynamic.git'
end

def google_cast_redirect
pod 'react-native-google-cast', :git => 'https://github.com/Danesz/react-native-google-cast.git', branch: 'feature/guestmode_apple_silicon'
end

def nielsen_post_install(installer, targetName)
# modify XCFramework configuration files to update NielsenAppApi.framework -> NielsenTVAppApi.framework
installer.pods_project.targets.each do |target|
if target.name == targetName
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
puts "post_install: Found #{File.basename(xcconfig_path)}"
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.sub('-framework "NielsenAppApi"', '-framework "NielsenTVAppApi"')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
puts "post_install: Updated #{File.basename(xcconfig_path)} file with a value: NielsenTVAppApi.framework"
end
# update Pods-ReactNativeTHEOplayer-tvOS-frameworks.sh file
frameworksh_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
if File.exist?(frameworksh_path)
puts "post_install: Found #{File.basename(frameworksh_path)}"
text = File.read(frameworksh_path)
new_contents = text.gsub('NielsenAppApi.framework', 'NielsenTVAppApi.framework')
File.open(frameworksh_path, "w") {|file| file.puts new_contents}
puts "post_install: Updated #{File.basename(frameworksh_path)} file with a value: NielsenTVAppApi.framework"
end
end
end
end
9 changes: 7 additions & 2 deletions example/ios/Podfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative './PodConfig'

source 'https://github.com/react-native-tvos/react-native-tvos-podspecs.git'
source 'https://cdn.cocoapods.org/'
nielsen_source

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
install! 'cocoapods', :deterministic_uuids => false

install! 'cocoapods', :deterministic_uuids => false

Expand All @@ -19,11 +22,12 @@ target 'ReactNativeTHEOplayer' do
config = use_native_modules!

use_react_native!(
:path => config[:reactNativePath]
:path => config[:reactNativePath],
:hermes_enabled => false
)

pod 'react-native-theoplayer', :path => '../..'
pod 'react-native-google-cast', :git => 'https://github.com/Danesz/react-native-google-cast.git', branch: 'feature/guestmode_apple_silicon'
google_cast_redirect

target 'ReactNativeTHEOplayerTests' do
inherit! :complete
Expand Down Expand Up @@ -53,4 +57,5 @@ end

post_install do |installer|
react_native_post_install(installer)
nielsen_post_install(installer, "Pods-ReactNativeTHEOplayer-tvOS")
end
Loading
Loading