neekeetab / CachingPlayerItem

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

Some videos are not playing with request timed out error. #23

Open asifbilal786 opened 5 years ago

asifbilal786 commented 5 years ago

I have properly implemented the CachingPlayerItem functionality in my application. The only problem I am facing is that some videos with streaming URLs are not playing. AVPlayer gives error: "request timed out".

Although using simple AVPlayerItem class AVPlayer plays such videos with no error. Please resolve this issue.

FYI, I am testing it on real device. That is, iPhone 6.

neekeetab commented 4 years ago

Hi,

Sorry for late response.

Have you noticed anything common to all those videos that won't play? Can you provide a link to a video that reproduces the error?

asifbilal786 commented 4 years ago

Yes, it happens for some of the videos. For one of such video, I digged deep into the code and noticed that resource delegate methods are requesting bytes with range that are the last portion(bytes) of video. Hence, downloading video to that range takes too long and AVPlayer causes the error: "request timed out".

BTW, once video is downloaded completely, then works perfectly as cached file.

I will provide you the link within a day.