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/v3.1.0 #222

Merged
merged 24 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a73b42
Forward error to theoplayer when drm requests fail on ios bridge
wvanhaevre Sep 12, 2023
9a53bd5
Also pass the data
wvanhaevre Sep 12, 2023
043c582
Add changelog entry
wvanhaevre Sep 12, 2023
98204a7
Pass error and response data on failing DRM requests
wvanhaevre Sep 12, 2023
4f82708
Bump @babel/traverse from 7.23.0 to 7.23.2 in /example
dependabot[bot] Oct 17, 2023
3d75131
Merge pull request #216 from THEOplayer/dependabot/npm_and_yarn/examp…
tvanlaerhoven Oct 18, 2023
4c00913
Bump @babel/traverse from 7.23.0 to 7.23.2
dependabot[bot] Oct 18, 2023
6812ffb
Merge pull request #215 from THEOplayer/dependabot/npm_and_yarn/babel…
tvanlaerhoven Oct 18, 2023
34c77ee
Provide initial seekable range value for vods
tvanlaerhoven Oct 20, 2023
56a9368
Add changelog entry
tvanlaerhoven Oct 20, 2023
6854d88
Merge pull request #217 from THEOplayer/bugfix/android_offline_mp4_se…
tvanlaerhoven Oct 24, 2023
60cdf96
Only retrieve audio focus when playback is not paused
tvanlaerhoven Oct 24, 2023
b46c835
Update changelog entry
tvanlaerhoven Oct 24, 2023
d49c18b
Merge pull request #219 from THEOplayer/bugfix/android_audiofocus_hos…
tvanlaerhoven Oct 24, 2023
48162ec
Remove setComponentEnabledSetting
tvanlaerhoven Oct 27, 2023
b2de37d
Set private property
tvanlaerhoven Oct 27, 2023
deb2cde
Set the mediabrowserservice always active
tvanlaerhoven Oct 27, 2023
214e955
Add changelog entry
tvanlaerhoven Oct 27, 2023
df8124f
Update changelog
tvanlaerhoven Oct 27, 2023
6ff31ea
Merge branch 'develop' into bugfix/ios-passing-drm-request-errors
wvanhaevre Oct 27, 2023
7c0894c
Merge pull request #193 from THEOplayer/bugfix/ios-passing-drm-reques…
wvanhaevre Oct 27, 2023
ddb848b
Merge pull request #221 from THEOplayer/maintenance/android_playbacks…
tvanlaerhoven Oct 27, 2023
81492bf
Update changelog
tvanlaerhoven Oct 27, 2023
dd29bbf
3.1.0
tvanlaerhoven Oct 27, 2023
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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.1.0] - 23-10-27

### Changed

- Revised audio focus protocol on Android. When resuming an app, audio focus is retrieved only if the player is not paused.
- Changed the behaviour of the Android component supporting background playback. It is stopped but not disabled when setting `backgroundAudioConfiguration.enabled = true`.

### Fixed

- Fixed an issue on Android where during play-out of a locally stored media asset the `seekable` property would not update.
- Fixed an issue on iOS where the error was not forwarded to theoplayer if a drm request fails on the iOS bridge

## [3.0.2] - 23-10-17

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:name="com.theoplayer.media.MediaPlaybackService"
android:description="@string/background_playback_service_description"
android:exported="false"
android:enabled="false"
android:enabled="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
Expand Down
33 changes: 4 additions & 29 deletions android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.os.Handler
import android.os.IBinder
Expand Down Expand Up @@ -74,7 +73,7 @@ class ReactTHEOplayerContext private constructor(
var imaIntegration: GoogleImaIntegration? = null
var castIntegration: CastIntegration? = null
var wasPlayingOnHostPause: Boolean = false
var isHostPaused: Boolean = false
private var isHostPaused: Boolean = false

private val isBackgroundAudioEnabled: Boolean
get() = backgroundAudioConfig.enabled
Expand Down Expand Up @@ -113,27 +112,6 @@ class ReactTHEOplayerContext private constructor(
}
}

private fun setPlaybackServiceEnabled(enabled: Boolean) {
// Toggle the MediaPlaybackService.
toggleComponent(enabled, ComponentName(reactContext.applicationContext, MediaPlaybackService::class.java))

// Also toggle any registered MediaButtonReceiver broadcast receiver.
// It will crash the app if it remains active and tries to find our disabled MediaBrowserService instance.
toggleComponent(enabled, ComponentName(reactContext.applicationContext, androidx.media.session.MediaButtonReceiver::class.java))
}

/**
* Enable or disable a receiver component.
*/
private fun toggleComponent(enabled: Boolean, componentName: ComponentName) {
reactContext.applicationContext.packageManager.setComponentEnabledSetting(
componentName,
if (enabled) PackageManager.COMPONENT_ENABLED_STATE_ENABLED
else PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP
)
}

private fun applyBackgroundPlaybackConfig(
config: BackgroundAudioConfig,
prevConfig: BackgroundAudioConfig?
Expand All @@ -148,13 +126,8 @@ class ReactTHEOplayerContext private constructor(
if (BuildConfig.USE_PLAYBACK_SERVICE) {
if (prevConfig?.enabled != true && config.enabled) {
// Enable & bind background playback
setPlaybackServiceEnabled(true)
bindMediaPlaybackService()
} else if (prevConfig?.enabled == true) {
// First disable the MediaPlaybackService and MediaButtonReceiver so that no more media
// button events can be captured.
setPlaybackServiceEnabled(false)

// Stop & unbind MediaPlaybackService.
binder?.stopForegroundService()
unbindMediaPlaybackService()
Expand Down Expand Up @@ -379,7 +352,9 @@ class ReactTHEOplayerContext private constructor(
isHostPaused = false
mediaSessionConnector?.setActive(true)
playerView.onResume()
audioFocusManager?.retrieveAudioFocus()
if (!player.isPaused) {
audioFocusManager?.retrieveAudioFocus()
}
}

fun destroy() {
Expand Down
6 changes: 3 additions & 3 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion ios/THEOplayerRCTNetworkUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class THEOplayerRCTNetworkUtils: NSObject, URLSessionDataDelegate {
let task = self.defaultUrlSession.dataTask(with: request) { data, response, error in
if let error = error {
PrintUtils.printLog(logText: "request Error: \(error.localizedDescription)")
return
}
if let urlResponse = response as? HTTPURLResponse {
let statusCode = urlResponse.statusCode
Expand All @@ -44,7 +43,10 @@ class THEOplayerRCTNetworkUtils: NSObject, URLSessionDataDelegate {
}
}
completion?(data, statusCode, allHeaders, error)
} else {
completion?(data, -1, [:], error)
}

}
// start the task
task.resume()
Expand Down
4 changes: 4 additions & 0 deletions ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
THEOplayerRCTNetworkUtils.shared.requestFromUrl(url: url, method: method, body: bodyData, headers: headers) { data, statusCode, responseHeaders, error in
if let responseError = error {
print(CPI_TAG, "Certificate request failure: error = \(responseError.localizedDescription)")
completion(data, error)
} else if statusCode >= 400 {
PrintUtils.printLog(logText: "Certificate request failure: statusCode = \(statusCode)")
completion(data, nil)
} else {
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "Certificate request success: statusCode = \(statusCode)") }
let certificateRequest = CertificateRequest(url: urlString, method: method, headers: headers, body: bodyData)
Expand Down Expand Up @@ -278,8 +280,10 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
THEOplayerRCTNetworkUtils.shared.requestFromUrl(url: url, method: method, body: bodyData, headers: headers) { data, statusCode, responseHeaders, error in
if let responseError = error {
print(CPI_TAG, "License request failure: error = \(responseError.localizedDescription)")
completion(data, error)
} else if statusCode >= 400 {
print(CPI_TAG, "License request failure: statusCode = \(statusCode)")
completion(data, nil)
} else {
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "License request success: statusCode = \(statusCode)") }
let licenseRequest = LicenseRequest(url: urlString, method: method, headers: headers, body: bodyData, fairplaySkdUrl: nil, useCredentials: false)
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-theoplayer",
"version": "3.0.2",
"version": "3.1.0",
"description": "A THEOplayer video component for react-native.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
3 changes: 3 additions & 0 deletions src/internal/adapter/THEOplayerAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
this._state.selectedAudioTrack = event.selectedAudioTrack;
this._state.selectedVideoTrack = event.selectedVideoTrack;
this._state.selectedTextTrack = event.selectedTextTrack;
if (isFinite(this._state.duration)) {
this._state.seekable = [{start: 0, end: this._state.duration}];
}
};

private onDurationChange = (event: DurationChangeEvent) => {
Expand Down
Loading