Discuss Dropbox Developer & API
I can use an exoplayer like this
lateinit var player : SimpleExoPlayer!
val mediaItem = MediaItem.fromUri("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
player = SimpleExoPlayer.Builder(mContext).build()
player.setMediaItem(mediaItem)
playerView.player = player
I can stream the audio without any use if I use the code above.
but if I want to use an audio file that have in dropbox, the sound will never play, the code and link is like this
val mediaItem = MediaItem.fromUri("https://www.dropbox.com/s/lbe1kod9t6yuh5j/sample1.m4a")
how to solve this ?
[Cross-linking for reference: https://stackoverflow.com/questions/64764134/why-i-cant-stream-an-audio-stored-in-dropbox-using-andr... ]
It looks like you already have an accepted answer on StackOverflow, but let us know if there's still anything we can help with.
@celinafregoso99 wrote:...
val mediaItem = MediaItem.fromUri("https://www.dropbox.com/s/lbe1kod9t6yuh5j/sample1.m4a")
how to solve this ?
You're not pointing media file but a preview page (i.e. HTML)! One alternative is download link:
val mediaItem = MediaItem.fromUri("https://www.dropbox.com/s/lbe1kod9t6yuh5j/sample1.m4a?dl=1")
Or might be better raw shared link:
val mediaItem = MediaItem.fromUri("https://www.dropbox.com/s/lbe1kod9t6yuh5j/sample1.m4a?raw=1")
Good luck!
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 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!