I'm trying to play a video file stored in my Dropbox folder in an `AVPlayer`. The link was retrieved using getTemporaryLink() of SwiftyDropbox.
The Dropbox documentation states that getTemporaryLink() is used to "Get a temporary link to stream content of a file."
However, the link I get is in the form:
https://dl.dropboxusercontent.com/apitl/1/AAC1oJHO88Sfe7yzYA9Pz5a8n8WXu4wUQ8_xfIvmC1ks4nRk4e6i0Y29xYPjupsZZkqObkB3ZSdJA7Jr0ekSliygbbtStEft95ecebhJqewd52IZZ4aL4x0a_tG5XJCA9_i-xCkcLIFW1uSuqYKWD2OLeXPVtilD6zp_ukpi4b6-hORw9-VdX6PsxR9HV-KX9hDN_QqTTY3wjJ4S-dBneBvGlCJn4cnuJ3utEnu5w7eiRKFC3x0dFDkJIDnlOWQDQ0qGRXckcnRLmsbiybuT2px83GkxeUOW8gEWIhwM8M38bg
Which, is a download link. The file in question is in the `Apps/MyApp` Dropbox folder .
I use the following code to attempt to play the video:
self.previewPlayer.replaceCurrentItem(with: AVPlayerItem(url: URL(fileURLWithPath: url)))
self.previewPlayer.play()
A few things to note:
- The player doesn't do anything.
- I don't get any errors or warnings in the console.
- I gave the player's layer a red background colour to make sure it's being rendered, and it is.
- The path I'm passing to `getTemporaryLink()` is in the format `/folder/some file.mov`.
- I don't think there's anything wrong with my AVFoundation code, as using a local/remote link with a .mov file extension works as expected.
Going to the temporary link in my browser downloads the file. I'm not sure if this is expected.
Any help is appreciated.
Stack Overflow post for reference