How to play ts file using the cache in the AVPlayer?

1.6k views Asked by At

I want to cache the HLS in the ts file. Apple demo site use custom schema for this site.

https://developer.apple.com/library/ios/samplecode/sc1791/Introduction/Intro.html

This sample use custom schema. But it's use redirect for ts file. I searched "How to play ts file using the cache in the AVPlayer". I found use redirect local proxy. But it method is prohibited to Apple that the move background.

https://developer.apple.com/library/ios/technotes/tn2277/_index.html#//apple_ref/doc/uid/DTS40010841-CH1-SUBSECTION2

Is it possible to start the ts file cached locally on the AVPlayer ?

1

There are 1 answers

0
Sajad Khan On

As far as I know, Its not possible to play ts files directly using iOS Player (AVPlayer). But there is a way to play it.

  1. Download the .ts file and save it in app document directory.
  2. Use this library Keemotion/TS2MP4 to convert ts file to mp4 which can be played using AVPlayer.

Now you can either do it discreetly downloading -> convert -> play for each single file. or You can download multiple -> convert them to one large mp4 file and play it.