From 324b46152703d813945778f55d87310d4e0b03cf Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Thu, 16 May 2024 15:57:27 +0200 Subject: [PATCH] fix(android): remove remaining ad view when zapping (#3786) * 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 * chore: improve issue template * fix(android): avoid video view flickering at playback startup * fix(android): ensure adsLoader is well release if unused --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 741f55d0..1b8dec49 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -712,6 +712,11 @@ public class ReactExoplayerView extends FrameLayout implements .setLocalAdInsertionComponents(unusedAdTagUri -> adsLoader, exoPlayerView); DataSpec adTagDataSpec = new DataSpec(adTagUrl); mediaSourceWithAds = new AdsMediaSource(videoSource, adTagDataSpec, ImmutableList.of(srcUri, adTagUrl), mediaSourceFactory, adsLoader, exoPlayerView); + } else { + if (adTagUrl == null && adsLoader != null) { + adsLoader.release(); + adsLoader = null; + } } MediaSource mediaSource; if (mediaSourceList.size() == 0) {