stop midi & back to 0 if finished
This commit is contained in:
parent
d015b9b606
commit
8ad6675793
1 changed files with 3 additions and 3 deletions
|
|
@ -118,7 +118,6 @@ class SharedScreenModel() : ScreenModel {
|
|||
private val _isPlayMid = MutableStateFlow(false)
|
||||
val isPlayMid = _isPlayMid.asStateFlow()
|
||||
|
||||
private var midiFile = "whawyd3.mid"
|
||||
|
||||
fun loadNewSong(newMidiFile: String) {
|
||||
_mediaPlayer?.stop()
|
||||
|
|
@ -126,9 +125,10 @@ class SharedScreenModel() : ScreenModel {
|
|||
_isPlay.value = false
|
||||
_currentPos.value = 0f
|
||||
_mediaPlayer = MediaPlayer(filename = newMidiFile, onFinished = {
|
||||
_isPos.value = true
|
||||
_isPlay.value = false
|
||||
// _isPos.value = true
|
||||
// _isPlay.value = false
|
||||
_currentPos.value = 0f
|
||||
seekTo(0f)
|
||||
println("fin de lecture du Midi $newMidiFile")
|
||||
})
|
||||
println("New media Player crée $newMidiFile")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue