From 2efa746eed85eb2b4fd1df2e119b407d9fb1b9a2 Mon Sep 17 00:00:00 2001 From: olivier bouillet Date: Sun, 2 Oct 2022 21:33:53 +0200 Subject: [PATCH] fix(ios): ensure we stop playback on invalid or empty url --- ios/Video/RCTVideo.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 47231a78..bc36d17d 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -219,6 +219,12 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH @objc func setSrc(_ source:NSDictionary!) { _source = VideoSource(source) + if (_source?.uri == nil || _source?.uri == "") { + DispatchQueue.global(qos: .default).async { + self._player?.replaceCurrentItem(with: nil) + } + return; + } removePlayerLayer() _playerObserver.player = nil _playerObserver.playerItem = nil