react-native-theoplayer 11.7.0 → 11.8.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +2 -2
  3. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  4. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  5. package/android/gradlew +176 -110
  6. package/android/gradlew.bat +23 -18
  7. package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +17 -5
  8. package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +61 -7
  9. package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +12 -5
  10. package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +3 -1
  11. package/android/src/main/java/com/theoplayer/theolive/EndpointAdapter.kt +33 -0
  12. package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +39 -9
  13. package/ios/contentprotection/THEOplayerRCTContentProtectionAggregator.swift +15 -11
  14. package/ios/contentprotection/THEOplayerRCTProxyContentProtectionIntegration.swift +12 -7
  15. package/ios/theolive/THEOplayerRCTTHEOliveEventAdapter.swift +21 -0
  16. package/lib/commonjs/api/player/PlayerEventMap.js +1 -1
  17. package/lib/commonjs/internal/adapter/WebEventForwarder.js +61 -10
  18. package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
  19. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +38 -12
  20. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
  21. package/lib/commonjs/manifest.json +1 -1
  22. package/lib/commonjs/plugins/typedoc-platform-icons/package-lock.json +200 -58
  23. package/lib/commonjs/plugins/typedoc-platform-icons/package.json +1 -1
  24. package/lib/commonjs/plugins/typedoc-platform-icons/tsconfig.json +2 -1
  25. package/lib/module/api/player/PlayerEventMap.js +1 -1
  26. package/lib/module/internal/adapter/WebEventForwarder.js +61 -10
  27. package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
  28. package/lib/module/internal/drm/ContentProtectionRegistry.js +38 -12
  29. package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
  30. package/lib/module/manifest.json +1 -1
  31. package/lib/module/plugins/typedoc-platform-icons/package-lock.json +200 -58
  32. package/lib/module/plugins/typedoc-platform-icons/package.json +1 -1
  33. package/lib/module/plugins/typedoc-platform-icons/tsconfig.json +2 -1
  34. package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts +2 -0
  35. package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts.map +1 -0
  36. package/lib/typescript/api/error/ChromecastError.d.ts +2 -2
  37. package/lib/typescript/api/player/PlayerEventMap.d.ts +1 -1
  38. package/lib/typescript/api/theoads/interstitial/Interstitial.d.ts +1 -1
  39. package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts +23 -5
  40. package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts.map +1 -1
  41. package/lib/typescript/api/theolive/WebrtcOptions.d.ts +1 -1
  42. package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +3 -0
  43. package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
  44. package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts +2 -2
  45. package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts.map +1 -1
  46. package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts +3 -1
  47. package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts.map +1 -1
  48. package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts +5 -0
  49. package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts.map +1 -1
  50. package/package.json +5 -6
  51. package/react-native-theoplayer.podspec +6 -6
  52. package/src/__tests__/ContentProtectionRegistry.test.ts +239 -0
  53. package/src/api/error/ChromecastError.ts +2 -2
  54. package/src/api/player/PlayerEventMap.ts +1 -1
  55. package/src/api/theoads/interstitial/Interstitial.ts +1 -1
  56. package/src/api/theolive/TheoLiveEndpoint.ts +24 -5
  57. package/src/api/theolive/WebrtcOptions.ts +1 -1
  58. package/src/internal/adapter/WebEventForwarder.ts +69 -10
  59. package/src/internal/drm/ContentProtectionRegistry.ts +35 -17
  60. package/src/internal/drm/NativeContentProtectionEvent.ts +5 -0
  61. package/src/manifest.json +1 -1
  62. package/src/plugins/typedoc-platform-icons/package-lock.json +200 -58
  63. package/src/plugins/typedoc-platform-icons/package.json +1 -1
  64. package/src/plugins/typedoc-platform-icons/tsconfig.json +2 -1
  65. package/lib/typescript/plugins/expo/Common.d.ts +0 -13
  66. package/lib/typescript/plugins/expo/Common.d.ts.map +0 -1
  67. package/lib/typescript/plugins/expo/withCustomPod.d.ts +0 -2
  68. package/lib/typescript/plugins/expo/withCustomPod.d.ts.map +0 -1
  69. package/lib/typescript/plugins/expo/withTHEOplayer.d.ts +0 -4
  70. package/lib/typescript/plugins/expo/withTHEOplayer.d.ts.map +0 -1
  71. package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts +0 -4
  72. package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts.map +0 -1
  73. package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts +0 -4
  74. package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts.map +0 -1
  75. package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts +0 -3
  76. package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [11.8.0] - 18-10-21
9
+
10
+ ### Added
11
+
12
+ - Added the `src`, `srcType`, `provider` and `adSystem` properties to the THEOlive `endpoint` object of the `endpointloaded` event on all platforms.
13
+ - Added the `webrtc` playout delay options to `millicastSrc` on Android.
14
+
15
+ ### Changed
16
+
17
+ - Raised the minimum supported THEOplayer SDK version to 11.14.0 on all platforms.
18
+
19
+ ### Fixed
20
+
21
+ - Fixed an issue where re-registering a content protection integration for the same key system kept the previously registered factory active, causing stale DRM integrations to be used for subsequent sources.
22
+ - Fixed an issue on iOS and Android where certificate and license requests from multiple concurrently playing DRM-protected sources could be processed by the wrong content protection integration, or bypass it entirely, causing license acquisition to fail.
23
+
8
24
  ## [11.7.0] - 18-09-26
9
25
 
10
26
  ### Added
@@ -19,6 +35,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
19
35
  - Fixed an issue on Android where destroying the player during a pending `MediaPlaybackService` bind could cause a crash.
20
36
  - Fixed an issue on Android where the player could remain black when its view was attached after React Native had already assigned the layout.
21
37
  - Fixed an issue where `player.paused` remained `true` between the `play` and `playing` events.
38
+ - Fixed an issue on Web and iOS Safari where cues already present when a text track was added, including daterange cues, did not produce `addcue` player events.
39
+ - Fixed an issue where text and media track event listeners were not actually removed when a track was removed.
22
40
 
23
41
  ### Changed
24
42
 
@@ -126,8 +126,8 @@ repositories {
126
126
  mavenLocal()
127
127
  }
128
128
 
129
- // The minimum supported THEOplayer version is 11.5.0
130
- def theoVersion = safeExtGet('THEOplayer_sdk', '[11.5.0, 12.0.0)')
129
+ // The minimum supported THEOplayer version is 11.14.0
130
+ def theoVersion = safeExtGet('THEOplayer_sdk', '[11.14.0, 12.0.0)')
131
131
  def theoMediaSessionVersion = safeExtGet('THEOplayer_mediasession', '[11.0.0, 12.0.0)')
132
132
  def theoAdsWrapperVersion = "11.0.0"
133
133
  def coroutinesVersion = safeExtGet('coroutinesVersion', '1.10.2')
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.6-bin.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
package/android/gradlew CHANGED
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env sh
1
+ #!/bin/sh
2
2
 
3
3
  #
4
- # Copyright 2015 the original author or authors.
4
+ # Copyright © 2015-2021 the original authors.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -15,81 +15,115 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
18
20
 
19
21
  ##############################################################################
20
- ##
21
- ## Gradle start up script for UN*X
22
- ##
22
+ #
23
+ # Gradle start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh Gradle
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
23
65
  ##############################################################################
24
66
 
25
67
  # Attempt to set APP_HOME
68
+
26
69
  # Resolve links: $0 may be a link
27
- PRG="$0"
28
- # Need this for relative symlinks.
29
- while [ -h "$PRG" ] ; do
30
- ls=`ls -ld "$PRG"`
31
- link=`expr "$ls" : '.*-> \(.*\)$'`
32
- if expr "$link" : '/.*' > /dev/null; then
33
- PRG="$link"
34
- else
35
- PRG=`dirname "$PRG"`"/$link"
36
- fi
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
37
83
  done
38
- SAVED="`pwd`"
39
- cd "`dirname \"$PRG\"`/" >/dev/null
40
- APP_HOME="`pwd -P`"
41
- cd "$SAVED" >/dev/null
42
84
 
43
- APP_NAME="Gradle"
44
- APP_BASE_NAME=`basename "$0"`
45
-
46
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
48
90
 
49
91
  # Use the maximum available, or set MAX_FD != -1 to use that value.
50
- MAX_FD="maximum"
92
+ MAX_FD=maximum
51
93
 
52
94
  warn () {
53
95
  echo "$*"
54
- }
96
+ } >&2
55
97
 
56
98
  die () {
57
99
  echo
58
100
  echo "$*"
59
101
  echo
60
102
  exit 1
61
- }
103
+ } >&2
62
104
 
63
105
  # OS specific support (must be 'true' or 'false').
64
106
  cygwin=false
65
107
  msys=false
66
108
  darwin=false
67
109
  nonstop=false
68
- case "`uname`" in
69
- CYGWIN* )
70
- cygwin=true
71
- ;;
72
- Darwin* )
73
- darwin=true
74
- ;;
75
- MINGW* )
76
- msys=true
77
- ;;
78
- NONSTOP* )
79
- nonstop=true
80
- ;;
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
81
115
  esac
82
116
 
83
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117
+ CLASSPATH="\\\"\\\""
84
118
 
85
119
 
86
120
  # Determine the Java command to use to start the JVM.
87
121
  if [ -n "$JAVA_HOME" ] ; then
88
122
  if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
123
  # IBM's JDK on AIX uses strange locations for the executables
90
- JAVACMD="$JAVA_HOME/jre/sh/java"
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
91
125
  else
92
- JAVACMD="$JAVA_HOME/bin/java"
126
+ JAVACMD=$JAVA_HOME/bin/java
93
127
  fi
94
128
  if [ ! -x "$JAVACMD" ] ; then
95
129
  die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,88 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
98
132
  location of your Java installation."
99
133
  fi
100
134
  else
101
- JAVACMD="java"
102
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
135
+ JAVACMD=java
136
+ if ! command -v java >/dev/null 2>&1
137
+ then
138
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
139
 
104
140
  Please set the JAVA_HOME variable in your environment to match the
105
141
  location of your Java installation."
142
+ fi
106
143
  fi
107
144
 
108
145
  # Increase the maximum file descriptors if we can.
109
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
- MAX_FD_LIMIT=`ulimit -H -n`
111
- if [ $? -eq 0 ] ; then
112
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
- MAX_FD="$MAX_FD_LIMIT"
114
- fi
115
- ulimit -n $MAX_FD
116
- if [ $? -ne 0 ] ; then
117
- warn "Could not set maximum file descriptor limit: $MAX_FD"
118
- fi
119
- else
120
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
- fi
146
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147
+ case $MAX_FD in #(
148
+ max*)
149
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150
+ # shellcheck disable=SC2039,SC3045
151
+ MAX_FD=$( ulimit -H -n ) ||
152
+ warn "Could not query maximum file descriptor limit"
153
+ esac
154
+ case $MAX_FD in #(
155
+ '' | soft) :;; #(
156
+ *)
157
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158
+ # shellcheck disable=SC2039,SC3045
159
+ ulimit -n "$MAX_FD" ||
160
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
161
+ esac
122
162
  fi
123
163
 
124
- # For Darwin, add options to specify how the application appears in the dock
125
- if $darwin; then
126
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
- fi
164
+ # Collect all arguments for the java command, stacking in reverse order:
165
+ # * args from the command line
166
+ # * the main class name
167
+ # * -classpath
168
+ # * -D...appname settings
169
+ # * --module-path (only if needed)
170
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
128
171
 
129
172
  # For Cygwin or MSYS, switch paths to Windows format before running java
130
- if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
-
134
- JAVACMD=`cygpath --unix "$JAVACMD"`
135
-
136
- # We build the pattern for arguments to be converted via cygpath
137
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
- SEP=""
139
- for dir in $ROOTDIRSRAW ; do
140
- ROOTDIRS="$ROOTDIRS$SEP$dir"
141
- SEP="|"
142
- done
143
- OURCYGPATTERN="(^($ROOTDIRS))"
144
- # Add a user-defined pattern to the cygpath arguments
145
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
- fi
173
+ if "$cygwin" || "$msys" ; then
174
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176
+
177
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
178
+
148
179
  # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
- i=0
150
- for arg in "$@" ; do
151
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
-
154
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
- else
157
- eval `echo args$i`="\"$arg\""
180
+ for arg do
181
+ if
182
+ case $arg in #(
183
+ -*) false ;; # don't mess with options #(
184
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185
+ [ -e "$t" ] ;; #(
186
+ *) false ;;
187
+ esac
188
+ then
189
+ arg=$( cygpath --path --ignore --mixed "$arg" )
158
190
  fi
159
- i=`expr $i + 1`
191
+ # Roll the args list around exactly as many times as the number of
192
+ # args, so each arg winds up back in the position where it started, but
193
+ # possibly modified.
194
+ #
195
+ # NB: a `for` loop captures its iteration list before it begins, so
196
+ # changing the positional parameters here affects neither the number of
197
+ # iterations, nor the values presented in `arg`.
198
+ shift # remove old arg
199
+ set -- "$@" "$arg" # push replacement arg
160
200
  done
161
- case $i in
162
- 0) set -- ;;
163
- 1) set -- "$args0" ;;
164
- 2) set -- "$args0" "$args1" ;;
165
- 3) set -- "$args0" "$args1" "$args2" ;;
166
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
- esac
173
201
  fi
174
202
 
175
- # Escape application args
176
- save () {
177
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
- echo " "
179
- }
180
- APP_ARGS=`save "$@"`
181
203
 
182
- # Collect all arguments for the java command, following the shell quoting and substitution rules
183
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
204
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206
+
207
+ # Collect all arguments for the java command:
208
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209
+ # and any embedded shellness will be escaped.
210
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211
+ # treated as '${Hostname}' itself on the command line.
212
+
213
+ set -- \
214
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
215
+ -classpath "$CLASSPATH" \
216
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217
+ "$@"
218
+
219
+ # Stop when "xargs" is not available.
220
+ if ! command -v xargs >/dev/null 2>&1
221
+ then
222
+ die "xargs is not available"
223
+ fi
224
+
225
+ # Use "xargs" to parse quoted args.
226
+ #
227
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228
+ #
229
+ # In Bash we could simply go:
230
+ #
231
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232
+ # set -- "${ARGS[@]}" "$@"
233
+ #
234
+ # but POSIX shell has neither arrays nor command substitution, so instead we
235
+ # post-process each arg (as a line of input to sed) to backslash-escape any
236
+ # character that might be a shell metacharacter, then use eval to reverse
237
+ # that process (while maintaining the separation between arguments), and wrap
238
+ # the whole thing up as a single "set" statement.
239
+ #
240
+ # This will of course break if any of these variables contains a newline or
241
+ # an unmatched quote.
242
+ #
243
+
244
+ eval "set -- $(
245
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246
+ xargs -n1 |
247
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248
+ tr '\n' ' '
249
+ )" '"$@"'
184
250
 
185
251
  exec "$JAVACMD" "$@"
@@ -13,8 +13,10 @@
13
13
  @rem See the License for the specific language governing permissions and
14
14
  @rem limitations under the License.
15
15
  @rem
16
+ @rem SPDX-License-Identifier: Apache-2.0
17
+ @rem
16
18
 
17
- @if "%DEBUG%" == "" @echo off
19
+ @if "%DEBUG%"=="" @echo off
18
20
  @rem ##########################################################################
19
21
  @rem
20
22
  @rem Gradle startup script for Windows
@@ -25,7 +27,8 @@
25
27
  if "%OS%"=="Windows_NT" setlocal
26
28
 
27
29
  set DIRNAME=%~dp0
28
- if "%DIRNAME%" == "" set DIRNAME=.
30
+ if "%DIRNAME%"=="" set DIRNAME=.
31
+ @rem This is normally unused
29
32
  set APP_BASE_NAME=%~n0
30
33
  set APP_HOME=%DIRNAME%
31
34
 
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
40
43
 
41
44
  set JAVA_EXE=java.exe
42
45
  %JAVA_EXE% -version >NUL 2>&1
43
- if "%ERRORLEVEL%" == "0" goto execute
46
+ if %ERRORLEVEL% equ 0 goto execute
44
47
 
45
- echo.
46
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
- echo.
48
- echo Please set the JAVA_HOME variable in your environment to match the
49
- echo location of your Java installation.
48
+ echo. 1>&2
49
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
+ echo. 1>&2
51
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
+ echo location of your Java installation. 1>&2
50
53
 
51
54
  goto fail
52
55
 
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
59
 
57
60
  if exist "%JAVA_EXE%" goto execute
58
61
 
59
- echo.
60
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
- echo.
62
- echo Please set the JAVA_HOME variable in your environment to match the
63
- echo location of your Java installation.
62
+ echo. 1>&2
63
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
+ echo. 1>&2
65
+ echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
+ echo location of your Java installation. 1>&2
64
67
 
65
68
  goto fail
66
69
 
67
70
  :execute
68
71
  @rem Setup the command line
69
72
 
70
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
+ set CLASSPATH=
71
74
 
72
75
 
73
76
  @rem Execute Gradle
74
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
77
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
75
78
 
76
79
  :end
77
80
  @rem End local scope for the variables with windows NT shell
78
- if "%ERRORLEVEL%"=="0" goto mainEnd
81
+ if %ERRORLEVEL% equ 0 goto mainEnd
79
82
 
80
83
  :fail
81
84
  rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
85
  rem the _cmd.exe /c_ return code!
83
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
- exit /b 1
86
+ set EXIT_CODE=%ERRORLEVEL%
87
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
88
+ if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89
+ exit /b %EXIT_CODE%
85
90
 
86
91
  :mainEnd
87
92
  if "%OS%"=="Windows_NT" endlocal
@@ -22,6 +22,7 @@ private const val TAG = "ContentProtection"
22
22
 
23
23
  const val PROP_INTEGRATION: String = "integration"
24
24
  const val PROP_INTEGRATION_ID: String = "integrationId"
25
+ const val PROP_INTEGRATION_INSTANCE_ID: String = "integrationInstanceId"
25
26
  const val PROP_INTEGRATION_PARAMETERS: String = "integrationParameters"
26
27
  const val PROP_REQUEST: String = "request"
27
28
  const val PROP_KEYSYSTEM_ID: String = "keySystemId"
@@ -51,9 +52,14 @@ const val PROP_VALUE: String = "value"
51
52
 
52
53
  object ContentProtectionAdapter {
53
54
 
54
- private fun createBridgeData(integrationId: String, keySystemId: KeySystemId): WritableMap {
55
+ private fun createBridgeData(
56
+ integrationId: String,
57
+ keySystemId: KeySystemId,
58
+ integrationInstanceId: String
59
+ ): WritableMap {
55
60
  return Arguments.createMap().apply {
56
61
  putString(PROP_INTEGRATION_ID, integrationId)
62
+ putString(PROP_INTEGRATION_INSTANCE_ID, integrationInstanceId)
57
63
  putString(PROP_KEYSYSTEM_ID, KeySystemAdapter.toString(keySystemId))
58
64
  }
59
65
  }
@@ -176,8 +182,13 @@ object ContentProtectionAdapter {
176
182
  }
177
183
  }
178
184
 
179
- fun fromRequest(integrationId: String, keySystemId: KeySystemId, request: Request): WritableMap {
180
- val payload = createBridgeData(integrationId, keySystemId)
185
+ fun fromRequest(
186
+ integrationId: String,
187
+ keySystemId: KeySystemId,
188
+ integrationInstanceId: String,
189
+ request: Request
190
+ ): WritableMap {
191
+ val payload = createBridgeData(integrationId, keySystemId, integrationInstanceId)
181
192
  payload.putString(PROP_URL, request.url)
182
193
  payload.putString(PROP_METHOD, RequestMethodAdapter.toString(request.method))
183
194
  val headers = Arguments.createMap()
@@ -192,9 +203,10 @@ object ContentProtectionAdapter {
192
203
  fun fromResponse(
193
204
  integrationId: String,
194
205
  keySystemId: KeySystemId,
206
+ integrationInstanceId: String,
195
207
  response: Response
196
208
  ): WritableMap {
197
- val payload = createBridgeData(integrationId, keySystemId)
209
+ val payload = createBridgeData(integrationId, keySystemId, integrationInstanceId)
198
210
  payload.putString(PROP_URL, response.url)
199
211
  payload.putInt(PROP_STATUS, response.status)
200
212
  payload.putString(PROP_STATUS_TEXT, response.statusText)
@@ -205,7 +217,7 @@ object ContentProtectionAdapter {
205
217
  }
206
218
  }
207
219
  payload.putMap(PROP_HEADERS, headers)
208
- payload.putMap(PROP_REQUEST, fromRequest(integrationId, keySystemId, response.request))
220
+ payload.putMap(PROP_REQUEST, fromRequest(integrationId, keySystemId, integrationInstanceId, response.request))
209
221
  payload.putString(PROP_BASE64_BODY, Base64.encodeToString(response.body, Base64.DEFAULT))
210
222
  return payload
211
223
  }