Skip to content

Commit c0ac08a

Browse files
Juozas-PetkelisWerror
authored andcommitted
feat: progressInterval clamped from 0.1 to 5
1 parent 20e2838 commit c0ac08a

5 files changed

Lines changed: 9 additions & 10 deletions

File tree

android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
205205
val reactContext = context as ReactContext
206206
val uri = Uri.parse(streamUrl);
207207
this.streamUri = uri;
208-
checkAndRequestNotificationPermission()
209208
playInBackground = true
210209

211210
finishedLoading = false
@@ -226,7 +225,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
226225
}
227226

228227
fun setPlayInBackground(playInBackground: Boolean) {
229-
if(playInBackground){
228+
if (playInBackground) {
230229
checkAndRequestNotificationPermission()
231230
}
232231
this.playInBackground = playInBackground
@@ -772,7 +771,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte
772771
)
773772
}
774773

775-
fun setProgressInterval(progressInterval: Int) {
774+
fun setProgressInterval(progressInterval: Double) {
776775
playerObserver?.cancel()
777776
playerObserver?.purge()
778777
playerObserver = Timer("observerInterval", false)

android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsViewManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class AmazonIvsViewManager : SimpleViewManager<AmazonIvsView>(),
184184

185185
override fun setProgressInterval(
186186
view: AmazonIvsView?,
187-
value: Int
187+
value: Double
188188
) {
189189
view?.setProgressInterval(value)
190190
}

docs/ivs-player-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Value that specifies how often `onProgress` callback should be called in seconds
212212
default: `1`
213213
type: `number`
214214
min: `1`
215-
max: `99999999`
215+
max: `5`
216216

217217
### onTimePoint _(optional)_
218218

src/components/AmazonIvsViewNativeComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface NativeProps extends ViewProps {
3636
maxBitrate?: Int32;
3737
initialBufferDuration?: Double;
3838
pipEnabled?: boolean;
39-
progressInterval?: Int32;
39+
progressInterval?: Double;
4040
playInBackground?: boolean;
4141
notificationTitle?: string;
4242
notificationText?: string;

src/components/IVSPlayer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import AmazonIvsViewNativeComponent, {
2929
} from './AmazonIvsViewNativeComponent';
3030
import { ErrorNotification } from './ErrorNotification';
3131

32-
const MAX_PROGRESS_INTERVAL = 99_999_999;
32+
const MAX_PROGRESS_INTERVAL = 5;
3333

3434
export type Props = {
3535
style?: ViewStyle;
@@ -98,7 +98,7 @@ const IVSPlayerContainer = React.forwardRef<IVSPlayerRef, Props>(
9898
playbackRate,
9999
pipEnabled,
100100
logLevel,
101-
progressInterval,
101+
progressInterval = 1,
102102
volume,
103103
quality,
104104
autoMaxQuality,
@@ -334,8 +334,8 @@ const IVSPlayerContainer = React.forwardRef<IVSPlayerRef, Props>(
334334
};
335335

336336
const constrainedProgressInterval = useMemo(() => {
337-
if (!progressInterval || progressInterval < 1) {
338-
return 1;
337+
if (!progressInterval || progressInterval <= 0.1) {
338+
return 0.1;
339339
}
340340

341341
return Math.min(progressInterval, MAX_PROGRESS_INTERVAL);

0 commit comments

Comments
 (0)