TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://docs.thewidlarzgroup.com/react-native-video/
MIT License
7.23k stars 2.91k forks source link

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

Open chenqi777 opened 9 months ago

chenqi777 commented 9 months ago

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

KrzysztofMoch commented 9 months ago

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
smourey commented 9 months ago

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

ZubairovSalim commented 9 months ago

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

Arise-cn commented 7 months ago

same

enricsa commented 7 months ago

same here

freeboub commented 7 months ago

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 commented 6 months ago

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 commented 5 months ago

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

tdammy92 commented 4 months ago

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

husseinTalal2 commented 3 months ago

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

sentinelweb commented 3 months ago

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

amit-6thstreet commented 2 months ago

any update on this.

github-actions[bot] commented 1 month ago

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.

sentinelweb commented 1 month ago

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

github-actions[bot] commented 1 week ago

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.