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.6.0 #428

Merged
merged 41 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0727bdb
Add e2e tests
tvanlaerhoven Oct 14, 2024
a021578
Add connector tests
tvanlaerhoven Oct 16, 2024
a978939
Update android pr workflow
tvanlaerhoven Oct 16, 2024
ab33e2c
Disable flaky tests for now
tvanlaerhoven Oct 16, 2024
5758b1d
Update github workflows
tvanlaerhoven Oct 16, 2024
86103ae
Fix async Promise func
tvanlaerhoven Oct 16, 2024
350e5a0
Update package.json
tvanlaerhoven Oct 16, 2024
ca5a82e
Remove deprecated install
tvanlaerhoven Oct 17, 2024
8d400ca
Fix dependency version
tvanlaerhoven Oct 17, 2024
ba1c660
Update workflows
tvanlaerhoven Oct 17, 2024
a7aa768
Fix ad tests for iOS
tvanlaerhoven Oct 17, 2024
4dfc6bf
Fix patch script
tvanlaerhoven Oct 18, 2024
32840d2
Simplify actions
tvanlaerhoven Oct 22, 2024
41dc107
Update ios workflow
tvanlaerhoven Oct 22, 2024
72ef8b4
Drop non-testable app
tvanlaerhoven Oct 22, 2024
7d1b26e
Merge pull request #417 from THEOplayer/feature/e2e_cavy
tvanlaerhoven Oct 22, 2024
c29b8c4
Bump cookie and express in /e2e
dependabot[bot] Oct 22, 2024
53768a4
Bump send, serve-static and express in /e2e
dependabot[bot] Oct 22, 2024
11899dc
Merge pull request #423 from THEOplayer/dependabot/npm_and_yarn/e2e/m…
tvanlaerhoven Oct 22, 2024
781bc4d
Merge pull request #422 from THEOplayer/dependabot/npm_and_yarn/e2e/m…
tvanlaerhoven Oct 22, 2024
6b4aff0
add TRANSITIONING_TO_PIP to player events to JS API
kot331107 Sep 8, 2024
2860e98
add TRANSITIONING_TO_PIP as a new PiP context state
kot331107 Sep 8, 2024
7782ace
emit TRANSITIONING_TO_PIP to JS
kot331107 Sep 8, 2024
3df3ede
add transitioning to PiP logic to PresentationManager
kot331107 Sep 8, 2024
43d2491
update pip.md
kot331107 Sep 8, 2024
eabf60e
add to pip.md
kot331107 Sep 8, 2024
2ffb066
Listen to pip ui state changes
tvanlaerhoven Oct 23, 2024
c0803ae
Use sdk 35 in example app
tvanlaerhoven Oct 23, 2024
8d28b6a
Add remark
tvanlaerhoven Oct 23, 2024
4fde26e
Merge pull request #377 from kot331107/Android-implement-transitionin…
tvanlaerhoven Oct 23, 2024
cee3fd5
Upgrade example app to rn 0.75
tvanlaerhoven Oct 2, 2024
c99fa31
Fix ios github flow
tvanlaerhoven Oct 23, 2024
e3a9198
Bridge adtapped & adclicked events
tvanlaerhoven Oct 23, 2024
d02edab
Set minimum native sdk version
tvanlaerhoven Oct 23, 2024
c2b2f77
Add changelog entry
tvanlaerhoven Oct 23, 2024
c82fdcd
Merge pull request #424 from THEOplayer/maintenance/rn-0.75
tvanlaerhoven Oct 23, 2024
a51dec4
Fix source poster hosts
tvanlaerhoven Oct 23, 2024
2aec7a0
Fix cavy typings
tvanlaerhoven Oct 23, 2024
94a2b2f
Merge pull request #425 from THEOplayer/feature/ad_clicked
tvanlaerhoven Oct 25, 2024
1e96893
Update changelog
tvanlaerhoven Oct 25, 2024
65b6dad
8.6.0
tvanlaerhoven Oct 25, 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
56 changes: 47 additions & 9 deletions .github/workflows/pr_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [ 34 ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -31,16 +34,51 @@ jobs:
run: |
npm i -g corepack
npm ci
cd example
cd e2e
npm ci

- name: Build application
working-directory: example/android
run: ./gradlew assembleRelease
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true' #check previous step output
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
cores: 2
ram-size: 3072M
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."

- name: Upload application
uses: actions/upload-artifact@v4
- name: Run e2e tests
uses: reactivecircus/android-emulator-runner@v2
with:
name: app
path: example/android/app/build/outputs/apk/release/app-release.apk
retention-days: 3
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
cores: 2
ram-size: 3072M
force-avd-creation: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: npm run test:e2e:android:release
working-directory: e2e
26 changes: 19 additions & 7 deletions .github/workflows/pr_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,37 @@ jobs:
node-version: '18'
cache: 'npm'

- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: e2e/ios/Pods
key: pods-${{ runner.os }}-${{ hashFiles('Podfile.lock') }}
restore-keys: |
pods-${{ runner.os }}-

- name: Run patch scripts
working-directory: e2e
run: bash ./scripts/patch_ios_podspec.sh

- name: Run npm install
run: |
npm i -g corepack
npm ci
cd example
cd e2e
npm ci

- name: Run pod install
working-directory: example/ios
- name: Run pod install & update dependencies
working-directory: e2e/ios
run: |
pod install
pod update

- name: Start iOS simulator
uses: futureware-tech/simulator-action@v3
with:
model: 'iPhone 14'
os_version: '>=16.0'

- name: Build application
working-directory: example
run: npx react-native build-ios --mode Debug
- name: Run e2e tests
working-directory: e2e
run: npm run test:e2e:ios

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ android.iml
# Cocoapods
#
example/ios/Pods
e2e/ios/Pods

# node.js
#
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ 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.6.0] - 24-10-25

### Added

- Added `AdEvent.AD_CLICKED` and `AdEvent.AD_TAPPED` ad events for iOS and Android. The events are dispatched when a user taps or clicks on an ad that has a `clickThrough` link.

### Changed

- Upgrade example app to support React Native v0.75.

## [8.5.0] - 24-10-21

### Added
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ repositories {
maven { url "https://maven.theoplayer.com/releases" }
}

// The minimum supported THEOplayer version is 8.1.0
def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[8.1.0, 9.0.0)')
def theoplayer_mediasession_version = safeExtGet('THEOplayer_mediasession', '[8.1.0, 9.0.0)')
// The minimum supported THEOplayer version is 8.3.0
def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[8.3.0, 9.0.0)')
def theoplayer_mediasession_version = safeExtGet('THEOplayer_mediasession', '[8.0.0, 9.0.0)')

dependencies {
//noinspection GradleDynamicVersion
Expand Down
4 changes: 2 additions & 2 deletions android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class AdEventAdapter(private val adsApi: AdsApiWrapper, eventEmitter: AdEventEmi
GoogleImaAdEventType.AD_BREAK_STARTED, AdsEventTypes.AD_BREAK_BEGIN -> "adbreakbegin"
GoogleImaAdEventType.AD_BREAK_ENDED, AdsEventTypes.AD_BREAK_END -> "adbreakend"
GoogleImaAdEventType.AD_BREAK_FETCH_ERROR -> "aderror"
GoogleImaAdEventType.CLICKED -> "adclicked"
GoogleImaAdEventType.TAPPED -> "adtapped"
GoogleImaAdEventType.CLICKED, AdsEventTypes.AD_CLICKED -> "adclicked"
GoogleImaAdEventType.TAPPED, AdsEventTypes.AD_TAPPED -> "adtapped"
GoogleImaAdEventType.ICON_TAPPED -> "adicontapped"
GoogleImaAdEventType.ICON_FALLBACK_IMAGE_CLOSED -> "adiconfallbackimageclosed"
AdsEventTypes.ADD_AD -> "addad"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class PresentationManager(

var currentPresentationMode: PresentationMode = PresentationMode.INLINE
private set
var currentPresentationModeChangeContext: PresentationModeChangeContext? = null
private set

var pipConfig: PipConfig = PipConfig()

Expand All @@ -54,12 +56,14 @@ class PresentationManager(
}
onPictureInPictureModeChanged = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
// Dispatch event on every PiP mode change
val transitioningToPip = intent
?.getBooleanExtra("isTransitioningToPip", false) ?: false
val inPip = intent?.getBooleanExtra("isInPictureInPictureMode", false) ?: false
if (inPip) {
onEnterPip()
} else {
onExitPip()
// Dispatch event on every PiP mode change
when {
transitioningToPip -> onEnterPip(true)
inPip -> onEnterPip()
else -> onExitPip()
}
}
}
Expand Down Expand Up @@ -104,9 +108,11 @@ class PresentationManager(
PresentationMode.INLINE -> {
setFullscreen(false)
}

PresentationMode.FULLSCREEN -> {
setFullscreen(true)
}

PresentationMode.PICTURE_IN_PICTURE -> {
setFullscreen(false)
enterPip()
Expand Down Expand Up @@ -144,8 +150,13 @@ class PresentationManager(
}
}

private fun onEnterPip() {
updatePresentationMode(PresentationMode.PICTURE_IN_PICTURE)
private fun onEnterPip(transitioningToPip: Boolean = false) {
updatePresentationMode(
PresentationMode.PICTURE_IN_PICTURE,
if (transitioningToPip)
PresentationModeChangeContext(PresentationModeChangePipContext.TRANSITIONING_TO_PIP)
else null
)
}

private fun onExitPip() {
Expand Down Expand Up @@ -241,11 +252,14 @@ class PresentationManager(
presentationMode: PresentationMode,
context: PresentationModeChangeContext? = null
) {
if (presentationMode == currentPresentationMode) {
if (presentationMode == currentPresentationMode &&
context == currentPresentationModeChangeContext
) {
return
}
val prevPresentationMode = currentPresentationMode
currentPresentationMode = presentationMode
currentPresentationModeChangeContext = context
eventEmitter.emitPresentationModeChange(presentationMode, prevPresentationMode, context)

// Resume playing when going to PiP and player was playing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ enum class PresentationModeChangePipContext {
CLOSED,

// The PiP window transitioned back into the app.
RESTORED
RESTORED,

// The app transitioning to PiP frame
TRANSITIONING_TO_PIP
}

data class PresentationModeChangeContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class PayloadBuilder {
val contextPayload = Arguments.createMap()
context.pip?.let { pipCtx ->
contextPayload.putString(EVENT_PROP_PIP, when (pipCtx) {
PresentationModeChangePipContext.TRANSITIONING_TO_PIP -> "transitioning-to-pip"
PresentationModeChangePipContext.RESTORED -> "restored"
else -> "closed"
})
Expand Down
21 changes: 21 additions & 0 deletions doc/pip.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@ override fun onPictureInPictureModeChanged(
}
```

### Enabling early transitioning to PiP event

You might want to enable [transitioning to PiP](<https://developer.android.com/reference/android/app/PictureInPictureUiState#isTransitioningToPip()>) event for Android 15+ (API 35+). To enable it make sure that
the compile SDK version is set to 35 in your build.gradle `compileSdkVersion = 35`. Also the appropriate intent should be sent from the `MainActivity` to let react-native know when the app starts the PiP animation:

```kotlin
override fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState) {
super.onPictureInPictureUiStateChanged(pipState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM &&
pipState.isTransitioningToPip
) {
Intent("onPictureInPictureModeChanged").also {
it.putExtra("isTransitioningToPip", true)
sendBroadcast(it)
}
}
}
```

Then it should set the `context?.pip` to `PresentationModeChangePipContext.TRANSITIONING_TO_PIP` in the event `PlayerEventType.PRESENTATIONMODE_CHANGE`.

### PiP controls

The PiP window will show the default controls to configure, maximize and close the PiP window.
Expand Down
55 changes: 55 additions & 0 deletions e2e/android/app/_BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#

load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")

lib_deps = []

create_aar_targets(glob(["libs/*.aar"]))

create_jar_targets(glob(["libs/*.jar"]))

android_library(
name = "all-libs",
exported_deps = lib_deps,
)

android_library(
name = "app-code",
srcs = glob([
"src/main/java/**/*.java",
]),
deps = [
":all-libs",
":build_config",
":res",
],
)

android_build_config(
name = "build_config",
package = "com.reactnativetheoplayer",
)

android_resource(
name = "res",
package = "com.reactnativetheoplayer",
res = "src/main/res",
)

android_binary(
name = "app",
keystore = "//android/keystores:debug",
manifest = "src/main/AndroidManifest.xml",
package_type = "debug",
deps = [
":app-code",
],
)
Loading
Loading