Skip to content

Preload list of urls #3

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

Open
sn4f opened this issue Jan 15, 2024 · 3 comments
Open

Preload list of urls #3

sn4f opened this issue Jan 15, 2024 · 3 comments

Comments

@sn4f
Copy link

sn4f commented Jan 15, 2024

Hello, first of all, I would like to thank you for the library. Is there a planned feature that would allow loading a list of movies before playback? The current hook is based on a single URL, but I need to load, for example, 4 movies into the cache. My second question concerns the reuse of the hook on the same URL that I loaded earlier. Is there a delay between each call to setVideoPlayUrlBy, and can it be somehow changed?

@nguyenvanphituoc
Copy link
Owner

Thanks for supporting me and great question.

  • I have planned for building pre-caching hook. You can try my idea here: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/example/src/hooks/useVideoInBackground.tsx.

  • Let me explain this: Assuming you are playing a list of video then want to pre-cache some videos, you need to try to run a shadowing video that I called video in background to do this job and it's style is hidden from your user. It receive a list of pre-caching url and trying cache this in sequence, about m3u8 type that only cache first segment as *.ts file in playlist ( like tiktok or some-else it only cache for first 5s). The problem here is about performance of using multiple video session at the same time with this reason why I still pending

  • About your concerns of the delay between each call is correctly that depend on your phone performance too, I suggest you using recyclelist to solve this

@enfipy
Copy link

enfipy commented Jan 18, 2024

Hey @nguyenvanphituoc, absolutely awesome library!

About caching m3u8 videos - is it possible to not use multiple video sessions but just download the first one or two .ts files if we know the name of it?

@nguyenvanphituoc
Copy link
Owner

Hey @nguyenvanphituoc, absolutely awesome library!

About caching m3u8 videos - is it possible to not use multiple video sessions but just download the first one or two .ts files if we know the name of it?

Interesting question.

  • I have implemented it before, but it not helps improve performance much, at least on mine end. Because, the player will decide which playlist should play that depends on network, performance, resolution... so If you try cache ts file without video sessions then video has probability that does not play them. Yes, I will re-deploy it function for you, don't worry.

  • This case only apply for m3u8 stream with only one playlist, I think it work well in testing environment but not in product environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants