LibreTube/app/src/main/java/com/github/libretube/util/BackgroundHelper.kt

19 lines
523 B
Kotlin
Raw Normal View History

2022-07-23 19:11:57 +05:30
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,
2022-08-01 12:25:38 +05:30
position: Long? = null
2022-07-23 19:11:57 +05:30
) {
val intent = Intent(context, BackgroundMode::class.java)
intent.putExtra("videoId", videoId)
if (position != null) intent.putExtra("position", position)
context.startForegroundService(intent)
}
}