Skip to content

Commit

Permalink
Merge pull request #290 from THEOplayer/maintenance/support_target_sd…
Browse files Browse the repository at this point in the history
…k_33

Maintenance/support target sdk 33
  • Loading branch information
tvanlaerhoven authored Mar 22, 2024
2 parents a3b18bb + 66a3666 commit 951bc71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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).

## [3.10.2] - 24-03-21

### Changed

- Downgraded default `androidx.core:core-ktx` dependency version to support Android target sdk 33.

## [3.10.1] - 24-03-19

### Changed
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.2.2'
classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '8.2.2')}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.9.21')}"
}
}
Expand Down Expand Up @@ -108,9 +108,9 @@ repositories {
dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.core:core-ktx:1.12.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('coroutinesVersion', '1.7.3')}"
implementation "androidx.appcompat:appcompat:${safeExtGet('appcompatVersion', '1.6.1')}"
implementation "androidx.core:core-ktx:${safeExtGet('corektxVersion', '1.10.1')}"

// The minimum supported THEOplayer version is 6.0.0
def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[6.0.0,7.0)')
Expand Down
17 changes: 11 additions & 6 deletions android/src/main/java/com/theoplayer/media/MediaPlaybackService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,18 @@ class MediaPlaybackService : MediaBrowserServiceCompat() {

private fun startForegroundWithPlaybackState(@PlaybackStateCompat.State playbackState: Int, largeIcon: Bitmap? = null) {
try {
ServiceCompat.startForeground(
this, NOTIFICATION_ID,
notificationBuilder.build(playbackState, largeIcon, enableMediaControls),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(
NOTIFICATION_ID,
notificationBuilder.build(playbackState, largeIcon, enableMediaControls),
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
else 0
)
)
} else {
startForeground(
NOTIFICATION_ID,
notificationBuilder.build(playbackState, largeIcon, enableMediaControls)
)
}
} catch (e: IllegalStateException) {
// Make sure that app does not crash in case anything goes wrong with starting the service.
// https://issuetracker.google.com/issues/229000935
Expand Down

0 comments on commit 951bc71

Please sign in to comment.