Skip to content

Commit

Permalink
Merge branch 'release/0.2.45'
Browse files Browse the repository at this point in the history
  • Loading branch information
chaimPaneth committed Mar 13, 2024
2 parents 023cf10 + d8f3bf1 commit 0555f24
Show file tree
Hide file tree
Showing 13 changed files with 6,708 additions and 3,287 deletions.
8 changes: 4 additions & 4 deletions Example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

buildscript {
ext {
buildToolsVersion = "33.0.0"
buildToolsVersion = "34.0.0"
minSdkVersion = 24
compileSdkVersion = 33
targetSdkVersion = 33
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "20.1.5948944"
kotlinVersion = "1.6.21"
}
Expand All @@ -14,7 +14,7 @@ buildscript {
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:7.2.1')
classpath('com.android.tools.build:gradle:7.2.2')
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
Expand Down
17 changes: 11 additions & 6 deletions Example/ios/RNJWPlayer/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
#import "Orientation.h"
#import "RNFSManager.h"
#import "RNBootSplash.h"
#import <GoogleCast/GoogleCast.h>

static NSString *const kReceiverAppID = @"RNJWPlayer";
#if USE_GOOGLE_CAST
#import <GoogleCast/GoogleCast.h>

static NSString *const kReceiverAppID = @"RNJWPlayer";
#endif

#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
Expand All @@ -40,10 +43,12 @@ @implementation AppDelegate

-(void)initApis:(UIApplication *)application launchOptions:(NSDictionary *)launchOptions
{
GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc]
initWithApplicationID:kReceiverAppID];
GCKCastOptions *options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria];
[GCKCastContext setSharedInstanceWithOptions:options];
#if USE_GOOGLE_CAST
GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc]
initWithApplicationID:kReceiverAppID];
GCKCastOptions *options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria];
[GCKCastContext setSharedInstanceWithOptions:options];
#endif
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Expand Down
4,438 changes: 1,917 additions & 2,521 deletions Example/package-lock.json

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"postinstall": "rm -rf ./node_modules/react-native-jw-media-player/Example ./node_modules/react-native-jw-media-player/images ./node_modules/react-native-jw-media-player/node_modules ./node_modules/react-native-jw-media-player/yarn.lock patch-package",
"prepare": "patch-package"
"lint": "eslint ."
},
"dependencies": {
"@react-navigation/native": "6.1.7",
Expand All @@ -20,7 +18,7 @@
"react-native-device-info": "9.0.2",
"react-native-fs": "2.16.6",
"react-native-gesture-handler": "2.12.1",
"react-native-jw-media-player": "../../react-native-jw-media-player",
"react-native-jw-media-player": "0.2.45",
"react-native-orientation-locker": "1.5.0",
"react-native-safe-area-context": "4.7.2",
"react-native-screens": "3.25.0",
Expand All @@ -35,8 +33,6 @@
"eslint": "^7.31.0",
"jest": "^27.0.6",
"metro-react-native-babel-preset": "^0.72.4",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"react-native-dotenv": "3.3.1",
"react-test-renderer": "18.1.0"
},
Expand Down
12 changes: 0 additions & 12 deletions Example/patches/react-native+0.70.14.patch

This file was deleted.

5,406 changes: 4,713 additions & 693 deletions Example/yarn.lock

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ allprojects {
}
}

def jwPlayerVersion = "4.15.1"
def exoplayerVersion = "2.18.7"
def jwPlayerVersion = "4.16.2"
def exoplayerVersion = "1.3.0"

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'com.google.code.gson:gson:2.10'

// JWPlayer SDK
implementation "com.jwplayer:jwplayer-core:${safeExtGet('jwPlayerVersion', jwPlayerVersion)}"
Expand All @@ -97,18 +97,22 @@ dependencies {
}

// ExoPlayer dependencies
implementation "com.google.android.exoplayer:exoplayer-core:${safeExtGet('exoplayerVersion', exoplayerVersion)}"
implementation "com.google.android.exoplayer:exoplayer-dash:${safeExtGet('exoplayerVersion', exoplayerVersion)}"
implementation "com.google.android.exoplayer:exoplayer-hls:${safeExtGet('exoplayerVersion', exoplayerVersion)}"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:${safeExtGet('exoplayerVersion', exoplayerVersion)}"
implementation "com.google.android.exoplayer:exoplayer-ui:${safeExtGet('exoplayerVersion', exoplayerVersion)}"

// JW Player Native UI dependencies
implementation "androidx.media3:media3-common:$exoplayerVersion"
implementation "androidx.media3:media3-extractor:$exoplayerVersion"
implementation "androidx.media3:media3-exoplayer:$exoplayerVersion"
implementation "androidx.media3:media3-exoplayer-dash:$exoplayerVersion"
implementation "androidx.media3:media3-exoplayer-hls:$exoplayerVersion"
implementation "androidx.media3:media3-exoplayer-smoothstreaming:$exoplayerVersion"
implementation "androidx.media3:media3-ui:$exoplayerVersion"

// JWP Native UI dependencies
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.mediarouter:mediarouter:1.4.0'
implementation 'androidx.media:media:1.6.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
}

2 changes: 1 addition & 1 deletion android/src/main/java/com/appgoalz/rnjwplayer/Util.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.appgoalz.rnjwplayer;

import static com.google.android.exoplayer2.util.Util.toByteArray;
import static androidx.media3.common.util.Util.toByteArray;

import android.util.Patterns;
import android.webkit.URLUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import android.os.Parcel;
import android.text.TextUtils;

import com.google.android.exoplayer2.drm.ExoMediaDrm;
import androidx.annotation.OptIn;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.exoplayer.drm.ExoMediaDrm;

import com.jwplayer.pub.api.media.drm.MediaDrmCallback;

import java.io.IOException;
import java.util.UUID;

@TargetApi(18)
public class WidevineCallback implements MediaDrmCallback {

private final String defaultUri;
Expand All @@ -35,13 +37,13 @@ public WidevineCallback[] newArray(int size) {
}
};

@Override
@OptIn(markerClass = UnstableApi.class) @Override
public byte[] executeProvisionRequest(UUID uuid, ExoMediaDrm.ProvisionRequest request) throws IOException {
String url = request.getDefaultUrl() + "&signedRequest=" + new String(request.getData());
return Util.executePost(url, null, null);
}

@Override
@OptIn(markerClass = UnstableApi.class) @Override
public byte[] executeKeyRequest(UUID uuid, ExoMediaDrm.KeyRequest request) throws IOException {
String url = request.getLicenseServerUrl();
if (TextUtils.isEmpty(url)) {
Expand Down
14 changes: 9 additions & 5 deletions ios/RNJWPlayer/RNJWPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import AVFoundation
import AVKit
import MediaPlayer
import React
import GoogleCast
import JWPlayerKit

#if USE_GOOGLE_CAST
import GoogleCast
#endif

class RNJWPlayerView : UIView, JWPlayerDelegate, JWPlayerStateDelegate, JWAdDelegate, JWCastDelegate, JWAVDelegate, JWPlayerViewDelegate, JWPlayerViewControllerDelegate, JWDRMContentKeyDataSource, AVPictureInPictureControllerDelegate {

// MARK: - RNJWPlayer allocation
Expand Down Expand Up @@ -1041,14 +1044,14 @@ class RNJWPlayerView : UIView, JWPlayerDelegate, JWPlayerStateDelegate, JWAdDele
func playerViewController(_ controller: JWPlayerViewController, relatedItemBeganPlaying item: JWPlayerItem, atIndex index: Int, withMethod method: JWRelatedMethod) {

}

// MARK: Time events

func onAdTimeEvent(time:JWTimeData) {
override func onAdTimeEvent(_ time:JWTimeData) {
self.onAdTime?(["position": time.position, "duration": time.duration])
}

func onMediaTimeEvent(time:JWTimeData) {
override func onMediaTimeEvent(_ time:JWTimeData) {
self.onTime?(["position": time.position, "duration": time.duration])
}

Expand Down Expand Up @@ -1356,7 +1359,7 @@ class RNJWPlayerView : UIView, JWPlayerDelegate, JWPlayerStateDelegate, JWAdDele
}

// pragma Mark - Casting methods

#if USE_GOOGLE_CAST
func setUpCastController() {
if (playerView != nil) && playerView.player as! Bool && (castController == nil) {
castController = JWCastController(player:playerView.player)
Expand Down Expand Up @@ -1500,6 +1503,7 @@ class RNJWPlayerView : UIView, JWPlayerDelegate, JWPlayerStateDelegate, JWAdDele
func castController(_ controller: JWCastController, disconnectedWithError error: (Error)?) {
self.onDisconnectedFromCastingDevice?(["error": error as Any])
}
#endif

// MARK: - JWPlayer AV Delegate

Expand Down
Loading

0 comments on commit 0555f24

Please sign in to comment.