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
This commit is contained in:
Olivier Bouillet 2024-05-13 19:19:20 +02:00 committed by GitHub
parent e420418e8f
commit 2e623ca0fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1646,15 +1646,14 @@ public class ReactExoplayerView extends FrameLayout implements
if (this.customMetadata != customMetadata && player != null) { if (this.customMetadata != customMetadata && player != null) {
MediaItem currentMediaItem = player.getCurrentMediaItem(); MediaItem currentMediaItem = player.getCurrentMediaItem();
if (currentMediaItem == null) { if (currentMediaItem != null) {
return;
}
MediaItem newMediaItem = currentMediaItem.buildUpon().setMediaMetadata(customMetadata).build(); MediaItem newMediaItem = currentMediaItem.buildUpon().setMediaMetadata(customMetadata).build();
// This will cause video blink/reload but won't louse progress // This will cause video blink/reload but won't louse progress
player.setMediaItem(newMediaItem, false); player.setMediaItem(newMediaItem, false);
} }
}
if (uri != null) { if (uri != null) {
boolean isSourceEqual = uri.equals(srcUri) && cropStartMs == this.cropStartMs && cropEndMs == this.cropEndMs; boolean isSourceEqual = uri.equals(srcUri) && cropStartMs == this.cropStartMs && cropEndMs == this.cropEndMs;