LibreTube/app/src/main/java/com/github/libretube/util/BackgroundHelper.kt
2022-07-23 15:41:57 +02:00

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)
}
}