Dropbox files & folders
Get in sync with the Dropbox Community. Our members can answer all your questions on Dropbox files and folders. Join a discussion or start your own today.
Hello, in my app I want to be able to play audio files directly from Dropbox. I have already successfully connected the Dropbox API. I can get a list of user files and download them.
What other settings should I make to play audio files? What url should I use for this?
Thanks.
As a direct streaming URL you can do something, used from SDK automatically for download. Instead of download and play, once you have token and file path or file id, you can construct the download URL yourself and use it for streaming.
Hope this gives an idea.
For downloading I use .pathLower of file, but it isn't a URL. How can I create the URL for streaming?
@VyacheslavBakinskiy wrote:For download I use .pathLower of file, but it isn't a URL...
Yes, of course. That's why I told you construct it yourself! The SDK, you are using, constructs it, but you don't have direct access there. It's only for internal use (don't ask me why).
@VyacheslavBakinskiy wrote:... How can I create the URL for streaming?
Did you read the link in my previous post?
Yes, I read. But I don't understand what is the "--header". It's a header of the HTTP request? I don't understand how I can implement this in Swift. Sorry, but I haven't come across this yet. Can you explain to me in more detail?
@VyacheslavBakinskiy wrote:... But I don't understand what is the "--header". It's a header of the HTTP request? ...
Seems you haven't used terminal shell yet. The example, which confuses you, is a just a example of call a Dropbox HTTP API using a Posix's command ( more precisely 'curl' ). This is NOT a URL itself! Yes, it's strange, Dropbox hasn't provided a pure HTTP example too, but it's Dropbox, what can I say. In the particular example curl takes care for URL construction and the call invocation. It's supposed every developer have basic knowledge about what's a URL and all components. The URL is nothing more than provided in the "URL STRUCTURE" field:
https://content.dropboxapi.com/2/files/download
Here the set of parameters is empty, so you don't have to pass anything. What exactly has to be downloaded and from where (i.e. the account) gets denoted with headers (i.e. what follows the "--header"). Last, but not least, the request must be POST. For more info how this could be achieved using Swift take a look here.
Hope this gives enough directions.
Thanks a lot. What other ways are there to solve my question? How about getTemporaryLink function? Can I use it for streaming audio? I found this solution here: https/stackoverflow.com/questions/39247178/how-to-play-dropbox-audio-file-using-jukebox-using-swift
Yes, using a link is a possible way. I didn't mention it, as I'm guess You already have rejected such a possibility. It is more convenient and easy to implement, but have some disadvantages. Less secure and limited traffic (could be banned). If this is not a problem, Yes, of course.
The choice is yours!
Thank you, I will analyze and decide what is best for me.
The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.
Sound good? Let's get started.Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!