From 2e623ca0fb074e64a6125994effb8723f5c4ce59 Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Mon, 13 May 2024 19:19:20 +0200 Subject: [PATCH] fix(avoid): avoid early return in setSrc (#3759) * perf: ensure we do not provide callback to native if no callback provided from app * chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size * fix(android): avoid easly return in setSrc --- .../brentvatne/exoplayer/ReactExoplayerView.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 9eb60e22..441f7610 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1646,14 +1646,13 @@ public class ReactExoplayerView extends FrameLayout implements if (this.customMetadata != customMetadata && player != null) { MediaItem currentMediaItem = player.getCurrentMediaItem(); - if (currentMediaItem == null) { - return; + if (currentMediaItem != null) { + + MediaItem newMediaItem = currentMediaItem.buildUpon().setMediaMetadata(customMetadata).build(); + + // This will cause video blink/reload but won't louse progress + player.setMediaItem(newMediaItem, false); } - - MediaItem newMediaItem = currentMediaItem.buildUpon().setMediaMetadata(customMetadata).build(); - - // This will cause video blink/reload but won't louse progress - player.setMediaItem(newMediaItem, false); } if (uri != null) {