Skip to content

Commit

Permalink
chore: lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Jan 9, 2025
1 parent d6bdeb5 commit d3d1043
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 28 deletions.
6 changes: 2 additions & 4 deletions android/src/main/java/com/brentvatne/exoplayer/DRMManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class DRMManager(private val dataSourceFactory: HttpDataSource.Factory) : DRMMan
private var hasDrmFailed = false

@Throws(UnsupportedDrmException::class)
override fun buildDrmSessionManager(uuid: UUID, drmProps: DRMProps): DrmSessionManager? {
return buildDrmSessionManager(uuid, drmProps, 0)
}
override fun buildDrmSessionManager(uuid: UUID, drmProps: DRMProps): DrmSessionManager? = buildDrmSessionManager(uuid, drmProps, 0)

@Throws(UnsupportedDrmException::class)
private fun buildDrmSessionManager(uuid: UUID, drmProps: DRMProps, retryCount: Int = 0): DrmSessionManager? {
Expand Down Expand Up @@ -56,4 +54,4 @@ class DRMManager(private val dataSourceFactory: HttpDataSource.Factory) : DRMMan
throw UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME, ex)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ interface DRMManagerSpec {
*/
@Throws(UnsupportedDrmException::class)
fun buildDrmSessionManager(uuid: UUID, drmProps: DRMProps): DrmSessionManager?
}
}
4 changes: 1 addition & 3 deletions android/src/main/java/com/brentvatne/react/RNVPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ interface RNVPlugin {
* Only one plugin can provide DRM manager at a time
* @return DRMManagerSpec implementation if plugin wants to handle DRM, null otherwise
*/
fun getDRMManager(): DRMManagerSpec? {
return null
}
fun getDRMManager(): DRMManagerSpec? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ReactNativeVideoManager : RNVPlugin {
*/
fun registerPlugin(plugin: RNVPlugin) {
pluginList.add(plugin)

// Check if plugin provides DRM manager
plugin.getDRMManager()?.let { drmManager ->
if (customDRMManager != null) {
Expand All @@ -65,7 +65,7 @@ class ReactNativeVideoManager : RNVPlugin {
*/
fun unregisterPlugin(plugin: RNVPlugin) {
pluginList.remove(plugin)

// If this plugin provided the DRM manager, remove it
if (plugin.getDRMManager() === customDRMManager) {
customDRMManager = null
Expand All @@ -80,7 +80,5 @@ class ReactNativeVideoManager : RNVPlugin {
pluginList.forEach { it.onInstanceRemoved(id, player) }
}

override fun getDRMManager(): DRMManagerSpec? {
return customDRMManager
}
override fun getDRMManager(): DRMManagerSpec? = customDRMManager
}
4 changes: 2 additions & 2 deletions ios/Video/Features/DRMManagerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public protocol DRMManagerSpec: NSObject, AVContentKeySessionDelegate {
onVideoError: RCTDirectEventBlock?,
onGetLicense: RCTDirectEventBlock?
)

func handleContentKeyRequest(keyRequest: AVContentKeyRequest)
func finishProcessingContentKeyRequest(keyRequest: AVContentKeyRequest, license: Data) throws
func handleError(_ error: Error, for keyRequest: AVContentKeyRequest)
func setJSLicenseResult(license: String, licenseUrl: String)
func setJSLicenseError(error: String, licenseUrl: String)
}
}
13 changes: 4 additions & 9 deletions ios/Video/RCTVideoManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,9 @@ @interface RCT_EXTERN_MODULE (RCTVideoManager, RCTViewManager)
RCT_EXTERN_METHOD(exitPictureInPictureCmd : (nonnull NSNumber*)reactTag)
RCT_EXTERN_METHOD(setSourceCmd : (nonnull NSNumber*)reactTag source : (NSDictionary*)source)

RCT_EXTERN_METHOD(save
: (nonnull NSNumber*)reactTag options
: (NSDictionary*)options resolve
: (RCTPromiseResolveBlock)resolve reject
: (RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(getCurrentPosition
: (nonnull NSNumber*)reactTag resolve
: (RCTPromiseResolveBlock)resolve reject
: (RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(save : (nonnull NSNumber*)reactTag options : (NSDictionary*)options resolve : (RCTPromiseResolveBlock)
resolve reject : (RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(getCurrentPosition : (nonnull NSNumber*)reactTag resolve : (RCTPromiseResolveBlock)
resolve reject : (RCTPromiseRejectBlock)reject)

@end
2 changes: 1 addition & 1 deletion ios/Video/RNVPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public protocol RNVPlugin {
* @param player: the player to release
*/
func onInstanceRemoved(id: String, player: Any)

/**
* Optional function that allows plugin to provide custom DRM manager
* Only one plugin can provide DRM manager at a time
Expand Down
6 changes: 3 additions & 3 deletions ios/Video/ReactNativeVideoManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ReactNativeVideoManager: RNVPlugin {
*/
public func registerPlugin(plugin: RNVPlugin) {
pluginList.append(plugin)

// Check if plugin provides DRM manager
if let drmManager = plugin.getDRMManager() {
if customDRMManager != nil {
Expand All @@ -57,11 +57,11 @@ public class ReactNativeVideoManager: RNVPlugin {
public func onInstanceRemoved(id: String, player: Any) {
pluginList.forEach { it in it.onInstanceRemoved(id: id, player: player) }
}

public func getDRMManager() -> DRMManagerSpec.Type? {
return nil
}

/**
* Creates a DRM manager instance
* If a custom DRM manager is registered through a plugin, it will be used
Expand Down

0 comments on commit d3d1043

Please sign in to comment.