vitoziv / VIMediaCache

Cache media file while play media using AVPlayer
MIT License
968 stars 187 forks source link

Can we preload a video without initializing a player ? #62

Closed shannonchou closed 6 years ago

shannonchou commented 6 years ago

Assuming I have multiple videos on my tableview. Can I preload the next one before playing it ?

vitoziv commented 6 years ago

You can create a VIMediaDownloader.h instance, then call - downloadFromStartToEnd to download all data of the file or - (void)downloadTaskFromOffset: length: toEnd: to download part of file

vitoziv commented 6 years ago

The same URL will cache to the same file.

But before playing the video, you need to cancel the preload downloader, otherwise, the player can't start loading data, because the player will use a different downloader, may cause two downloader writing data to the same cache file in the same time.

shannonchou commented 6 years ago

Thanks for your prompt reply. Awesome framework!