cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Discuss Dropbox Developer & API

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

why I can't stream an audio stored in dropbox using Android Exoplayer?

why I can't stream an audio stored in dropbox using Android Exoplayer?

celinafregoso99
Explorer | Level 3

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 ?

2 Replies 2

Greg-DB
Dropbox Staff

[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.

Здравко
Legendary | Level 20

@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!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?