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

Reuse same AVPlayer instance #18

Closed
johanneslumpe opened this issue Apr 9, 2015 · 9 comments
Closed

Reuse same AVPlayer instance #18

johanneslumpe opened this issue Apr 9, 2015 · 9 comments
Labels

Comments

@johanneslumpe
Copy link
Contributor

We are currently throwing away and re-creating the AVPlayer. It would be nicer if we just reused the same instance and exchanged the item if the source changes.

@brentvatne
Copy link
Contributor

@johanneslumpe - are there any tradeoffs here? what is the cost of throwing away & creating a new one?

@eduedix
Copy link

eduedix commented Apr 9, 2015

@brentvatne: I am going back and forth in the Navigator in my small app, which has a page that loads Video.
Everytime i go to the page with Video, memory usage jumps by around 70MB. I think thats cos new instance is alloc'ed each time.

@brentvatne
Copy link
Contributor

@eduedix - that sounds like a good enough reason right there! thanks

@eduedix
Copy link

eduedix commented Apr 9, 2015

It would be indeed useful to have an API, which could let me kill the instance. It seems having only 1 instance is still not the optimum solution.
I might be wrong about this.

@brentvatne
Copy link
Contributor

@eduedix - ideally how would you like to manage this?

@johanneslumpe
Copy link
Contributor Author

@eduedix it's one instance per element, not sure why you need multiple players per element?

@johanneslumpe
Copy link
Contributor Author

@brentvatne at the very least we'd save the cost of allocating a new instance. It might not be a huge optimization, but less allocation is always better ;)

@eduedix
Copy link

eduedix commented Apr 10, 2015

@brentvatne @johanneslumpe I am still in for only one instance. But it seems instance stays on in the background forever.

@johanneslumpe
Copy link
Contributor Author

@brentvatne @eduedix I just pushed a small fix branch for this.
https://github.com/brentvatne/react-native-video/tree/feature/fix-unremoved-playerlayer

After that gets merged, you should see a significant memory drop, when removing the view with the video.

hueniverse pushed a commit that referenced this issue Jun 9, 2022
This PR adds core actions to enable or disable screenshots

Jira: VEX-6540
https://jira.tenkasu.net/browse/VEX-6540

velocity PR: crunchyroll/velocity#2248

New core actions were added to control the player surface and mark it as secure. Sending the prop to react-native-video will recreate the surface of the player changing it to a SurfaceView and enabling security

Reviews
Major reviewer (domain expert): @nickfujita
Minor reviewer: @armadilio3
yungblud added a commit to react-native-yeouido/react-native-video that referenced this issue May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants