diff --git a/CHANGELOG.md b/CHANGELOG.md index 529a6b752..b46108134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Simplified the viewController reparenting mechanism on iOS that is applied when changing the presentationMode to/from fullscreen. +- The `MediaPlaybackService` on Android is never restarted if a MediaButton event is received after the app was closed. +- Added a consumer R8 config file on Android, telling R8 not to throw errors or warnings because of classes that are expected to be missing. +- Simplified the viewController reparenting mechanism on iOS that is applied when changing the `presentationMode` to/from fullscreen. ## [8.7.0] - 24-11-05 diff --git a/android/build.gradle b/android/build.gradle index 787efecfb..356ee5eb7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -66,6 +66,8 @@ android { buildConfigField "boolean", "EXTENSION_ADS", "${enabledAds}" buildConfigField "boolean", "EXTENSION_CAST", "${enabledCast}" buildConfigField "boolean", "EXTENSION_MEDIASESSION", "${enabledMediaSession}" + + consumerProguardFiles 'proguard-rules.pro' } buildTypes { diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro new file mode 100644 index 000000000..cf5c28b15 --- /dev/null +++ b/android/proguard-rules.pro @@ -0,0 +1,3 @@ +# Do no warn if any of the API classes we resolve with compileOnly are missing because the feature +# is disabled: it is expected. +-dontwarn com.theoplayer.android.api.** diff --git a/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt b/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt index 6863c6d9d..93e59c852 100644 --- a/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +++ b/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt @@ -239,7 +239,8 @@ class ReactTHEOplayerContext private constructor( // Create and initialize the media session val mediaSession = MediaSessionCompat(reactContext, TAG) - // Do not let MediaButtons restart the player when the app is not visible + // Do not let MediaButtons restart the player when media session is not active. + // https://developer.android.com/media/legacy/media-buttons#restarting-inactive-mediasessions mediaSession.setMediaButtonReceiver(null) // Create a MediaSessionConnector and attach the THEOplayer instance. diff --git a/android/src/main/java/com/theoplayer/media/MediaPlaybackService.kt b/android/src/main/java/com/theoplayer/media/MediaPlaybackService.kt index 2cc98c29b..a4b0b7b46 100644 --- a/android/src/main/java/com/theoplayer/media/MediaPlaybackService.kt +++ b/android/src/main/java/com/theoplayer/media/MediaPlaybackService.kt @@ -152,6 +152,10 @@ class MediaPlaybackService : Service() { // Set mediaSession active setActive(BuildConfig.EXTENSION_MEDIASESSION) + + // Do not let MediaButtons restart the player when media session is not active. + // https://developer.android.com/media/legacy/media-buttons#restarting-inactive-mediasessions + mediaSession.setMediaButtonReceiver(null) } } diff --git a/e2e/android/app/build.gradle b/e2e/android/app/build.gradle index f78926874..a55d37ff1 100644 --- a/e2e/android/app/build.gradle +++ b/e2e/android/app/build.gradle @@ -57,7 +57,7 @@ react { /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ -def enableProguardInReleaseBuilds = false +def enableProguardInReleaseBuilds = true /** * The preferred build flavor of JavaScriptCore (JSC) diff --git a/ios/presentationMode/THEOplayerRCTPresentationModeManager.swift b/ios/presentationMode/THEOplayerRCTPresentationModeManager.swift index 21ce2571b..9544c1ca7 100644 --- a/ios/presentationMode/THEOplayerRCTPresentationModeManager.swift +++ b/ios/presentationMode/THEOplayerRCTPresentationModeManager.swift @@ -64,7 +64,7 @@ public class THEOplayerRCTPresentationModeManager { if let containerView = self.containerView, let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self) { self.moveView(containerView, to: fullscreenParentView) - + // start hiding home indicator if let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController { customRootViewController.prefersAutoHidden = true