From e138f09427751675a0bd022f8a0e22013aa7a4a7 Mon Sep 17 00:00:00 2001 From: Coneys Date: Fri, 27 Apr 2018 14:20:18 +0200 Subject: [PATCH] Starting with PREPARING state --- .../rxaudiomanager/mediaListener/MediaStateResolver.kt | 5 +---- .../rxaudiomanager/simpleMediaManager/InternalMediaPlayer.kt | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/mediaListener/MediaStateResolver.kt b/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/mediaListener/MediaStateResolver.kt index fc972bf..d1be3b4 100644 --- a/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/mediaListener/MediaStateResolver.kt +++ b/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/mediaListener/MediaStateResolver.kt @@ -32,7 +32,7 @@ class MediaStateResolver(private val player: MediaPlayer) : MediaPlayer.OnPrepar private val infoFunction4 = Function4 { t1: MediaState, t2: Percent, t3: Second, t4: Second -> MediaInfo(t1, t2, t3, t3 / 1000, t4) } val infoSubject: Observable = Observable.combineLatest( - stateSubject.startWith(MediaState.STOPPED), bufferSubject.startWith(100), + stateSubject.startWith(MediaState.PREPARING), bufferSubject.startWith(100), positionSubject.startWith(0), durationSubject.startWith(0), infoFunction4) fun initialize(): Observable { @@ -145,9 +145,6 @@ class MediaStateResolver(private val player: MediaPlayer) : MediaPlayer.OnPrepar positionSubject.onNext(millisecond) } - fun startMusic() { - stateSubject.onNext(MediaState.PREPARING) - } } \ No newline at end of file diff --git a/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/simpleMediaManager/InternalMediaPlayer.kt b/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/simpleMediaManager/InternalMediaPlayer.kt index 95b6563..8f6ca44 100644 --- a/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/simpleMediaManager/InternalMediaPlayer.kt +++ b/rxaudiomanager/src/main/java/github/com/coneey/rxaudiomanager/simpleMediaManager/InternalMediaPlayer.kt @@ -113,7 +113,6 @@ open class InternalMediaPlayer(val player: MediaPlayer, val context: Context, is AssetFileDescriptor -> it.setDataSource(dataSource.fileDescriptor, dataSource.startOffset, dataSource.length) is FileDescriptor -> it.setDataSource(dataSource) } - resolver.startMusic() it.prepareAsync() }