Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: The video is still playing after the component is unmounted #3522

Open
chenqi777 opened this issue Feb 8, 2024 · 14 comments
Open

[BUG]: The video is still playing after the component is unmounted #3522

chenqi777 opened this issue Feb 8, 2024 · 14 comments
Labels
bug critical for release interop layer Issue occurs when used with interop layer Platform: iOS

Comments

@chenqi777
Copy link

Version

v6 (Beta)

What platforms are you having the problem on?

iOS

Architecture

New architecture with interop layer

What happened?

The component is still playing after it is unmounted. It will appear in iOS 15, but there is no problem in iOS17. I can only manually call the pause() method to pause the playback when the component is unmounted. Both versions 5.2.1 and 6.0.0-beta.5 This problem exists.

Reproduction

This person also encountered this problem https://github.com/react-native-video/react-native-video/issues/3510

@chenqi777 chenqi777 added the bug label Feb 8, 2024
@KrzysztofMoch
Copy link
Member

Hey @chenqi777, Unfortunately I can't access iOS 15 - cloud you check if this patch will work for you ? (with 6.0.0-beta.5)

diff --git a/node_modules/react-native-video/ios/Video/RCTVideo.swift b/node_modules/react-native-video/ios/Video/RCTVideo.swift
index 70ae6e8..1b1283e 100644
--- a/ios/Video/RCTVideo.swift
+++ b/ios/Video/RCTVideo.swift
@@ -201,6 +201,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
         self.removePlayerLayer()
         _pip = nil
         _playerObserver.clearPlayer()
+        _player = nil
     }
 
     // MARK: - App lifecycle handlers

@KrzysztofMoch KrzysztofMoch added Platform: iOS interop layer Issue occurs when used with interop layer labels Feb 8, 2024
@smourey
Copy link

smourey commented Feb 13, 2024

Hi @KrzysztofMoch, thanks for your help.
I am experiencing same issue (and I guess this is the same: #3523). Unfortunately, deinit method is not being called when the component is unmounted, so the suggested fix does not work. Any other idea?

@ZubairovSalim
Copy link

ZubairovSalim commented Feb 28, 2024

Experiencing same issue on iOS 15.x. Reproduced on 6.0.0-alpha.11. On ios 16.x and higher works good.

@Arise-cn
Copy link

Arise-cn commented Apr 9, 2024

same

@enricsa
Copy link

enricsa commented Apr 19, 2024

same here

@freeboub
Copy link
Collaborator

are you able to reproduce the issue with the emulator and the sample ?
I just try with ios 15.0 & 15.5.
15.0 -> crash on emulator launch
15.5 -> crash on app launch (before any react native invocation)

@haonguyendirox
Copy link

Same here, it works fine on iOS 16.x and 17.x, but it has issues on iOS 15. Do you have any solutions to address it?

@giantslogik
Copy link

giantslogik commented Jun 12, 2024

can confirm its broken on iOS 15 with v6.2.0. I'm not using new architecture.

@tdammy92
Copy link

This is the only thing that gives me headache with this library. you continue hearing sounds from components that have been unmounted. 😭

@husseinTalal2
Copy link

husseinTalal2 commented Aug 22, 2024

Same issue here and I'm on android, any updates?

@sentinelweb
Copy link

I also see the issue on iOS 17.2 (sim) but not on Android.

@amit-6thstreet
Copy link

any update on this.

Copy link

This issue is stale because it has been open for 30 days with no activity. If there won't be any activity in the next 14 days, this issue will be closed automatically.

@github-actions github-actions bot added the stale Closed due to inactivity or lack or resources label Oct 22, 2024
@sentinelweb
Copy link

easy fix is to use an useLayoutEffect hook to pause the video

@github-actions github-actions bot removed the stale Closed due to inactivity or lack or resources label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug critical for release interop layer Issue occurs when used with interop layer Platform: iOS
Projects
None yet
Development

No branches or pull requests