amazon-ivs-react-native-player 1.2.0 → 1.4.1

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.
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
19
19
  s.license = package["license"]
20
20
  s.authors = package["author"]
21
21
 
22
- s.platforms = { :ios => "11.0" }
22
+ s.platforms = { :ios => "12.4" }
23
23
  s.source = { :git => "https://github.com/aws/amazon-ivs-react-native-player.git", :tag => "#{s.version}" }
24
24
 
25
25
 
@@ -27,5 +27,5 @@ Pod::Spec.new do |s|
27
27
 
28
28
 
29
29
  s.dependency "React-Core"
30
- s.dependency "AmazonIVSPlayer", "~> 1.8.2"
30
+ s.dependency "AmazonIVSPlayer", "~> 1.18.0"
31
31
  end
@@ -7,10 +7,13 @@ buildscript {
7
7
  repositories {
8
8
  google()
9
9
  mavenCentral()
10
+ google()
10
11
  }
11
12
 
12
13
  dependencies {
13
- classpath 'com.android.tools.build:gradle:4.2.2'
14
+ classpath("com.android.tools.build:gradle:7.0.4")
15
+ classpath("com.facebook.react:react-native-gradle-plugin")
16
+ classpath("de.undercouch:gradle-download-task:4.1.2")
14
17
  // noinspection DifferentKotlinGradleVersion
15
18
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16
19
  }
@@ -49,10 +52,6 @@ android {
49
52
  lintOptions {
50
53
  disable 'GradleCompatible'
51
54
  }
52
- compileOptions {
53
- sourceCompatibility JavaVersion.VERSION_1_8
54
- targetCompatibility JavaVersion.VERSION_1_8
55
- }
56
55
  }
57
56
 
58
57
  repositories {
@@ -130,7 +129,7 @@ def ivs_version = getExtOrDefault('ivsVersion')
130
129
 
131
130
  dependencies {
132
131
  // noinspection GradleDynamicVersion
133
- api 'com.facebook.react:react-native:+'
132
+ implementation 'com.facebook.react:react-native:+'
134
133
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
135
134
  implementation "com.amazonaws:ivs-player:$ivs_version"
136
135
  implementation "com.squareup.okhttp3:okhttp:4.2.2"
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -1,5 +1,5 @@
1
- AmazonIvs_kotlinVersion=1.3.50
2
- AmazonIvs_compileSdkVersion=30
3
- AmazonIvs_buildToolsVersion=30.0.2
4
- AmazonIvs_targetSdkVersion=30
5
- AmazonIvs_ivsVersion=1.10.0
1
+ AmazonIvs_kotlinVersion=1.6.10
2
+ AmazonIvs_compileSdkVersion=31
3
+ AmazonIvs_buildToolsVersion=31.0.0
4
+ AmazonIvs_targetSdkVersion=31
5
+ AmazonIvs_ivsVersion=1.18.0
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.
@@ -17,78 +17,113 @@
17
17
  #
18
18
 
19
19
  ##############################################################################
20
- ##
21
- ## Gradle start up script for UN*X
22
- ##
20
+ #
21
+ # Gradle start up script for POSIX generated by Gradle.
22
+ #
23
+ # Important for running:
24
+ #
25
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
+ # noncompliant, but you have some other compliant shell such as ksh or
27
+ # bash, then to run this script, type that shell name before the whole
28
+ # command line, like:
29
+ #
30
+ # ksh Gradle
31
+ #
32
+ # Busybox and similar reduced shells will NOT work, because this script
33
+ # requires all of these POSIX shell features:
34
+ # * functions;
35
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
+ # * compound commands having a testable exit status, especially «case»;
38
+ # * various built-in commands including «command», «set», and «ulimit».
39
+ #
40
+ # Important for patching:
41
+ #
42
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
43
+ # by Bash, Ksh, etc; in particular arrays are avoided.
44
+ #
45
+ # The "traditional" practice of packing multiple parameters into a
46
+ # space-separated string is a well documented source of bugs and security
47
+ # problems, so this is (mostly) avoided, by progressively accumulating
48
+ # options in "$@", and eventually passing that to Java.
49
+ #
50
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52
+ # see the in-line comments for details.
53
+ #
54
+ # There are tweaks for specific operating systems such as AIX, CygWin,
55
+ # Darwin, MinGW, and NonStop.
56
+ #
57
+ # (3) This script is generated from the Groovy template
58
+ # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
+ # within the Gradle project.
60
+ #
61
+ # You can find Gradle at https://github.com/gradle/gradle/.
62
+ #
23
63
  ##############################################################################
24
64
 
25
65
  # Attempt to set APP_HOME
66
+
26
67
  # 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
68
+ app_path=$0
69
+
70
+ # Need this for daisy-chained symlinks.
71
+ while
72
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73
+ [ -h "$app_path" ]
74
+ do
75
+ ls=$( ls -ld "$app_path" )
76
+ link=${ls#*' -> '}
77
+ case $link in #(
78
+ /*) app_path=$link ;; #(
79
+ *) app_path=$APP_HOME$link ;;
80
+ esac
37
81
  done
38
- SAVED="`pwd`"
39
- cd "`dirname \"$PRG\"`/" >/dev/null
40
- APP_HOME="`pwd -P`"
41
- cd "$SAVED" >/dev/null
82
+
83
+ APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
42
84
 
43
85
  APP_NAME="Gradle"
44
- APP_BASE_NAME=`basename "$0"`
86
+ APP_BASE_NAME=${0##*/}
45
87
 
46
88
  # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
89
  DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
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
117
  CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
118
 
119
+
85
120
  # Determine the Java command to use to start the JVM.
86
121
  if [ -n "$JAVA_HOME" ] ; then
87
122
  if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88
123
  # IBM's JDK on AIX uses strange locations for the executables
89
- JAVACMD="$JAVA_HOME/jre/sh/java"
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
90
125
  else
91
- JAVACMD="$JAVA_HOME/bin/java"
126
+ JAVACMD=$JAVA_HOME/bin/java
92
127
  fi
93
128
  if [ ! -x "$JAVACMD" ] ; then
94
129
  die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
97
132
  location of your Java installation."
98
133
  fi
99
134
  else
100
- JAVACMD="java"
135
+ JAVACMD=java
101
136
  which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102
137
 
103
138
  Please set the JAVA_HOME variable in your environment to match the
@@ -105,79 +140,95 @@ location of your Java installation."
105
140
  fi
106
141
 
107
142
  # Increase the maximum file descriptors if we can.
108
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109
- MAX_FD_LIMIT=`ulimit -H -n`
110
- if [ $? -eq 0 ] ; then
111
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112
- MAX_FD="$MAX_FD_LIMIT"
113
- fi
114
- ulimit -n $MAX_FD
115
- if [ $? -ne 0 ] ; then
116
- warn "Could not set maximum file descriptor limit: $MAX_FD"
117
- fi
118
- else
119
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120
- fi
143
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
+ case $MAX_FD in #(
145
+ max*)
146
+ MAX_FD=$( ulimit -H -n ) ||
147
+ warn "Could not query maximum file descriptor limit"
148
+ esac
149
+ case $MAX_FD in #(
150
+ '' | soft) :;; #(
151
+ *)
152
+ ulimit -n "$MAX_FD" ||
153
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
154
+ esac
121
155
  fi
122
156
 
123
- # For Darwin, add options to specify how the application appears in the dock
124
- if $darwin; then
125
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126
- fi
157
+ # Collect all arguments for the java command, stacking in reverse order:
158
+ # * args from the command line
159
+ # * the main class name
160
+ # * -classpath
161
+ # * -D...appname settings
162
+ # * --module-path (only if needed)
163
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
127
164
 
128
165
  # For Cygwin or MSYS, switch paths to Windows format before running java
129
- if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132
- JAVACMD=`cygpath --unix "$JAVACMD"`
133
-
134
- # We build the pattern for arguments to be converted via cygpath
135
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136
- SEP=""
137
- for dir in $ROOTDIRSRAW ; do
138
- ROOTDIRS="$ROOTDIRS$SEP$dir"
139
- SEP="|"
140
- done
141
- OURCYGPATTERN="(^($ROOTDIRS))"
142
- # Add a user-defined pattern to the cygpath arguments
143
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145
- fi
166
+ if "$cygwin" || "$msys" ; then
167
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169
+
170
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
171
+
146
172
  # Now convert the arguments - kludge to limit ourselves to /bin/sh
147
- i=0
148
- for arg in "$@" ; do
149
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151
-
152
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154
- else
155
- eval `echo args$i`="\"$arg\""
173
+ for arg do
174
+ if
175
+ case $arg in #(
176
+ -*) false ;; # don't mess with options #(
177
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178
+ [ -e "$t" ] ;; #(
179
+ *) false ;;
180
+ esac
181
+ then
182
+ arg=$( cygpath --path --ignore --mixed "$arg" )
156
183
  fi
157
- i=`expr $i + 1`
184
+ # Roll the args list around exactly as many times as the number of
185
+ # args, so each arg winds up back in the position where it started, but
186
+ # possibly modified.
187
+ #
188
+ # NB: a `for` loop captures its iteration list before it begins, so
189
+ # changing the positional parameters here affects neither the number of
190
+ # iterations, nor the values presented in `arg`.
191
+ shift # remove old arg
192
+ set -- "$@" "$arg" # push replacement arg
158
193
  done
159
- case $i in
160
- 0) set -- ;;
161
- 1) set -- "$args0" ;;
162
- 2) set -- "$args0" "$args1" ;;
163
- 3) set -- "$args0" "$args1" "$args2" ;;
164
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170
- esac
171
194
  fi
172
195
 
173
- # Escape application args
174
- save () {
175
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176
- echo " "
177
- }
178
- APP_ARGS=`save "$@"`
196
+ # Collect all arguments for the java command;
197
+ # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198
+ # shell script including quotes and variable substitutions, so put them in
199
+ # double quotes to make sure that they get re-expanded; and
200
+ # * put everything else in single quotes, so that it's not re-expanded.
201
+
202
+ set -- \
203
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
204
+ -classpath "$CLASSPATH" \
205
+ org.gradle.wrapper.GradleWrapperMain \
206
+ "$@"
207
+
208
+ # Use "xargs" to parse quoted args.
209
+ #
210
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211
+ #
212
+ # In Bash we could simply go:
213
+ #
214
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215
+ # set -- "${ARGS[@]}" "$@"
216
+ #
217
+ # but POSIX shell has neither arrays nor command substitution, so instead we
218
+ # post-process each arg (as a line of input to sed) to backslash-escape any
219
+ # character that might be a shell metacharacter, then use eval to reverse
220
+ # that process (while maintaining the separation between arguments), and wrap
221
+ # the whole thing up as a single "set" statement.
222
+ #
223
+ # This will of course break if any of these variables contains a newline or
224
+ # an unmatched quote.
225
+ #
179
226
 
180
- # Collect all arguments for the java command, following the shell quoting and substitution rules
181
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
227
+ eval "set -- $(
228
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229
+ xargs -n1 |
230
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231
+ tr '\n' ' '
232
+ )" '"$@"'
182
233
 
183
- exec "$JAVACMD" "$@"
234
+ exec "$JAVACMD" "$@"
@@ -1,8 +1,10 @@
1
1
  package com.amazonaws.ivs.reactnative.player
2
2
 
3
+ import android.content.pm.PackageManager
3
4
  import android.net.Uri
4
5
  import android.widget.FrameLayout
5
6
  import com.amazonaws.ivs.player.*
7
+ import android.os.Build
6
8
  import com.facebook.react.bridge.Arguments
7
9
  import com.facebook.react.bridge.LifecycleEventListener
8
10
  import com.facebook.react.bridge.ReactContext
@@ -12,6 +14,10 @@ import com.facebook.react.uimanager.events.RCTEventEmitter
12
14
  import java.util.*
13
15
  import java.util.concurrent.TimeUnit
14
16
  import kotlin.concurrent.timerTask
17
+ import android.app.PictureInPictureParams
18
+ import android.app.Activity
19
+ import androidx.annotation.RequiresApi
20
+
15
21
 
16
22
  class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(context), LifecycleEventListener {
17
23
  private var playerView: PlayerView? = null
@@ -87,7 +93,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
87
93
  }
88
94
 
89
95
  override fun onError(e: PlayerException) {
90
- onError(e.errorMessage)
96
+ onError(e.getErrorMessage())
91
97
  }
92
98
  }
93
99
 
@@ -124,6 +130,10 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
124
130
  player?.isMuted = muted
125
131
  }
126
132
 
133
+ fun setLooping(shouldLoop: Boolean) {
134
+ player?.setLooping(shouldLoop)
135
+ }
136
+
127
137
  fun setVolume(volume: Double) {
128
138
  player?.setVolume(volume.toFloat())
129
139
  }
@@ -251,19 +261,21 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
251
261
  fun onSeek(position: Long) {
252
262
  val reactContext = context as ReactContext
253
263
  val data = Arguments.createMap()
254
- data.putInt("position", TimeUnit.MILLISECONDS.toSeconds(position).toInt())
255
-
264
+ data.putDouble("position", convertMilliSecondsToSeconds(position))
256
265
  reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(id, Events.SEEK.toString(), data)
257
266
  }
258
267
 
259
268
  fun onProgress(position: Long) {
260
269
  val reactContext = context as ReactContext
261
270
  val data = Arguments.createMap()
262
- data.putInt("position", TimeUnit.MILLISECONDS.toSeconds(position).toInt())
263
-
271
+ data.putDouble("position", convertMilliSecondsToSeconds(position))
264
272
  reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(id, Events.PROGRESS.toString(), data)
265
273
  }
266
274
 
275
+ private fun convertMilliSecondsToSeconds (milliSeconds: Long): Double {
276
+ return milliSeconds / 1000.0
277
+ }
278
+
267
279
  private val mLayoutRunnable = Runnable {
268
280
  measure(
269
281
  MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
@@ -279,10 +291,16 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
279
291
  player?.pause()
280
292
  }
281
293
 
282
- fun seekTo(position: Long) {
283
- player?.seekTo(TimeUnit.SECONDS.toMillis(position))
294
+ fun seekTo(position: Double) {
295
+ val milliseconds = (position * 1000.0).toLong()
296
+ player?.seekTo(milliseconds)
284
297
  }
285
298
 
299
+ fun setOrigin(origin: String) {
300
+ player?.setOrigin(origin)
301
+ }
302
+
303
+
286
304
  fun onPlayerStateChange(state: Player.State) {
287
305
  val reactContext = context as ReactContext
288
306
 
@@ -319,7 +337,8 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
319
337
  data.putMap("playerData", playerData)
320
338
 
321
339
  reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(id, Events.DATA.toString(), data)
322
- };
340
+ }
341
+ else -> {}
323
342
  }
324
343
 
325
344
  val onStateChangeData = Arguments.createMap()
@@ -397,8 +416,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
397
416
  }
398
417
 
399
418
  private fun getDuration(duration: Long): Double {
400
- val durationInSeconds = TimeUnit.MILLISECONDS.toSeconds(duration).toInt()
401
- return durationInSeconds.toDouble()
419
+ return convertMilliSecondsToSeconds(duration)
402
420
  }
403
421
 
404
422
  private fun mapPlayerState(state: Player.State): String {
@@ -411,12 +429,30 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
411
429
  }
412
430
  }
413
431
 
414
- override fun onHostResume() {
432
+
433
+
434
+ fun togglePip(){
435
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
436
+ && context.packageManager
437
+ .hasSystemFeature(
438
+ PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
439
+ val activity: Activity? = context.currentActivity
440
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
441
+ val params = PictureInPictureParams.Builder()
442
+ activity?.enterPictureInPictureMode(params.build());
443
+ } else {
444
+ activity?.enterPictureInPictureMode();
445
+ }
446
+
447
+ }
415
448
  }
416
449
 
417
- override fun onHostPause() {
450
+
451
+ override fun onHostResume() {
418
452
  }
419
453
 
454
+ override fun onHostPause() {}
455
+
420
456
  override fun onHostDestroy() {
421
457
  cleanup()
422
458
  }
@@ -11,7 +11,9 @@ class AmazonIvsViewManager : SimpleViewManager<AmazonIvsView>() {
11
11
  private enum class Commands {
12
12
  PLAY,
13
13
  PAUSE,
14
- SEEK_TO
14
+ SEEK_TO,
15
+ SET_ORIGIN,
16
+ TOGGLE_PIP
15
17
  }
16
18
 
17
19
  override fun getName() = "AmazonIvs"
@@ -30,8 +32,12 @@ class AmazonIvsViewManager : SimpleViewManager<AmazonIvsView>() {
30
32
  Commands.PLAY.ordinal,
31
33
  "pause",
32
34
  Commands.PAUSE.ordinal,
35
+ "setOrigin",
36
+ Commands.SET_ORIGIN.ordinal,
33
37
  "seekTo",
34
- Commands.SEEK_TO.ordinal
38
+ Commands.SEEK_TO.ordinal,
39
+ "togglePip",
40
+ Commands.TOGGLE_PIP.ordinal
35
41
  )
36
42
  }
37
43
 
@@ -39,9 +45,16 @@ class AmazonIvsViewManager : SimpleViewManager<AmazonIvsView>() {
39
45
  when (commandType) {
40
46
  Commands.PLAY.ordinal -> view.play()
41
47
  Commands.PAUSE.ordinal -> view.pause()
48
+ Commands.TOGGLE_PIP.ordinal -> view.togglePip()
49
+ Commands.SET_ORIGIN.ordinal -> {
50
+ args?.getString(0)?.let {
51
+ origin ->
52
+ view.setOrigin(origin)
53
+ }
54
+ }
42
55
  Commands.SEEK_TO.ordinal -> {
43
- args?.getInt(0)?.let { position ->
44
- view.seekTo(position.toLong())
56
+ args?.getDouble(0)?.let { position ->
57
+ view.seekTo(position)
45
58
  }
46
59
  }
47
60
  else -> {
@@ -54,6 +67,11 @@ class AmazonIvsViewManager : SimpleViewManager<AmazonIvsView>() {
54
67
  view.setStreamUrl(streamUrl);
55
68
  }
56
69
 
70
+ @ReactProp(name = "loop")
71
+ fun setLooping(view: AmazonIvsView, shouldLoop: Boolean){
72
+ view.setLooping(shouldLoop);
73
+ }
74
+
57
75
  @ReactProp(name = "resizeMode")
58
76
  fun setResizeMode(view: AmazonIvsView, mode: String) {
59
77
  view.setResizeMode(mode);
package/ios/.gitignore ADDED
@@ -0,0 +1 @@
1
+ AmazonIvsManager+Framework.swift
@@ -4,6 +4,7 @@
4
4
  @interface RCT_EXTERN_MODULE(AmazonIvsManager, RCTViewManager)
5
5
  RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString)
6
6
  RCT_EXPORT_VIEW_PROPERTY(muted, BOOL)
7
+ RCT_EXPORT_VIEW_PROPERTY(loop, BOOL)
7
8
  RCT_EXPORT_VIEW_PROPERTY(liveLowLatency, BOOL)
8
9
  RCT_EXPORT_VIEW_PROPERTY(quality, NSDictionary)
9
10
  RCT_EXPORT_VIEW_PROPERTY(initialBufferDuration, double)
@@ -18,6 +19,8 @@ RCT_EXTERN_METHOD(play:(nonnull NSNumber *)node)
18
19
  RCT_EXTERN_METHOD(pause:(nonnull NSNumber *)node)
19
20
  RCT_EXPORT_VIEW_PROPERTY(streamUrl, NSString)
20
21
  RCT_EXTERN_METHOD(seekTo:(nonnull NSNumber *)node position:(double)position)
22
+ RCT_EXTERN_METHOD(setOrigin:(nonnull NSNumber *)node origin:(NSString *)origin)
23
+ RCT_EXTERN_METHOD(togglePip:(nonnull NSNumber *)node)
21
24
  RCT_EXPORT_VIEW_PROPERTY(onSeek, RCTDirectEventBlock)
22
25
  RCT_EXPORT_VIEW_PROPERTY(onData, RCTDirectEventBlock)
23
26
  RCT_EXPORT_VIEW_PROPERTY(onVideoStatistics, RCTDirectEventBlock)
@@ -26,4 +26,18 @@ class AmazonIvsManager: RCTViewManager {
26
26
  component.seek(position: position)
27
27
  }
28
28
  }
29
+
30
+ @objc func setOrigin(_ node: NSNumber, origin: NSString) {
31
+ DispatchQueue.main.async {
32
+ let component = self.bridge.uiManager.view(forReactTag: node) as! AmazonIvsView
33
+ component.setOrigin(origin: origin)
34
+ }
35
+ }
36
+
37
+ @objc func togglePip(_ node: NSNumber) {
38
+ DispatchQueue.main.async {
39
+ let component = self.bridge.uiManager.view(forReactTag: node) as! AmazonIvsView
40
+ component.togglePip()
41
+ }
42
+ }
29
43
  }