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

Maintenance/module rename #263

Merged
merged 5 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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).

## [Unreleased]

### Changed

- Renamed native modules to avoid name collisions with external packages.

## [3.7.1] - 24-02-09

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/theoplayer/ads/AdsModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.theoplayer.util.ViewResolver
import com.theoplayer.ReactTHEOplayerView
import com.theoplayer.android.api.error.THEOplayerException

private const val TAG = "AdsModule"
private const val TAG = "THEORCTAdsModule"

class AdsModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
private val sourceHelper = SourceAdapter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.facebook.react.module.annotations.ReactModule
import com.theoplayer.ReactTHEOplayerView
import com.theoplayer.util.ViewResolver

private const val TAG = "EventBroadcastModule"
private const val TAG = "THEORCTEventBroadcastModule"

@ReactModule(name = TAG)
class EventBroadcastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/theoplayer/cache/CacheModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.theoplayer.source.SourceAdapter
import org.json.JSONException
import org.json.JSONObject

private const val TAG = "CacheModule"
private const val TAG = "THEORCTCacheModule"

private const val PROP_STATUS = "status"
private const val PROP_ID = "id"
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/theoplayer/cast/CastModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(
private val viewResolver: ViewResolver = ViewResolver(context)

override fun getName(): String {
return "CastModule"
return "THEORCTCastModule"
}

@ReactMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class BridgeRequest(
val onTimeout: Runnable
)

private const val TAG = "ContentProtectionModule"
private const val TAG = "THEORCTContentProtectionModule"

private const val EVENT_CERTIFICATE_REQUEST = "onCertificateRequest"
private const val EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_REQUEST = "onCertificateRequestProcessedAsRequest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.theoplayer.presentation.PipConfigAdapter
import com.theoplayer.track.TextTrackStyleAdapter
import com.theoplayer.util.ViewResolver

private const val TAG = "PlayerModule"
private const val TAG = "THEORCTPlayerModule"

@Suppress("unused")
class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
Expand Down
12 changes: 6 additions & 6 deletions ios/THEOplayerRCTBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ @interface RCT_EXTERN_MODULE(THEOplayerRCTViewManager, RCTViewManager)
// ----------------------------------------------------------------------------
// Player Module
// ----------------------------------------------------------------------------
@interface RCT_EXTERN_REMAP_MODULE(PlayerModule, THEOplayerRCTPlayerAPI, NSObject)
@interface RCT_EXTERN_REMAP_MODULE(THEORCTPlayerModule, THEOplayerRCTPlayerAPI, NSObject)

RCT_EXTERN_METHOD(setPaused:(nonnull NSNumber *)node
paused:(BOOL)paused)
Expand Down Expand Up @@ -116,7 +116,7 @@ @interface RCT_EXTERN_REMAP_MODULE(PlayerModule, THEOplayerRCTPlayerAPI, NSObjec
// Ads Module
// ----------------------------------------------------------------------------

@interface RCT_EXTERN_REMAP_MODULE(AdsModule, THEOplayerRCTAdsAPI, NSObject)
@interface RCT_EXTERN_REMAP_MODULE(THEORCTAdsModule, THEOplayerRCTAdsAPI, NSObject)

RCT_EXTERN_METHOD(skip:(nonnull NSNumber *)node)

Expand Down Expand Up @@ -161,7 +161,7 @@ @interface RCT_EXTERN_REMAP_MODULE(AdsModule, THEOplayerRCTAdsAPI, NSObject)
// ----------------------------------------------------------------------------
// ContentProtection Module
// ----------------------------------------------------------------------------
@interface RCT_EXTERN_REMAP_MODULE(ContentProtectionModule, THEOplayerRCTContentProtectionAPI, RCTEventEmitter)
@interface RCT_EXTERN_REMAP_MODULE(THEORCTContentProtectionModule, THEOplayerRCTContentProtectionAPI, RCTEventEmitter)

RCT_EXTERN_METHOD(onBuildProcessed:(NSDictionary)result)
RCT_EXTERN_METHOD(onCertificateRequestProcessedAsRequest:(NSDictionary)result)
Expand All @@ -180,7 +180,7 @@ @interface RCT_EXTERN_REMAP_MODULE(ContentProtectionModule, THEOplayerRCTContent
// Cast Module
// ----------------------------------------------------------------------------

@interface RCT_EXTERN_REMAP_MODULE(CastModule, THEOplayerRCTCastAPI, NSObject)
@interface RCT_EXTERN_REMAP_MODULE(THEORCTCastModule, THEOplayerRCTCastAPI, NSObject)

RCT_EXTERN_METHOD(casting:(nonnull NSNumber *)node
resolver:(RCTPromiseResolveBlock)resolve
Expand Down Expand Up @@ -221,7 +221,7 @@ @interface RCT_EXTERN_REMAP_MODULE(CastModule, THEOplayerRCTCastAPI, NSObject)
// ----------------------------------------------------------------------------
// Cache Module
// ----------------------------------------------------------------------------
@interface RCT_EXTERN_REMAP_MODULE(CacheModule, THEOplayerRCTCacheAPI, RCTEventEmitter)
@interface RCT_EXTERN_REMAP_MODULE(THEORCTCacheModule, THEOplayerRCTCacheAPI, RCTEventEmitter)

RCT_EXTERN_METHOD(getInitialState:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
Expand All @@ -243,7 +243,7 @@ @interface RCT_EXTERN_REMAP_MODULE(CacheModule, THEOplayerRCTCacheAPI, RCTEventE
// ----------------------------------------------------------------------------
// Broadcast Module
// ----------------------------------------------------------------------------
@interface RCT_EXTERN_REMAP_MODULE(EventBroadcastModule, THEOplayerRCTEventBroadcastAPI, NSObject)
@interface RCT_EXTERN_REMAP_MODULE(THEORCTEventBroadcastModule, THEOplayerRCTEventBroadcastAPI, NSObject)

RCT_EXTERN_METHOD(broadcastEvent:(nonnull NSNumber *)node
event:(NSDictionary)event)
Expand Down
50 changes: 25 additions & 25 deletions ios/THEOplayerRCTPlayerAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ let TTS_PROP_COLOR_A = "a"
@objc(THEOplayerRCTPlayerAPI)
class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
@objc var bridge: RCTBridge!

static func moduleName() -> String! {
return "PlayerModule"
return "THEORCTPlayerModule"
}

static func requiresMainQueueSetup() -> Bool {
return false
}

@objc(setPaused:paused:)
func setPaused(_ node: NSNumber, paused: Bool) -> Void {
DispatchQueue.main.async {
Expand All @@ -52,7 +52,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setSource:src:)
func setSource(_ node: NSNumber, src: NSDictionary) -> Void {
DispatchQueue.main.async {
Expand All @@ -71,7 +71,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

private func setNewSourceDescription(player: THEOplayer, srcDescription: SourceDescription) {
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting new source on TheoPlayer") }
#if canImport(THEOplayerConnectorSideloadedSubtitle)
Expand All @@ -80,12 +80,12 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
player.source = srcDescription
#endif
}

@objc(setABRConfig:abrConfig:)
func setABRConfig(_ node: NSNumber, setABRConfig: NSDictionary) -> Void {
if DEBUG_PLAYER_API { print(ERROR_MESSAGE_PLAYER_ABR_UNSUPPORTED_FEATURE) }
}

@objc(setCurrentTime:time:)
func setCurrentTime(_ node: NSNumber, time: NSNumber) -> Void {
DispatchQueue.main.async {
Expand All @@ -97,7 +97,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setMuted:muted:)
func setMuted(_ node: NSNumber, muted: Bool) -> Void {
DispatchQueue.main.async {
Expand All @@ -110,12 +110,12 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setVolume:volume:)
func setVolume(_ node: NSNumber, volume: NSNumber) -> Void {
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting volume: TheoPlayer does not handle volume changes for iOS. This is handled by the device.") }
}

@objc(setPlaybackRate:playbackRate:)
func setPlaybackRate(_ node: NSNumber, playbackRate: NSNumber) -> Void {
DispatchQueue.main.async {
Expand All @@ -129,7 +129,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setPresentationMode:presentationMode:)
func setPresentationMode(_ node: NSNumber, presentationMode: String) -> Void {
DispatchQueue.main.async {
Expand All @@ -139,7 +139,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setAspectRatio:ratio:)
func setAspectRatio(_ node: NSNumber, ratio: String) -> Void {
DispatchQueue.main.async {
Expand All @@ -153,7 +153,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setPipConfig:pipConfig:)
func setPipConfig(_ node: NSNumber, pipConfig: NSDictionary) -> Void {
DispatchQueue.main.async {
Expand All @@ -163,13 +163,13 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

private func parsePipConfig(configDict: NSDictionary) -> PipConfig {
var pipConfig = PipConfig()
pipConfig.canStartPictureInPictureAutomaticallyFromInline = configDict["startsAutomatically"] as? Bool ?? false
return pipConfig
}

@objc(setBackgroundAudioConfig:backgroundAudioConfig:)
func setBackgroundAudioConfig(_ node: NSNumber, backgroundAudioConfig: NSDictionary) -> Void {
DispatchQueue.main.async {
Expand All @@ -179,13 +179,13 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

private func parseBackgroundAudioConfig(configDict: NSDictionary) -> BackgroundAudioConfig {
var backgroundAudio = BackgroundAudioConfig()
backgroundAudio.enabled = configDict["enabled"] as? Bool ?? false
return backgroundAudio
}

@objc(setSelectedTextTrack:uid:)
func setSelectedTextTrack(_ node: NSNumber, uid: NSNumber) -> Void {
DispatchQueue.main.async {
Expand All @@ -203,12 +203,12 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
textTrack.mode = TextTrackMode.showing
} else if textTrack.mode == TextTrackMode.showing {
textTrack.mode = TextTrackMode.disabled
}
}
}
}
}
}

@objc(setSelectedAudioTrack:uid:)
func setSelectedAudioTrack(_ node: NSNumber, uid: NSNumber) -> Void {
DispatchQueue.main.async {
Expand All @@ -227,7 +227,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setSelectedVideoTrack:uid:)
func setSelectedVideoTrack(_ node: NSNumber, uid: NSNumber) -> Void {
DispatchQueue.main.async {
Expand All @@ -246,13 +246,13 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setTargetVideoQuality:uid:)
func setTargetVideoQuality(_ node: NSNumber, uid: [NSNumber]) -> Void {
if DEBUG_PLAYER_API { print(ERROR_MESSAGE_PLAYER_QUALITY_UNSUPPORTED_FEATURE) }
return
}

@objc(setPreload:type:)
func setPreload(_ node: NSNumber, type: String) -> Void {
DispatchQueue.main.async {
Expand All @@ -266,7 +266,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

@objc(setTextTrackStyle:textTrackStyle:)
func setTextTrackStyle(_ node: NSNumber, textTrackStyle: NSDictionary) -> Void {
DispatchQueue.main.async {
Expand Down Expand Up @@ -306,5 +306,5 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
}
}
}

}
Loading
Loading