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
|
||||
class PlaybackService : MediaSessionService() {
|
||||
private val managerHls = MultiPlayerPlaybackManager(HlsMediaSource.Factory(OkHttpDataSource.Factory(HttpClient.getHttpClient())))
|
||||
private val managerProgressive = MultiPlayerPlaybackManager(ProgressiveMediaSource.Factory(VideoCache.get()))
|
||||
private val managerLocal = MultiPlayerPlaybackManager()
|
||||
private val managerHls by lazy {
|
||||
MultiPlayerPlaybackManager(HlsMediaSource.Factory(OkHttpDataSource.Factory(HttpClient.getHttpClient())))
|
||||
}
|
||||
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
|
||||
@OptIn(UnstableApi::class)
|
||||
|
||||
Reference in New Issue
Block a user