This message was deleted.
# ios
s
This message was deleted.
not kotlin but kotlin colored 3
m
There's probably a lot more to it. For instance you likely need an auth token in order to download from DropBox
Likely you can't stream from a Dropbox download link anyway
Mind sharing what you have tried?
y
sure, so far I am downloading the Dropbox mp3 file then I can play it using AVPlayer, I have no issues regarding that, but what I am having an issue with is playing the URL remotely without downloading it with AvPlayer,( I want users that have limited storage capacity in their phones to still listen to the audio) I just wasn't able to do so, here is how I am converting the path/url to an AVPlayerItem
Copy code
override fun convertToMediaItem(path: String, url: String): MediaItem {
    return if (path.startsWith("https://")) {
        val audioUrl = NSURL.URLWithString(path) ?: NSURL(string = path)
        AVPlayerItem(uRL = audioUrl)
    } else {
        if (fileManager.fileExistsAtPath(path)) {
            AVPlayerItem(uRL = NSURL.fileURLWithPath(path))
        } else {
            val audioUrl = NSURL.URLWithString(url) ?: NSURL(string = url)
            AVPlayerItem(uRL = audioUrl)
        }
    }
}
at the end of the dropBox link, there is dl=0 this ensures that the link is not downloadable if set to dl=1 I will be able to download it I tried passing both, you can even add .mp3 at the end of the link, but it didn't work.
m
Think the emoji reaction has spoken. this isn't really a Kotlin related question
Not too sure, if you're suggesting you can download the MP3 without any auth, but doesn't stream no AVPlayer. I'd hazard a guess Dropbox don't allow it