vdocipher-rn-bridge 1.7.3 → 1.9.0

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 CHANGED
@@ -1,11 +1,23 @@
1
1
  ## Changelog
2
- ### 1.7.2
2
+ ### 1.9.0
3
+ * Added support for auto resume
4
+ * Bug fixes
5
+
6
+ ### 1.8.1
7
+ * Update VdoCipher android sdk dependency to 1.10.1
8
+
9
+ ### 1.8.0
10
+ * Update VdoCipher android sdk dependency to 1.10.0
11
+ * Fixed release build errors
12
+ * Bug fixes
13
+
14
+ ### 1.7.3
3
15
  * Update VdoCipher android sdk dependency to 1.8.1
4
16
  * Added adb debugging restrictions opt-in
5
17
 
6
18
  ### 1.7.2
7
19
  * Update VdoCipher android sdk dependency to 1.7.3
8
- * Fixed error message for OTP related errors which cannot be retried with same embedInfo
20
+ * Fixed error message for OTP related errors which cannot be re-tried with same embedInfo
9
21
  * Bug fixes
10
22
 
11
23
  ### 1.7.1
package/README.md CHANGED
@@ -143,6 +143,7 @@ forceLowestBitrate | boolean | whether to force lowest bitrate; default false
143
143
  forceHighestSupportedBitrate | boolean | whether to force highest supported bitrate; default false
144
144
  maxVideoBitrateKbps | number | maximum allowed video bitrate in kbps
145
145
  bufferingGoalMs | number | buffering goal in milliseconds, NOT recommended to change this value for most use cases; cannot be set to a value less than 15000
146
+ enableAutoResume | boolean | whether to auto resume from last saved position
146
147
 
147
148
  #### showNativeControls
148
149
 
@@ -1,3 +1,6 @@
1
+ import org.json.JSONObject
2
+ import java.nio.file.Files
3
+ import java.nio.file.Paths
1
4
 
2
5
  buildscript {
3
6
  repositories {
@@ -6,20 +9,28 @@ buildscript {
6
9
  }
7
10
 
8
11
  dependencies {
9
- classpath 'com.android.tools.build:gradle:4.0.1'
12
+ classpath 'com.android.tools.build:gradle:4.2.2'
10
13
  }
11
14
  }
12
15
 
13
16
  apply plugin: 'com.android.library'
14
17
 
18
+ // TODO read from package.json
19
+ // "releaseVersionName" must be the same as "version" in package.json
20
+ // "releaseVersionCode" must increment by 1 with every release
21
+ def releaseVersionName = "1.9.0"
22
+ def releaseVersionCode = 4
23
+
15
24
  android {
16
25
  compileSdkVersion 30
17
26
 
18
27
  defaultConfig {
19
- minSdkVersion 17
28
+ minSdkVersion 18
20
29
  targetSdkVersion 30
21
- versionCode 1
22
- versionName "1.0"
30
+
31
+ // Generate BuildConfig fields for library version info
32
+ buildConfigField "int", "VDO_VERSION_CODE", "${releaseVersionCode}"
33
+ buildConfigField "String", "VDO_VERSION_NAME", "\"${releaseVersionName}\""
23
34
  }
24
35
  lintOptions {
25
36
  abortOnError false
@@ -31,6 +42,39 @@ android {
31
42
  }
32
43
  }
33
44
 
45
+ task verifyVersionNameMatchesWithPackageJson {
46
+ doLast {
47
+ final String versionFromGradleConfig = releaseVersionName
48
+
49
+ File f = project.file("../package.json")
50
+ String packageJsonText = new String(
51
+ Files.readAllBytes(Paths.get(f.toURI())),
52
+ "UTF-8")
53
+ JSONObject packageJsonData = new JSONObject(packageJsonText)
54
+
55
+ final String versionFromPackageJson = packageJsonData.get("version")
56
+
57
+ if (!versionFromGradleConfig.equals(versionFromPackageJson)) {
58
+ throw new IllegalStateException(
59
+ "Version mismatch: version " + versionFromGradleConfig + " from build.gradle " +
60
+ "does not match the version " + versionFromPackageJson + " in package.json." +
61
+ "\nIn android/build.gradle, releaseVersionName must be " +
62
+ "updated to reflect the version in package.json whenever the package.json " +
63
+ "version is updated. Also, releaseVersionCode must be " +
64
+ "incremented by 1 with every release." +
65
+ "\nThis is to ensure the vdocipher " +
66
+ "native android sdk has correct vdocipher react-native sdk version at runtime for " +
67
+ "analytics and other purposes."
68
+ )
69
+ }
70
+ }
71
+ }
72
+
73
+ afterEvaluate {
74
+ assembleDebug.finalizedBy(verifyVersionNameMatchesWithPackageJson)
75
+ assembleRelease.finalizedBy(verifyVersionNameMatchesWithPackageJson)
76
+ }
77
+
34
78
  repositories {
35
79
  google()
36
80
  jcenter()
@@ -42,5 +86,6 @@ repositories {
42
86
 
43
87
  dependencies {
44
88
  compileOnly 'com.facebook.react:react-native:+'
45
- implementation 'com.vdocipher.aegis:vdocipher-android:1.8.1'
89
+ implementation 'androidx.appcompat:appcompat:1.3.1'
90
+ implementation 'com.vdocipher.aegis:vdocipher-android:1.12.0'
46
91
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  <application>
6
6
  <activity android:name=".VdoPlayerActivity"
7
- android:theme="@style/Theme.AppCompat.Light.NoActionBar"
7
+ android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
8
8
  android:screenOrientation="sensorLandscape"
9
9
  android:configChanges="keyboardHidden|orientation|screenSize"/>
10
10
  </application>
@@ -5,18 +5,19 @@ import android.os.Build;
5
5
  import android.util.Log;
6
6
  import android.view.View;
7
7
  import android.widget.FrameLayout;
8
+ import android.content.pm.ActivityInfo;
8
9
 
9
10
  import com.facebook.react.bridge.LifecycleEventListener;
10
11
  import com.facebook.react.uimanager.ThemedReactContext;
11
12
  import com.vdocipher.aegis.media.ErrorDescription;
12
13
  import com.vdocipher.aegis.media.Track;
14
+ import com.vdocipher.aegis.player.PlaybackState;
13
15
  import com.vdocipher.aegis.player.VdoPlayer;
14
- import com.vdocipher.aegis.player.VdoPlayer.PlayerHost;
15
- import com.vdocipher.aegis.player.VdoPlayer.InitializationListener;
16
+ import com.vdocipher.aegis.player.PlayerHost;
17
+ import com.vdocipher.aegis.player.PlayerHost.InitializationListener;
16
18
  import com.vdocipher.aegis.player.VdoPlayer.PlaybackEventListener;
17
- import com.vdocipher.aegis.player.VdoPlayer.VdoInitParams;
19
+ import com.vdocipher.aegis.player.VdoInitParams;
18
20
  import com.vdocipher.aegis.player.VdoPlayerView;
19
- import com.vdocipher.aegis.player.a.f;
20
21
 
21
22
  public class ReactVdoPlayerView extends FrameLayout implements InitializationListener,
22
23
  PlaybackEventListener, LifecycleEventListener, VdoPlayerControlView.FullscreenActionListener {
@@ -37,7 +38,7 @@ public class ReactVdoPlayerView extends FrameLayout implements InitializationLis
37
38
 
38
39
  private VdoInitParams pendingInitParams;
39
40
  private boolean stopped = false;
40
- private Object playbackState = null;
41
+ private PlaybackState playbackState = null;
41
42
 
42
43
  public ReactVdoPlayerView(ThemedReactContext context) {
43
44
  super(context);
@@ -83,7 +84,7 @@ public class ReactVdoPlayerView extends FrameLayout implements InitializationLis
83
84
 
84
85
  public void restorePlayback() {
85
86
  if (stopped && playbackState != null) {
86
- playerView.restore((f)playbackState);
87
+ playerView.restore(playbackState);
87
88
  setKeepScreenOn(true);
88
89
  }
89
90
  stopped = false;
@@ -107,6 +108,7 @@ public class ReactVdoPlayerView extends FrameLayout implements InitializationLis
107
108
  int visibility;
108
109
 
109
110
  if (enterFullscreen) {
111
+ activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
110
112
  if (Build.VERSION.SDK_INT >= 19) {
111
113
  visibility = SYSTEM_UI_FLAG_HIDE_NAVIGATION
112
114
  | SYSTEM_UI_FLAG_IMMERSIVE_STICKY
@@ -117,6 +119,7 @@ public class ReactVdoPlayerView extends FrameLayout implements InitializationLis
117
119
  }
118
120
  decorView.setSystemUiVisibility(visibility);
119
121
  } else {
122
+ activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
120
123
  visibility = SYSTEM_UI_FLAG_VISIBLE;
121
124
  decorView.setSystemUiVisibility(visibility);
122
125
  }
@@ -212,7 +215,7 @@ public class ReactVdoPlayerView extends FrameLayout implements InitializationLis
212
215
  // InitializationListener impl
213
216
 
214
217
  @Override
215
- public void onInitializationSuccess(VdoPlayer.PlayerHost playerHost, VdoPlayer vdoPlayer, boolean restored) {
218
+ public void onInitializationSuccess(PlayerHost playerHost, VdoPlayer vdoPlayer, boolean restored) {
216
219
  Log.d(TAG, "init success");
217
220
  this.vdoPlayer = vdoPlayer;
218
221
  vdoPlayer.addPlaybackEventListener(this);
@@ -7,7 +7,7 @@ import com.facebook.react.common.MapBuilder;
7
7
  import com.facebook.react.uimanager.ThemedReactContext;
8
8
  import com.facebook.react.uimanager.ViewGroupManager;
9
9
  import com.facebook.react.uimanager.annotations.ReactProp;
10
- import com.vdocipher.aegis.player.VdoPlayer.VdoInitParams;
10
+ import com.vdocipher.aegis.player.VdoInitParams;
11
11
 
12
12
  import java.util.Map;
13
13
 
@@ -53,6 +53,7 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
53
53
  if (embedInfo != null) {
54
54
  boolean offline = embedInfo.hasKey("offline") && embedInfo.getBoolean("offline");
55
55
  final VdoInitParams initParams;
56
+ boolean enableAutoResume = embedInfo.hasKey("enableAutoResume") && embedInfo.getBoolean("enableAutoResume");
56
57
 
57
58
  if (offline) {
58
59
  String mediaId = embedInfo.hasKey("mediaId") ? embedInfo.getString("mediaId") : null;
@@ -64,6 +65,10 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
64
65
  VdoInitParams.Builder builder = new VdoInitParams.Builder()
65
66
  .setOfflinePlayback(mediaId)
66
67
  .setAllowAdbDebugging(allowAdbDebugging);
68
+
69
+ if (enableAutoResume) {
70
+ builder.enableAutoResume();
71
+ }
67
72
  if (safetyNetApiKey != null) {
68
73
  builder.setSafetyNetApiKey(safetyNetApiKey);
69
74
  }
@@ -93,6 +98,10 @@ public class ReactVdoPlayerViewManager extends ViewGroupManager<ReactVdoPlayerVi
93
98
  .setForceHighestSupportedBitrate(forceHighestSupportedBitrate)
94
99
  .setMaxVideoBitrateKbps(maxVideoBitrateKbps);
95
100
  //.setPreferredCaptionsLanguage(embedInfo.getString("lang??"))
101
+
102
+ if (enableAutoResume) {
103
+ builder.enableAutoResume();
104
+ }
96
105
  if (bufferingGoalMs > 0) {
97
106
  builder.setBufferingGoalMs(bufferingGoalMs);
98
107
  }
@@ -59,8 +59,6 @@ public class Utils {
59
59
  return "video";
60
60
  case Track.TYPE_CAPTIONS:
61
61
  return "captions";
62
- case Track.TYPE_COMBINED:
63
- return "combined";
64
62
  default:
65
63
  return "unknown";
66
64
  }
@@ -11,7 +11,7 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
11
11
  import com.vdocipher.aegis.media.ErrorDescription;
12
12
  import com.vdocipher.aegis.media.MediaInfo;
13
13
  import com.vdocipher.aegis.media.Track;
14
- import com.vdocipher.aegis.player.VdoPlayer.VdoInitParams;
14
+ import com.vdocipher.aegis.player.VdoInitParams;
15
15
  import static com.vdocipher.rnbridge.Utils.*;
16
16
 
17
17
  import java.lang.annotation.Retention;
@@ -16,9 +16,11 @@ import android.widget.Toast;
16
16
  import com.vdocipher.aegis.media.ErrorDescription;
17
17
  import com.vdocipher.aegis.media.Track;
18
18
  import com.vdocipher.aegis.player.VdoPlayer;
19
+ import com.vdocipher.aegis.player.VdoInitParams;
20
+ import com.vdocipher.aegis.player.PlayerHost;
19
21
  import com.vdocipher.aegis.player.VdoPlayerSupportFragment;
20
22
 
21
- public class VdoPlayerActivity extends AppCompatActivity implements VdoPlayer.InitializationListener {
23
+ public class VdoPlayerActivity extends AppCompatActivity implements PlayerHost.InitializationListener {
22
24
 
23
25
  private static final String TAG = "VdoPlayerActivity";
24
26
 
@@ -31,9 +33,9 @@ public class VdoPlayerActivity extends AppCompatActivity implements VdoPlayer.In
31
33
 
32
34
  private int currentOrientation;
33
35
 
34
- private VdoPlayer.VdoInitParams vdoParams;
36
+ private VdoInitParams vdoParams;
35
37
 
36
- public static Intent getStartIntent(Context context, VdoPlayer.VdoInitParams vdoParams) {
38
+ public static Intent getStartIntent(Context context, VdoInitParams vdoParams) {
37
39
  Intent intent = new Intent(context, VdoPlayerActivity.class);
38
40
  intent.putExtra(EXTRA_VDOPARAMS, vdoParams);
39
41
  return intent;
@@ -130,7 +132,7 @@ public class VdoPlayerActivity extends AppCompatActivity implements VdoPlayer.In
130
132
  }
131
133
 
132
134
  @Override
133
- public void onInitializationSuccess(VdoPlayer.PlayerHost playerHost, VdoPlayer player, boolean wasRestored) {
135
+ public void onInitializationSuccess(PlayerHost playerHost, VdoPlayer player, boolean wasRestored) {
134
136
  Log.i(TAG, "onInitializationSuccess");
135
137
  log("onInitializationSuccess");
136
138
  this.player = player;
@@ -147,7 +149,7 @@ public class VdoPlayerActivity extends AppCompatActivity implements VdoPlayer.In
147
149
  }
148
150
 
149
151
  @Override
150
- public void onInitializationFailure(VdoPlayer.PlayerHost playerHost, ErrorDescription errorDescription) {
152
+ public void onInitializationFailure(PlayerHost playerHost, ErrorDescription errorDescription) {
151
153
  String msg = "onInitializationFailure: errorCode = " + errorDescription.errorCode + ": " + errorDescription.errorMsg;
152
154
  log(msg);
153
155
  Log.e(TAG, msg);
@@ -180,32 +182,32 @@ public class VdoPlayerActivity extends AppCompatActivity implements VdoPlayer.In
180
182
  }
181
183
 
182
184
  @Override
183
- public void onLoading(VdoPlayer.VdoInitParams vdoInitParams) {
185
+ public void onLoading(VdoInitParams vdoInitParams) {
184
186
  log("onLoading");
185
187
  }
186
188
 
187
189
  @Override
188
- public void onLoadError(VdoPlayer.VdoInitParams vdoInitParams, ErrorDescription errorDescription) {
190
+ public void onLoadError(VdoInitParams vdoInitParams, ErrorDescription errorDescription) {
189
191
  String err = "onLoadError code: " + errorDescription.errorCode;
190
192
  Log.e(TAG, err);
191
193
  log(err);
192
194
  }
193
195
 
194
196
  @Override
195
- public void onLoaded(VdoPlayer.VdoInitParams vdoInitParams) {
197
+ public void onLoaded(VdoInitParams vdoInitParams) {
196
198
  log("onLoaded");
197
199
  player.setPlayWhenReady(true);
198
200
  }
199
201
 
200
202
  @Override
201
- public void onError(VdoPlayer.VdoInitParams vdoParams, ErrorDescription errorDescription) {
203
+ public void onError(VdoInitParams vdoParams, ErrorDescription errorDescription) {
202
204
  String err = "onError code " + errorDescription.errorCode + ": " + errorDescription.errorMsg;
203
205
  Log.e(TAG, err);
204
206
  log(err);
205
207
  }
206
208
 
207
209
  @Override
208
- public void onMediaEnded(VdoPlayer.VdoInitParams vdoInitParams) {
210
+ public void onMediaEnded(VdoInitParams vdoInitParams) {
209
211
  log("onMediaEnded");
210
212
  }
211
213
  };
@@ -18,6 +18,7 @@ import android.widget.TextView;
18
18
  import com.vdocipher.aegis.media.ErrorDescription;
19
19
  import com.vdocipher.aegis.media.Track;
20
20
  import com.vdocipher.aegis.player.VdoPlayer;
21
+ import com.vdocipher.aegis.player.VdoInitParams;
21
22
 
22
23
  import java.math.RoundingMode;
23
24
  import java.text.DecimalFormat;
@@ -80,7 +81,7 @@ public class VdoPlayerControlView extends FrameLayout {
80
81
 
81
82
  private VdoPlayer player;
82
83
  private UiListener uiListener;
83
- private VdoPlayer.VdoInitParams lastErrorParams;
84
+ private VdoInitParams lastErrorParams;
84
85
  private boolean shouldRetryWithLastParams;
85
86
  private FullscreenActionListener fullscreenActionListener;
86
87
  private ControllerVisibilityListener visibilityListener;
@@ -534,31 +535,31 @@ public class VdoPlayerControlView extends FrameLayout {
534
535
  }
535
536
 
536
537
  @Override
537
- public void onLoading(VdoPlayer.VdoInitParams vdoInitParams) {
538
+ public void onLoading(VdoInitParams vdoInitParams) {
538
539
  updateLoader(true);
539
540
  }
540
541
 
541
542
  @Override
542
- public void onLoaded(VdoPlayer.VdoInitParams vdoInitParams) {
543
+ public void onLoaded(VdoInitParams vdoInitParams) {
543
544
  durationView.setText(String.valueOf(Utils.digitalClockTime((int)player.getDuration())));
544
545
  seekBar.setMax((int)player.getDuration());
545
546
  updateSpeedControlButton();
546
547
  }
547
548
 
548
549
  @Override
549
- public void onLoadError(VdoPlayer.VdoInitParams vdoParams, ErrorDescription errorDescription) {
550
+ public void onLoadError(VdoInitParams vdoParams, ErrorDescription errorDescription) {
550
551
  lastErrorParams = vdoParams;
551
552
  shouldRetryWithLastParams = !ERROR_CODES_FOR_INVALID_OTP.contains(errorDescription.errorCode);
552
553
  showError(errorDescription);
553
554
  }
554
555
 
555
556
  @Override
556
- public void onMediaEnded(VdoPlayer.VdoInitParams vdoInitParams) {
557
+ public void onMediaEnded(VdoInitParams vdoInitParams) {
557
558
  // todo
558
559
  }
559
560
 
560
561
  @Override
561
- public void onError(VdoPlayer.VdoInitParams vdoParams, ErrorDescription errorDescription) {
562
+ public void onError(VdoInitParams vdoParams, ErrorDescription errorDescription) {
562
563
  lastErrorParams = vdoParams;
563
564
  shouldRetryWithLastParams = !ERROR_CODES_FOR_INVALID_OTP.contains(errorDescription.errorCode);
564
565
  showError(errorDescription);
@@ -7,7 +7,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
7
7
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
8
  import com.facebook.react.bridge.ReactMethod;
9
9
  import com.facebook.react.bridge.ReadableMap;
10
- import com.vdocipher.aegis.player.VdoPlayer.VdoInitParams;
10
+ import com.vdocipher.aegis.player.VdoInitParams;
11
11
 
12
12
  import static com.vdocipher.rnbridge.Utils.getTechOverride;
13
13
 
@@ -40,6 +40,7 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
40
40
  } else {
41
41
  boolean offline = embedInfo.hasKey("offline") && embedInfo.getBoolean("offline");
42
42
  final VdoInitParams vdoParams;
43
+ boolean enableAutoResume = embedInfo.hasKey("enableAutoResume") && embedInfo.getBoolean("enableAutoResume");
43
44
 
44
45
  if (offline) {
45
46
  String mediaId = embedInfo.hasKey("mediaId") ? embedInfo.getString("mediaId") : null;
@@ -47,10 +48,15 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
47
48
  embedInfo.getString("safetyNetApiKey") : null;
48
49
  boolean allowAdbDebugging = !embedInfo.hasKey("allowAdbDebugging") ||
49
50
  embedInfo.getBoolean("allowAdbDebugging");
51
+
50
52
 
51
53
  VdoInitParams.Builder builder = new VdoInitParams.Builder()
52
54
  .setOfflinePlayback(mediaId)
53
55
  .setAllowAdbDebugging(allowAdbDebugging);
56
+
57
+ if (enableAutoResume) {
58
+ builder.enableAutoResume();
59
+ }
54
60
  if (safetyNetApiKey != null) {
55
61
  builder.setSafetyNetApiKey(safetyNetApiKey);
56
62
  }
@@ -80,6 +86,10 @@ public class VdocipherRnBridgeModule extends ReactContextBaseJavaModule {
80
86
  .setForceHighestSupportedBitrate(forceHighestSupportedBitrate)
81
87
  .setMaxVideoBitrateKbps(maxVideoBitrateKbps)
82
88
  .setPreferredCaptionsLanguage("en");
89
+
90
+ if (enableAutoResume) {
91
+ builder.enableAutoResume();
92
+ }
83
93
  if (bufferingGoalMs > 0) {
84
94
  builder.setBufferingGoalMs(bufferingGoalMs);
85
95
  }
package/ios/.DS_Store ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vdocipher-rn-bridge",
3
- "version": "1.7.3",
3
+ "version": "1.9.0",
4
4
  "description": "React native bridge library that delegates to vdocipher native android SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -15,7 +15,7 @@
15
15
  "author": "",
16
16
  "license": "",
17
17
  "peerDependencies": {
18
- "react-native": "^0.41.2"
18
+ "react-native": "^0.68"
19
19
  },
20
20
  "dependencies": {
21
21
  "prop-types": "^15.6.2"