Question

What I'm doing currently is that, I have a remote URL containing a MP4 file. I download that into a file using NSData and NSFileManager (as I want to cache the file). Now I start to play the file using AVPlayer.

All this works. But the problem is,when the video is getting buffered after a few seconds, the playback cannot be resumed.

Note:

The state of the AVPlayer does not change to Pause.

The current time of the video continues to run even though the video has stalled.

Is there anyway I can pause the video before the buffer happens? Thanks in advance.

Was it helpful?

Solution

Fixed it myself. Created a file and the downloaded data is written into the file only after say 1MB of it has been downloaded and the player is made to pause when say 90% of this data has been read. This way the player doesn't stall.In the background the file continues to be downloaded. This way the size of the file will continue to increase even if the player is playing/pausing the video.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top