-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enables downloading tracks behind a feature flag
- Loading branch information
1 parent
1fe824f
commit f1a0337
Showing
15 changed files
with
267 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...eatures/music-player/src/main/java/io/newm/feature/musicplayer/service/DownloadManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.newm.feature.musicplayer.service | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import androidx.media3.common.util.UnstableApi | ||
import androidx.media3.exoplayer.offline.DownloadRequest | ||
import androidx.media3.exoplayer.offline.DownloadService | ||
|
||
interface DownloadManager { | ||
fun download(id: String, url: String) | ||
} | ||
|
||
internal class DownloadManagerImpl( | ||
private val context: Context | ||
) : DownloadManager { | ||
@UnstableApi | ||
override fun download(id: String, url: String) { | ||
val uri = Uri.parse(url) | ||
val downloadRequest = DownloadRequest.Builder(id, uri).build() | ||
|
||
DownloadService.sendAddDownload( | ||
context, | ||
NewmDownloadService::class.java, | ||
downloadRequest, | ||
true // isForeground | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.