Skip to content
Snippets Groups Projects
Commit 99daa043 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Restore volume when switching apps and volume > 100

Fixes #740
parent c161eb43
No related branches found
No related tags found
1 merge request!1008Restore volume when switching apps and volume > 100
Pipeline #109388 passed with stage
in 3 minutes and 8 seconds
......@@ -1437,6 +1437,7 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
service.setVolume(vol.toFloat().roundToInt())
}
overlayDelegate.showVolumeBar(vol, fromTouch)
volSave = service.volume
}
}
......@@ -2035,6 +2036,7 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
handler.post {
// delay mediaplayer loading, prevent ANR
if (service.volume > 100 && !isAudioBoostEnabled) service.setVolume(100)
if (volSave > 100 && service.volume != volSave) service.setVolume(volSave)
}
service.addCallback(this)
} else if (this.service != null) {
......
......@@ -3,6 +3,7 @@ package org.videolan.vlc.media
import android.content.Context
import android.net.Uri
import android.support.v4.media.session.PlaybackStateCompat
import android.util.Log
import android.widget.Toast
import androidx.annotation.MainThread
import androidx.core.net.toUri
......@@ -99,7 +100,11 @@ class PlayerController(val context: Context) : IVLCVout.Callback, MediaPlayer.Ev
@MainThread
fun restart() {
val mp = mediaplayer
val volume = mp.volume
mediaplayer = newMediaPlayer()
if (volume != 100) {
mediaplayer.volume = volume
}
release(mp)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment