cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iOS getTemporaryLink() cannot be used for streaming

iOS getTemporaryLink() cannot be used for streaming

cohenadair
Explorer | Level 4

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

3 Replies 3

Greg-DB
Dropbox 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.

cohenadair
Explorer | Level 4
Yes, thanks Greg.

Still not sure why that particular video isn't working, but it's clear that it's not a Dropbox issue.

edDai
New member | Level 2

I have the same problem. 
Did you figure out why just particular video able to play in avplayer.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    edDai New member | Level 2
  • User avatar
    cohenadair Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?