I'm using SwiftyDropbox
's getTemporaryLink()
to play a video in an AVPlayer
. I have six test files, and they all work as expected, except 1.
The one that doesn't work is 41 MB in size (which I would not consider a large video file), the rest are < 22 MB.
I've read the AVFoundation
and SwiftDropbox
documentation many times and haven't been able to find anything on a maximum file size, though I wouldn't expect a maximum file size for streaming content. I would expect it to continuously play smaller chunks downloaded to memory.
My questions are:
- Is there a file size limit on playing a remote URL in an
AVPlayer
? - If not, is there a certain way I need to use
AVPlayer
in order to stream these larger files?
I'm using the following code to start the AVPlayer
:
self.previewPlayer.replaceCurrentItem(with: AVPlayerItem(url: URL(fileURLWithPath: url)))
self.previewPlayer.play()
Thank-you!
You should observe the value of
status
property to know why the playerItem might have failed to play. Here's a small code snippet to start with:Add observer
Check for the the error