You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
cohenadair
7 years agoExplorer | Level 4
iOS getTemporaryLink() cannot be used for streaming
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.
- Greg-DBDropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/51663916/ios-avplayer-not-playing-all-remote-files ]
I see you've already received some help from someone on StackOverflow, and have determined that the issue is likely with the file itself. We can't offer help with the file or AVPlayer themselves unfortunately.
For reference, the links returned by getTemporaryLink are supposed to be direct links to the file, and are not meant for display in browsers, so that browser behavior you described is expected.
- cohenadairExplorer | Level 4Yes, thanks Greg.
Still not sure why that particular video isn't working, but it's clear that it's not a Dropbox issue.- edDaiNew member | Level 2
I have the same problem.
Did you figure out why just particular video able to play in avplayer.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!