Creates playback managers in a lazy mode, after the initialization of the video caching service.
This commit is contained in:
@@ -12,9 +12,15 @@ import com.vitorpamplona.amethyst.service.HttpClient
|
|||||||
|
|
||||||
@UnstableApi // Extend MediaSessionService
|
@UnstableApi // Extend MediaSessionService
|
||||||
class PlaybackService : MediaSessionService() {
|
class PlaybackService : MediaSessionService() {
|
||||||
private val managerHls = MultiPlayerPlaybackManager(HlsMediaSource.Factory(OkHttpDataSource.Factory(HttpClient.getHttpClient())))
|
private val managerHls by lazy {
|
||||||
private val managerProgressive = MultiPlayerPlaybackManager(ProgressiveMediaSource.Factory(VideoCache.get()))
|
MultiPlayerPlaybackManager(HlsMediaSource.Factory(OkHttpDataSource.Factory(HttpClient.getHttpClient())))
|
||||||
private val managerLocal = MultiPlayerPlaybackManager()
|
}
|
||||||
|
private val managerProgressive by lazy {
|
||||||
|
MultiPlayerPlaybackManager(ProgressiveMediaSource.Factory(VideoCache.get()))
|
||||||
|
}
|
||||||
|
private val managerLocal by lazy {
|
||||||
|
MultiPlayerPlaybackManager()
|
||||||
|
}
|
||||||
|
|
||||||
// Create your Player and MediaSession in the onCreate lifecycle event
|
// Create your Player and MediaSession in the onCreate lifecycle event
|
||||||
@OptIn(UnstableApi::class)
|
@OptIn(UnstableApi::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user