neekeetab / CachingPlayerItem

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

Simple question, how to cancel a download in progress?! #35

Closed smhk closed 4 years ago

smhk commented 4 years ago

With the amazing CachingPlayerItem, we start a download in the usual way ..

        let pi = CachingPlayerItem(url: uu)
        pi.delegate = self
        playa = OurAVPlayer(playerItem: pi)
        playa!.automaticallyWaitsToMinimizeStalling = false

Say it will take 60 seconds.

Say after 30 seconds, it is half-way, we wish to stop downloading it.

In fact how to do that ??!

(If I just start another one, in fact both the old and new continue to run.)

Thanks!

Where's the tip jar?

neekeetab commented 4 years ago

CachingPlayerItem doesn't have this functionality. But you can cancel requests by calling session.cancel() on ResourceLoaderDelegate. The easiest way to do this is by exposing the resourseLoaderDelegate variable. Not sure how will this affect the playback

smhk commented 4 years ago

@neekeetab , thanks so much for the response - totally understood - thanks a million!

Where's the "tip jar" for CPI ?