From 4f892315f163cf4945f5375638d5dff00bf9e8ee Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 13:29:22 +0200 Subject: [PATCH 01/14] Introduce `lockScreenControlConfig` --- src/index.ts | 1 + src/lockScreenControlConfig.ts | 5 +++++ src/playerConfig.ts | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 src/lockScreenControlConfig.ts diff --git a/src/index.ts b/src/index.ts index b54b2472..f4219176 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,3 +24,4 @@ export * from './playerConfig'; export * from './liveConfig'; export * from './bufferApi'; export * from './network'; +export * from './lockScreenControlConfig'; diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts new file mode 100644 index 00000000..94790705 --- /dev/null +++ b/src/lockScreenControlConfig.ts @@ -0,0 +1,5 @@ +// TODO: docs +export interface LockScreenControlConfig { + // TODO: docs + isEnabled?: boolean; +} diff --git a/src/playerConfig.ts b/src/playerConfig.ts index cffe2308..28d14fd8 100644 --- a/src/playerConfig.ts +++ b/src/playerConfig.ts @@ -9,6 +9,7 @@ import { NativeInstanceConfig } from './nativeInstance'; import { PlaybackConfig } from './playbackConfig'; import { LiveConfig } from './liveConfig'; import { NetworkConfig } from './network/networkConfig'; +import { LockScreenControlConfig } from './lockScreenControlConfig'; /** * Object used to configure a new `Player` instance. @@ -73,4 +74,6 @@ export interface PlayerConfig extends NativeInstanceConfig { * Configures network request manipulation functionality. A default {@link NetworkConfig} is set initially. */ networkConfig?: NetworkConfig; + // TODO: docs + lockScreenControlConfig?: LockScreenControlConfig; } From 8e10b3d0078837e40b62c07018b9a5409078e2a4 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 13:30:21 +0200 Subject: [PATCH 02/14] Add `lockScreenControlConfig.isEnabled` converters --- ios/RCTConvert+BitmovinPlayer.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ios/RCTConvert+BitmovinPlayer.swift b/ios/RCTConvert+BitmovinPlayer.swift index e425f07b..c9f73fa2 100644 --- a/ios/RCTConvert+BitmovinPlayer.swift +++ b/ios/RCTConvert+BitmovinPlayer.swift @@ -42,6 +42,9 @@ extension RCTConvert { if let networkConfig = RCTConvert.networkConfig(json["networkConfig"]) { playerConfig.networkConfig = networkConfig } + if let nowPlayingConfig = RCTConvert.lockScreenControlConfig(json["lockScreenControlConfig"]) { + playerConfig.nowPlayingConfig = nowPlayingConfig + } #if os(iOS) if let remoteControlConfig = RCTConvert.remoteControlConfig(json["remoteControlConfig"]) { playerConfig.remoteControlConfig = remoteControlConfig @@ -1328,6 +1331,17 @@ extension RCTConvert { "body": toJson(data: httpResponse.body) ] } + + static func lockScreenControlConfig(_ json: Any?) -> NowPlayingConfig? { + guard let json = json as? [String: Any?] else { + return nil + } + let nowPlayingConfig = NowPlayingConfig() + if let isEnabled = json["isEnabled"] as? Bool { + nowPlayingConfig.isNowPlayingInfoEnabled = isEnabled + } + return nowPlayingConfig + } } /** * React native specific PlayerViewConfig. From cbbaaeef5d815db0e8ee2bb9a2049c2b73bcc4fa Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:13:09 +0200 Subject: [PATCH 03/14] Add `LockScreenControlConfig` docs --- src/lockScreenControlConfig.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index 94790705..3e083dfe 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -1,4 +1,8 @@ -// TODO: docs +/** + * Configures the lock screen information for the application. This information will be displayed + * wherever lock screen information typically appears, such as the lock screen + * and inside the control center. + */ export interface LockScreenControlConfig { // TODO: docs isEnabled?: boolean; From 6274ad9da41a4330778d42ee6107fe120b695372 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:37:17 +0200 Subject: [PATCH 04/14] Add `isEnabled` docs --- src/lockScreenControlConfig.ts | 43 +++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index 3e083dfe..30da9d46 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -4,6 +4,47 @@ * and inside the control center. */ export interface LockScreenControlConfig { - // TODO: docs + // TODO: android docs, and merge them. + /** + * Enable the default behavior of displaying Now Playing information + * on the lock screen and inside the control center. + * Default is `false`. + * + * For a detailed list of the supported features in the **default behavior**, + * check the **Default Supported Features** section. + * + * @note Enabling this flag will automatically treat `TweaksConfig.updatesNowPlayingInfoCenter` as `false`. + * + * ## Limitations + * --- + * - Currently, the current Now Playing information is disabled during casting. + * + * ## Known Issues + * --- + * - There is unexpected behavior when using the IMA SDK. The Google IMA SDK adds its own commands + * for play/pause as soon as the ad starts loading (not when it starts playing). Within this window + * (approximately around 10 seconds), it is possible that both the ad and the main content are playing + * at the same time when a user interacts with the Now Playing feature. + * + * ## Default Supported Features + * --- + * Here is the list of features supported by the default behavior. + * + * ### Populated Metadata + * - asset URL (to visualize the correct kind of data — _e.g. a waveform for audio files_) + * - title + * - artwork + * - live or VOD status + * - playback rate + * - default playback rate + * - elapsed time + * - duration + * + * ### Registered Commands + * - toggle play/pause + * - change playback position + * - skip forward + * - skip backward + */ isEnabled?: boolean; } From 9bfa60fc0ec38be6bd5f7db9a97169a5dd951f62 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:37:34 +0200 Subject: [PATCH 05/14] Add `lockScreenControlConfig` docs --- src/playerConfig.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/playerConfig.ts b/src/playerConfig.ts index 28d14fd8..84a5ecea 100644 --- a/src/playerConfig.ts +++ b/src/playerConfig.ts @@ -74,6 +74,10 @@ export interface PlayerConfig extends NativeInstanceConfig { * Configures network request manipulation functionality. A default {@link NetworkConfig} is set initially. */ networkConfig?: NetworkConfig; - // TODO: docs + /** + * Configures the lock screen information for the application. This information will be displayed + * wherever lock screen information typically appears, such as the lock screen + * and inside the control center. + */ lockScreenControlConfig?: LockScreenControlConfig; } From 31a0d9302d5e2942f4419284f9d81a286359b70d Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:37:54 +0200 Subject: [PATCH 06/14] Deprecate `updatesNowPlayingInfoCenter` --- src/tweaksConfig.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tweaksConfig.ts b/src/tweaksConfig.ts index 45ac1cfb..d55b7020 100644 --- a/src/tweaksConfig.ts +++ b/src/tweaksConfig.ts @@ -166,6 +166,7 @@ export interface TweaksConfig { * * Default is `true`. * + * @deprecated To enable the Now Playing information use {@link LockScreenControlConfig.isEnabled} * @platform iOS */ updatesNowPlayingInfoCenter?: boolean; From c8989bff0059cb7c82b4e94551ac5c9c38682612 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:40:47 +0200 Subject: [PATCH 07/14] Change confusing wording --- src/lockScreenControlConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index 30da9d46..93dab4ca 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -17,7 +17,7 @@ export interface LockScreenControlConfig { * * ## Limitations * --- - * - Currently, the current Now Playing information is disabled during casting. + * - At the moment, the current Now Playing information is disabled during casting. * * ## Known Issues * --- From 00451e752c9210fdc9d45557325cc0e298ddd3f2 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:42:11 +0200 Subject: [PATCH 08/14] Use ts docs notation for class link --- src/lockScreenControlConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index 93dab4ca..97ffe28e 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -13,7 +13,7 @@ export interface LockScreenControlConfig { * For a detailed list of the supported features in the **default behavior**, * check the **Default Supported Features** section. * - * @note Enabling this flag will automatically treat `TweaksConfig.updatesNowPlayingInfoCenter` as `false`. + * @note Enabling this flag will automatically treat {@link TweaksConfig.updatesNowPlayingInfoCenter} as `false`. * * ## Limitations * --- From 6907b4dd752df8e47647914523a3f5cd7871e836 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:52:15 +0200 Subject: [PATCH 09/14] Generalize wording to be less iOS-specific --- src/lockScreenControlConfig.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index 97ffe28e..7a179909 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -6,8 +6,8 @@ export interface LockScreenControlConfig { // TODO: android docs, and merge them. /** - * Enable the default behavior of displaying Now Playing information - * on the lock screen and inside the control center. + * Enable the default behavior of displaying media information + * on the lock screen and within the control center. * Default is `false`. * * For a detailed list of the supported features in the **default behavior**, @@ -17,14 +17,15 @@ export interface LockScreenControlConfig { * * ## Limitations * --- - * - At the moment, the current Now Playing information is disabled during casting. + * - At the moment, the current media information is disabled during casting. * * ## Known Issues * --- + * **iOS**: * - There is unexpected behavior when using the IMA SDK. The Google IMA SDK adds its own commands * for play/pause as soon as the ad starts loading (not when it starts playing). Within this window * (approximately around 10 seconds), it is possible that both the ad and the main content are playing - * at the same time when a user interacts with the Now Playing feature. + * at the same time when a user interacts with the lock-screen control feature. * * ## Default Supported Features * --- From e6f13771a024e2254bf5c9916b33d643def04167 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 16:53:18 +0200 Subject: [PATCH 10/14] Remove unnecessary TODO As I'll use a base branch and 2 separate PRs instead --- src/lockScreenControlConfig.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index 7a179909..cf44b91f 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -4,7 +4,6 @@ * and inside the control center. */ export interface LockScreenControlConfig { - // TODO: android docs, and merge them. /** * Enable the default behavior of displaying media information * on the lock screen and within the control center. From f0de7320ec40efd3b5af36c26cd540855adfabc8 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 17:04:51 +0200 Subject: [PATCH 11/14] Simplify wording --- src/lockScreenControlConfig.ts | 2 +- src/playerConfig.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lockScreenControlConfig.ts b/src/lockScreenControlConfig.ts index cf44b91f..89a9831b 100644 --- a/src/lockScreenControlConfig.ts +++ b/src/lockScreenControlConfig.ts @@ -1,6 +1,6 @@ /** * Configures the lock screen information for the application. This information will be displayed - * wherever lock screen information typically appears, such as the lock screen + * wherever current media information typically appears, such as the lock screen * and inside the control center. */ export interface LockScreenControlConfig { diff --git a/src/playerConfig.ts b/src/playerConfig.ts index 84a5ecea..11e0e5b0 100644 --- a/src/playerConfig.ts +++ b/src/playerConfig.ts @@ -76,7 +76,7 @@ export interface PlayerConfig extends NativeInstanceConfig { networkConfig?: NetworkConfig; /** * Configures the lock screen information for the application. This information will be displayed - * wherever lock screen information typically appears, such as the lock screen + * wherever current media information typically appears, such as the lock screen * and inside the control center. */ lockScreenControlConfig?: LockScreenControlConfig; From 76bc8fcd1513a1798eb56237938f11081c0fac55 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 17:05:16 +0200 Subject: [PATCH 12/14] Add entry about `LockScreenControlConfig` --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc2f75f8..92175e07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- `LockScreenControlConfig` to configure the lock screen information for the application. When `isEnabled` is `true`, the current media information will be shown on the lock-screen and within the control center. + ### Changed - Update Bitmovin's native Android SDK version to `3.84.0` From 8ebef4cdb2dcf56365fdeb9e8e59b335c42405f7 Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 17:06:00 +0200 Subject: [PATCH 13/14] Add entry about deprecating `udpatesNowPlayingInfoCenter` --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92175e07..94d85ef4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ - Update Bitmovin's native Android SDK version to `3.84.0` +### Deprecated + +- `TweaksConfig.updatesNowPlayingInfoCenter` in favor of `LockScreenControlConfig.isEnabled` + ## [0.29.0] - 2024-09-09 ### Added From a0db607624898b9db832c4560ceb47c494db901a Mon Sep 17 00:00:00 2001 From: Michele Pozzi <123.mpozzi@gmail.com> Date: Mon, 7 Oct 2024 17:07:02 +0200 Subject: [PATCH 14/14] Remove ending dot --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d85ef4..ae271c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Added -- `LockScreenControlConfig` to configure the lock screen information for the application. When `isEnabled` is `true`, the current media information will be shown on the lock-screen and within the control center. +- `LockScreenControlConfig` to configure the lock screen information for the application. When `isEnabled` is `true`, the current media information will be shown on the lock-screen and within the control center ### Changed