-
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 e4dd394
Showing
14 changed files
with
263 additions
and
16 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
28 changes: 28 additions & 0 deletions
28
.../music-player/src/main/java/io/newm/feature/musicplayer/service/DownloadRequestManager.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 DownloadRequestManager { | ||
fun download(id: String, url: String) | ||
} | ||
|
||
class DownloadRequestManagerImpl( | ||
private val context: Context | ||
) : DownloadRequestManager { | ||
@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.