neekeetab / CachingPlayerItem

Play and cache media content simultaneously on your iOS device
MIT License
520 stars 89 forks source link

Downloading starts immediately after CachingPlayerItem created #14

Open hssrrw opened 5 years ago

hssrrw commented 5 years ago

Hey. I'm pretty new to iOS development so I probably misunderstand something.

What I see is CachingPlayerItem starts downloading right after I create a new instance of it. What I expect is that it starts downloading either after play() is called for AVPlayer or download() for CachingPlayerItem. In this case, it's not very clear what the purpose of download() is.

neekeetab commented 5 years ago

I can confirm the same behavior

neekeetab commented 5 years ago

I've taken a look at this issue again and figured out that it's instantiating AVPlayer with an item that triggers the download. This wasn't the case before, apparently Apple has changed the implementation slightly at some point.

joeldrotleff commented 4 years ago

I believe this is intentional behavior; it's useful so that you can "preload" a video by just instantiating an AVPlayer before you actually intend to start playing it