react-native-theoplayer 8.7.0 → 8.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/android/build.gradle +2 -0
- package/android/proguard-rules.pro +3 -0
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +2 -1
- package/android/src/main/java/com/theoplayer/media/MediaPlaybackService.kt +4 -0
- package/ios/THEOplayerRCTView.swift +9 -0
- package/ios/presentationMode/THEOplayerRCTPresentationModeManager.swift +28 -27
- package/ios/viewController/HomeIndicatorViewController.swift +16 -0
- package/lib/commonjs/manifest.json +1 -1
- package/lib/module/manifest.json +1 -1
- package/package.json +1 -1
- package/react-native-theoplayer.podspec +1 -1
- package/src/manifest.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [8.8.1] - 24-11-20
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fixed build issue on tvOS caused by HomeIndicatorViewController
|
|
13
|
+
|
|
14
|
+
## [8.8.0] - 24-11-19
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Added `HomeIndicatorViewController` to iOS, which can be used as an alternative `rootViewController` for the native App. It will automatically show/hide the home indicator when transitioning from/to fullscreen presentationMode.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Simplified the `viewController` reparenting mechanism on iOS that is applied when changing the presentationMode to/from fullscreen.
|
|
23
|
+
- The `MediaPlaybackService` on Android is never restarted if a MediaButton event is received after the app was closed.
|
|
24
|
+
- 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.
|
|
25
|
+
|
|
8
26
|
## [8.7.0] - 24-11-05
|
|
9
27
|
|
|
10
28
|
### Fixed
|
package/android/build.gradle
CHANGED
|
@@ -66,6 +66,8 @@ android {
|
|
|
66
66
|
buildConfigField "boolean", "EXTENSION_ADS", "${enabledAds}"
|
|
67
67
|
buildConfigField "boolean", "EXTENSION_CAST", "${enabledCast}"
|
|
68
68
|
buildConfigField "boolean", "EXTENSION_MEDIASESSION", "${enabledMediaSession}"
|
|
69
|
+
|
|
70
|
+
consumerProguardFiles 'proguard-rules.pro'
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
buildTypes {
|
|
@@ -239,7 +239,8 @@ class ReactTHEOplayerContext private constructor(
|
|
|
239
239
|
// Create and initialize the media session
|
|
240
240
|
val mediaSession = MediaSessionCompat(reactContext, TAG)
|
|
241
241
|
|
|
242
|
-
// Do not let MediaButtons restart the player when
|
|
242
|
+
// Do not let MediaButtons restart the player when media session is not active.
|
|
243
|
+
// https://developer.android.com/media/legacy/media-buttons#restarting-inactive-mediasessions
|
|
243
244
|
mediaSession.setMediaButtonReceiver(null)
|
|
244
245
|
|
|
245
246
|
// Create a MediaSessionConnector and attach the THEOplayer instance.
|
|
@@ -152,6 +152,10 @@ class MediaPlaybackService : Service() {
|
|
|
152
152
|
|
|
153
153
|
// Set mediaSession active
|
|
154
154
|
setActive(BuildConfig.EXTENSION_MEDIASESSION)
|
|
155
|
+
|
|
156
|
+
// Do not let MediaButtons restart the player when media session is not active.
|
|
157
|
+
// https://developer.android.com/media/legacy/media-buttons#restarting-inactive-mediasessions
|
|
158
|
+
mediaSession.setMediaButtonReceiver(null)
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
|
|
@@ -9,6 +9,7 @@ public class THEOplayerRCTView: UIView {
|
|
|
9
9
|
public private(set) var player: THEOplayer?
|
|
10
10
|
public private(set) var mainEventHandler: THEOplayerRCTMainEventHandler
|
|
11
11
|
public private(set) var broadcastEventHandler: THEOplayerRCTBroadcastEventHandler
|
|
12
|
+
let theoPlayerViewController = UIViewController()
|
|
12
13
|
var textTrackEventHandler: THEOplayerRCTTextTrackEventHandler
|
|
13
14
|
var mediaTrackEventHandler: THEOplayerRCTMediaTrackEventHandler
|
|
14
15
|
var metadataTrackEventHandler: THEOplayerRCTSideloadedMetadataTrackEventHandler
|
|
@@ -76,6 +77,14 @@ public class THEOplayerRCTView: UIView {
|
|
|
76
77
|
if let player = self.player {
|
|
77
78
|
player.frame = self.frame
|
|
78
79
|
player.autoresizingMask = [.flexibleBottomMargin, .flexibleHeight, .flexibleLeftMargin, .flexibleRightMargin, .flexibleTopMargin, .flexibleWidth]
|
|
80
|
+
|
|
81
|
+
// wrap theoPlayerViewController around the view
|
|
82
|
+
if theoPlayerViewController.parent == nil,
|
|
83
|
+
let parentViewController = self.findViewController() {
|
|
84
|
+
parentViewController.addChild(self.theoPlayerViewController)
|
|
85
|
+
self.theoPlayerViewController.didMove(toParent: parentViewController)
|
|
86
|
+
self.theoPlayerViewController.view = self
|
|
87
|
+
}
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
90
|
|
|
@@ -14,7 +14,6 @@ public class THEOplayerRCTPresentationModeManager {
|
|
|
14
14
|
|
|
15
15
|
private var containerView: UIView? // view containing the playerView and it's siblings (e.g. UI)
|
|
16
16
|
private var inlineParentView: UIView? // target view for inline representation
|
|
17
|
-
private var movingChildVCs: [UIViewController] = [] // list of playerView's child VCs that need to be reparented while moving the playerView
|
|
18
17
|
|
|
19
18
|
// MARK: Events
|
|
20
19
|
var onNativePresentationModeChange: RCTDirectEventBlock?
|
|
@@ -39,35 +38,21 @@ public class THEOplayerRCTPresentationModeManager {
|
|
|
39
38
|
|
|
40
39
|
// MARK: - logic
|
|
41
40
|
|
|
42
|
-
private func
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private func clearMovingVCs() {
|
|
51
|
-
self.movingChildVCs = []
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private func moveView(_ movingView: UIView, to targetView: UIView, with movingViewControllers: [UIViewController]) {
|
|
55
|
-
// detach the moving viewControllers from their parent
|
|
56
|
-
movingViewControllers.forEach { movedVC in
|
|
57
|
-
movedVC.removeFromParent()
|
|
58
|
-
}
|
|
41
|
+
private func moveView(_ movingView: UIView, to targetView: UIView) {
|
|
42
|
+
guard let theoPlayerViewController = (self.view as? THEOplayerRCTView)?.theoPlayerViewController else { return }
|
|
43
|
+
|
|
44
|
+
// detach the viewController from its parent
|
|
45
|
+
theoPlayerViewController.removeFromParent()
|
|
59
46
|
|
|
60
47
|
// move the actual view
|
|
61
48
|
movingView.removeFromSuperview()
|
|
62
49
|
targetView.addSubview(movingView)
|
|
63
50
|
targetView.bringSubviewToFront(movingView)
|
|
64
51
|
|
|
65
|
-
// attach the
|
|
52
|
+
// attach the viewController to its new parent
|
|
66
53
|
if let targetViewController = targetView.findViewController() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
movedVC.didMove(toParent: targetViewController)
|
|
70
|
-
}
|
|
54
|
+
targetViewController.addChild(theoPlayerViewController)
|
|
55
|
+
theoPlayerViewController.didMove(toParent: targetViewController)
|
|
71
56
|
}
|
|
72
57
|
}
|
|
73
58
|
|
|
@@ -75,22 +60,38 @@ public class THEOplayerRCTPresentationModeManager {
|
|
|
75
60
|
self.containerView = self.view?.findParentViewOfType(RCTView.self)
|
|
76
61
|
self.inlineParentView = self.containerView?.findParentViewOfType(RCTView.self)
|
|
77
62
|
|
|
63
|
+
// move the player
|
|
78
64
|
if let containerView = self.containerView,
|
|
79
65
|
let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self) {
|
|
80
|
-
self.
|
|
81
|
-
|
|
66
|
+
self.moveView(containerView, to: fullscreenParentView)
|
|
67
|
+
|
|
68
|
+
// start hiding home indicator
|
|
69
|
+
setHomeIndicatorHidden(true)
|
|
82
70
|
}
|
|
83
71
|
self.rnInlineMode = .fullscreen
|
|
84
72
|
}
|
|
85
73
|
|
|
86
74
|
private func exitFullscreen() {
|
|
75
|
+
// stop hiding home indicator
|
|
76
|
+
setHomeIndicatorHidden(false)
|
|
77
|
+
|
|
78
|
+
// move the player
|
|
87
79
|
if let containerView = self.containerView,
|
|
88
80
|
let inlineParentView = self.inlineParentView {
|
|
89
|
-
self.moveView(containerView, to: inlineParentView
|
|
90
|
-
self.clearMovingVCs()
|
|
81
|
+
self.moveView(containerView, to: inlineParentView)
|
|
91
82
|
}
|
|
92
83
|
self.rnInlineMode = .inline
|
|
93
84
|
}
|
|
85
|
+
|
|
86
|
+
private func setHomeIndicatorHidden(_ hidden: Bool) {
|
|
87
|
+
#if os(iOS)
|
|
88
|
+
if let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self),
|
|
89
|
+
let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController {
|
|
90
|
+
customRootViewController.prefersAutoHidden = hidden
|
|
91
|
+
customRootViewController.setNeedsUpdateOfHomeIndicatorAutoHidden()
|
|
92
|
+
}
|
|
93
|
+
#endif
|
|
94
|
+
}
|
|
94
95
|
|
|
95
96
|
func setPresentationModeFromRN(newPresentationMode: THEOplayerSDK.PresentationMode) {
|
|
96
97
|
guard newPresentationMode != self.presentationMode else { return }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// HomeIndicatorViewController.swift
|
|
2
|
+
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
@objc
|
|
6
|
+
public class HomeIndicatorViewController: UIViewController {
|
|
7
|
+
public var prefersAutoHidden = false
|
|
8
|
+
|
|
9
|
+
#if os(iOS)
|
|
10
|
+
public override var prefersHomeIndicatorAutoHidden: Bool {
|
|
11
|
+
get {
|
|
12
|
+
return self.prefersAutoHidden
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
#endif
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"8.
|
|
1
|
+
{"version":"8.8.1","buildDate":"2024-11-20T11:12:07.095Z"}
|
package/lib/module/manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"8.
|
|
1
|
+
{"version":"8.8.1","buildDate":"2024-11-20T11:12:07.095Z"}
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
|
|
|
25
25
|
s.platforms = { :ios => "13.4", :tvos => "13.4" }
|
|
26
26
|
s.source = { :git => "https://www.theoplayer.com/.git", :tag => "#{s.version}" }
|
|
27
27
|
|
|
28
|
-
s.source_files = 'ios/*.{h,m,swift}', 'ios/ads/*.swift', 'ios/casting/*.swift', 'ios/contentprotection/*.swift', 'ios/pip/*.swift', 'ios/backgroundAudio/*.swift', 'ios/cache/*.swift', 'ios/sideloadedMetadata/*.swift', 'ios/eventBroadcasting/*.swift' , 'ios/ui/*.swift', 'ios/presentationMode/*.swift'
|
|
28
|
+
s.source_files = 'ios/*.{h,m,swift}', 'ios/ads/*.swift', 'ios/casting/*.swift', 'ios/contentprotection/*.swift', 'ios/pip/*.swift', 'ios/backgroundAudio/*.swift', 'ios/cache/*.swift', 'ios/sideloadedMetadata/*.swift', 'ios/eventBroadcasting/*.swift' , 'ios/ui/*.swift', 'ios/presentationMode/*.swift', 'ios/viewController/*.swift'
|
|
29
29
|
s.resources = ['ios/*.css']
|
|
30
30
|
|
|
31
31
|
# ReactNative Dependency
|
package/src/manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"8.
|
|
1
|
+
{"version":"8.8.1","buildDate":"2024-11-20T11:12:07.095Z"}
|