diff --git a/example/ios/BitmovinPlayerReactNativeExample.xcodeproj/project.pbxproj b/example/ios/BitmovinPlayerReactNativeExample.xcodeproj/project.pbxproj index 4e8de29c..33f94a2d 100644 --- a/example/ios/BitmovinPlayerReactNativeExample.xcodeproj/project.pbxproj +++ b/example/ios/BitmovinPlayerReactNativeExample.xcodeproj/project.pbxproj @@ -423,10 +423,16 @@ inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-BitmovinPlayerReactNativeExample/Pods-BitmovinPlayerReactNativeExample-resources.sh", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core-iOS/AccessibilityResources.bundle", + "${PODS_ROOT}/google-cast-sdk/GoogleCastSDK-ios-4.8.0_static/GoogleCast.framework/GoogleCastCoreResources.bundle", + "${PODS_ROOT}/google-cast-sdk/GoogleCastSDK-ios-4.8.0_static/GoogleCast.framework/GoogleCastUIResources.bundle", + "${PODS_ROOT}/google-cast-sdk/GoogleCastSDK-ios-4.8.0_static/GoogleCast.framework/MaterialDialogs.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleCastCoreResources.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleCastUIResources.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialDialogs.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/ios/BitmovinCastManagerModule.swift b/ios/BitmovinCastManagerModule.swift index 07c0b5e0..f636c2f1 100644 --- a/ios/BitmovinCastManagerModule.swift +++ b/ios/BitmovinCastManagerModule.swift @@ -29,6 +29,7 @@ class BitmovinCastManagerModule: NSObject, RCTBridgeModule { resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock ) { +#if os(iOS) bridge.uiManager.addUIBlock { _, _ in if let config = config { guard let options = RCTConvert.castManagerOptions(config) else { @@ -42,6 +43,7 @@ class BitmovinCastManagerModule: NSObject, RCTBridgeModule { resolve(nil) } } +#endif } /** @@ -55,7 +57,11 @@ class BitmovinCastManagerModule: NSObject, RCTBridgeModule { rejecter reject: @escaping RCTPromiseRejectBlock ) { bridge.uiManager.addUIBlock { _, _ in +#if os(iOS) resolve(BitmovinCastManager.isInitialized()) +#else + resolve(false) +#endif } } @@ -68,8 +74,10 @@ class BitmovinCastManagerModule: NSObject, RCTBridgeModule { _ message: String, messageNamespace: String? ) { +#if os(iOS) bridge.uiManager.addUIBlock { _, _ in BitmovinCastManager.sharedInstance().sendMessage(message, withNamespace: messageNamespace) } +#endif } } diff --git a/ios/Event+JSON.swift b/ios/Event+JSON.swift index e53fee40..8dfc82b0 100644 --- a/ios/Event+JSON.swift +++ b/ios/Event+JSON.swift @@ -351,6 +351,7 @@ extension CastStartedEvent { } } +#if os(iOS) extension CastWaitingForDeviceEvent { func toJSON() -> [AnyHashable: Any] { [ @@ -360,3 +361,4 @@ extension CastWaitingForDeviceEvent { ] } } +#endif diff --git a/ios/PlayerModule.swift b/ios/PlayerModule.swift index 79e45b64..725e330e 100644 --- a/ios/PlayerModule.swift +++ b/ios/PlayerModule.swift @@ -45,8 +45,9 @@ class PlayerModule: NSObject, RCTBridgeModule { else { return } - +#if os(iOS) self?.setupRemoteControlConfig(playerConfig.remoteControlConfig) +#endif self?.players[nativeId] = PlayerFactory.create(playerConfig: playerConfig) } } @@ -67,8 +68,9 @@ class PlayerModule: NSObject, RCTBridgeModule { else { return } - +#if os(iOS) self?.setupRemoteControlConfig(playerConfig.remoteControlConfig) +#endif let defaultMetadata = RCTConvert.analyticsDefaultMetadataFromAnalyticsConfig(analyticsConfigJson) self?.players[nativeId] = PlayerFactory.create( playerConfig: playerConfig, diff --git a/ios/RCTConvert+BitmovinPlayer.swift b/ios/RCTConvert+BitmovinPlayer.swift index b42c0d6f..de636827 100644 --- a/ios/RCTConvert+BitmovinPlayer.swift +++ b/ios/RCTConvert+BitmovinPlayer.swift @@ -31,9 +31,11 @@ extension RCTConvert { if let adaptationConfig = RCTConvert.adaptationConfig(json["adaptationConfig"]) { playerConfig.adaptationConfig = adaptationConfig } +#if os(iOS) if let remoteControlConfig = RCTConvert.remoteControlConfig(json["remoteControlConfig"]) { playerConfig.remoteControlConfig = remoteControlConfig } +#endif return playerConfig } @@ -983,6 +985,7 @@ extension RCTConvert { return remoteControlConfig } +#if os(iOS) /** Utility method to instantiate a `BitmovinCastManagerOptions` from a JS object. - Parameter json: JS object @@ -1029,4 +1032,5 @@ extension RCTConvert { ) ) } +#endif } diff --git a/ios/RNPlayerView+PlayerListener.swift b/ios/RNPlayerView+PlayerListener.swift index 928774fa..0918a05b 100644 --- a/ios/RNPlayerView+PlayerListener.swift +++ b/ios/RNPlayerView+PlayerListener.swift @@ -169,6 +169,7 @@ extension RNPlayerView: PlayerListener { onVideoPlaybackQualityChanged?(event.toJSON()) } +#if os(iOS) func onCastAvailable(_ event: CastAvailableEvent, player: Player) { onCastAvailable?(event.toJSON()) } @@ -200,8 +201,8 @@ extension RNPlayerView: PlayerListener { func onCastTimeUpdated(_ event: CastTimeUpdatedEvent, player: Player) { onCastTimeUpdated?(event.toJSON()) } - func onCastWaitingForDevice(_ event: CastWaitingForDeviceEvent, player: Player) { onCastWaitingForDevice?(event.toJSON()) } +#endif } diff --git a/ios/SourceModule.swift b/ios/SourceModule.swift index 877e6251..d09d900d 100644 --- a/ios/SourceModule.swift +++ b/ios/SourceModule.swift @@ -79,9 +79,11 @@ class SourceModule: NSObject, RCTBridgeModule { return } self?.sources[nativeId] = SourceFactory.create(from: sourceConfig, sourceMetadata: sourceMetadata) +#if os(iOS) if let remoteConfig = RCTConvert.sourceRemoteControlConfig(sourceRemoteControlConfig){ self?.castSourceConfigs[nativeId] = remoteConfig.castSourceConfig } +#endif } } @@ -114,9 +116,11 @@ class SourceModule: NSObject, RCTBridgeModule { return } self?.sources[nativeId] = SourceFactory.create(from: sourceConfig) +#if os(iOS) if let remoteConfig = RCTConvert.sourceRemoteControlConfig(sourceRemoteControlConfig) { self?.castSourceConfigs[nativeId] = remoteConfig.castSourceConfig } +#endif } }