From 782fc3b192cad3fa97f9a70684966baeb77c50e2 Mon Sep 17 00:00:00 2001 From: Vladimir Novick Date: Tue, 27 Jun 2023 15:02:22 +0300 Subject: [PATCH] feat: add looping prop to IVSPlayer --- .../com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt | 4 ++++ .../ivs/reactnative/player/AmazonIvsViewManager.kt | 5 +++++ example/src/screens/AdvancedExample.tsx | 1 + ios/AmazonIvsManager.m | 1 + ios/AmazonIvsView.swift | 7 +++++++ src/IVSPlayer.js.flow | 1 + src/IVSPlayer.tsx | 4 ++++ 7 files changed, 23 insertions(+) diff --git a/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt b/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt index 3262eb8..ff0abf5 100644 --- a/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt +++ b/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt @@ -130,6 +130,10 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte player?.isMuted = muted } + fun setLooping(shouldLoop: Boolean) { + player?.setLooping(shouldLoop) + } + fun setVolume(volume: Double) { player?.setVolume(volume.toFloat()) } diff --git a/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsViewManager.kt b/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsViewManager.kt index bbf905c..ece3bf2 100644 --- a/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsViewManager.kt +++ b/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsViewManager.kt @@ -67,6 +67,11 @@ class AmazonIvsViewManager : SimpleViewManager() { view.setStreamUrl(streamUrl); } + @ReactProp(name = "loop") + fun setLooping(view: AmazonIvsView, shouldLoop: Boolean){ + view.setLooping(shouldLoop); + } + @ReactProp(name = "resizeMode") fun setResizeMode(view: AmazonIvsView, mode: String) { view.setResizeMode(mode); diff --git a/example/src/screens/AdvancedExample.tsx b/example/src/screens/AdvancedExample.tsx index e4119f1..ee3f3a2 100644 --- a/example/src/screens/AdvancedExample.tsx +++ b/example/src/screens/AdvancedExample.tsx @@ -81,6 +81,7 @@ export default function AdvancedExample() { ( streamUrl, paused, muted, + loop = false, resizeMode, autoplay = true, liveLowLatency, @@ -333,6 +336,7 @@ const IVSPlayerContainer = React.forwardRef(