mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-16 07:10:29 +05:30
19 lines
522 B
Kotlin
19 lines
522 B
Kotlin
package com.github.libretube.util
|
|
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import com.github.libretube.services.BackgroundMode
|
|
|
|
object BackgroundHelper {
|
|
fun playOnBackground(
|
|
context: Context,
|
|
videoId: String,
|
|
position: Int? = null
|
|
) {
|
|
val intent = Intent(context, BackgroundMode::class.java)
|
|
intent.putExtra("videoId", videoId)
|
|
if (position != null) intent.putExtra("position", position)
|
|
context.startForegroundService(intent)
|
|
}
|
|
}
|