Skip to content

Commit

Permalink
Starting with PREPARING state
Browse files Browse the repository at this point in the history
  • Loading branch information
Coneys authored and Coneys committed Apr 27, 2018
1 parent cbafda1 commit e138f09
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<MediaInfo> = 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<MediaInfo> {
Expand Down Expand Up @@ -145,9 +145,6 @@ class MediaStateResolver(private val player: MediaPlayer) : MediaPlayer.OnPrepar
positionSubject.onNext(millisecond)
}

fun startMusic() {
stateSubject.onNext(MediaState.PREPARING)
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit e138f09

Please sign in to comment.