Android Question MediaPlayer (Skipping / Stuttering)

Robert Valentino

Well-Known Member
Licensed User
Longtime User
It seems my Music App starts and plays clearly only every once in a while

I say once in a while because sometimes it happens twice in a row, then it won't play right for 2 or 3 or up to 5 times then it will.

Is anyone having any problems with MediaPlayer (I am using a Samsung S7 and Galaxy Tablet SM-T580)

Same problem on both.

When it starts up and plays right it plays right forever.
But when it doesn't it doesn't ever.

Just exit restart and see. If bad exit restart and it will eventually start and play right

Sounds like it is Skipping / Stuttering or just out of sync with the speakers (kind of sounds like they are cutting in and out).

I make sure I call Release on the mediaplayers I am using when exiting

This is really starting to drive me crazy. Because i created a simple program that just starts and plays a single track and it starts perfectly every time and plays clearly. So I took my music app and stripped it down to nothing and it still seems to do the same thing.

Just don't even know how to go about debugging something like this.

ANY Help - ANY one

Thanks

BobVal
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have MediaPlayer in a my Service Process_Globals and was doing the Init in my Service_Start have since moved it to Service_Create but still same problem

Should I move MediaPlayer to my Activity?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
This is where I feel so stupid. Every time I unclick the Filter check box on the IDE.

A million messages start scrolling by and they don't ever seem to stop. I just can't catch any meaning full information before they roll of the screen (and out of the list box)

How can I cause these to be written out to a disc file on the PC or at least stop them from happening

Below is a group I caught and it seems like the audio level is being non stop changed (I know I am not looping in a change)
This is just after a startup and my program isn't doing anything just waiting for user input
The second group are with the program running and playing a track normally plays well but sounds like Sh..

The third group has some references to PreVolumne and PreGain makes me wonder if they MediaPlayer is having a problem with MP3Gain files (and all my files have been Mp3Gained)

I surely appreciate the help

B4X:
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 1500, changed = true, showUI = false
GetAppDevice, uid=10142
updateWindowWidth lp.width=624, mCurrentWindowWidth = 624
onStateChangedH animating=false
add MULTI_SOUND flag
isEnabled
GetAppDevice, uid=10019
getStreamVolume 3 index 150
updateVolumeRowH s=5, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
updateVolumeRowH s=3, ss.level : 1500, row.lastAudibleLevel : 1500, row.ss.muted : false
updateVolumeRowH s=1, ss.level : 6, row.lastAudibleLevel : 6, row.ss.muted : false
updateVolumeRowH s=4, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
isSafeVolumeDialogShowing : false
updateVolumeRowH s=0, ss.level : 4, row.lastAudibleLevel : 4, row.ss.muted : false
updateVolumeRowH s=6, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
updateVolumeRowH s=10, ss.level : 15, row.lastAudibleLevel : 15, row.ss.muted : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 12
updateVolumeRowH s=14, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
setStreamVolumeIndex() stream 11, device 00000002, index 12
setStreamVolumeIndex() stream 11, device 00000002, index 12
setStreamVolumeIndex() stream 10, device 00000002, index 12
updateVolumeRowH s=11, ss.level : 0, row.lastAudibleLevel : 1, row.ss.muted : false
setStreamVolumeIndex() stream 9, device 00000002, index 12
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 0
updateVolumeRowH s=12, ss.level : 1500, row.lastAudibleLevel : 600, row.ss.muted : false
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
SB_setVolume(0xe782a100)
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
STREAM_VIDEO_CALL onProgressChanged 1500 fromUser=false
isEnabled
setFineVolume device=2, streamVolume=120, fineVolume=0
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
getStreamVolume 3 index 120
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 1200, changed = true, showUI = false
updateWindowWidth lp.width=624, mCurrentWindowWidth = 624
onStateChangedH animating=false
isEnabled
GetAppDevice, uid=10019
getStreamVolume 3 index 120
updateVolumeRowH s=5, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
updateVolumeRowH s=3, ss.level : 1500, row.lastAudibleLevel : 1500, row.ss.muted : false
updateVolumeRowH s=1, ss.level : 6, row.lastAudibleLevel : 6, row.ss.muted : false
updateVolumeRowH s=4, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
updateVolumeRowH s=0, ss.level : 4, row.lastAudibleLevel : 4, row.ss.muted : false
updateVolumeRowH s=6, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
updateVolumeRowH s=10, ss.level : 15, row.lastAudibleLevel : 15, row.ss.muted : false
updateVolumeRowH s=14, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
updateVolumeRowH s=11, ss.level : 0, row.lastAudibleLevel : 1, row.ss.muted : false
updateVolumeRowH s=12, ss.level : 1200, row.lastAudibleLevel : 1500, row.ss.muted : false
STREAM_VIDEO_CALL onProgressChanged 1200 fromUser=false
setStreamVolume:3 index:6flags:0 package:com.BOBs.MusicDB device:0
GetAppDevice, uid=10142
add MULTI_SOUND flag
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 6
isEnabled
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 10, device 00000002, index 6
setStreamVolumeIndex() stream 9, device 00000002, index 6
setFineVolume device=2, streamVolume=60, fineVolume=0
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 0
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
SB_setVolume(0xe782a100)
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
getStreamVolume 3 index 60
setStreamVolume:3 index:15flags:0 package:com.BOBs.MusicDB device:0
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 600, changed = true, showUI = false
GetAppDevice, uid=10142
updateWindowWidth lp.width=624, mCurrentWindowWidth = 624
onStateChangedH animating=false
add MULTI_SOUND flag
isEnabled
GetAppDevice, uid=10019
getStreamVolume 3 index 60
updateVolumeRowH s=5, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
updateVolumeRowH s=3, ss.level : 1500, row.lastAudibleLevel : 1500, row.ss.muted : false
updateVolumeRowH s=1, ss.level : 6, row.lastAudibleLevel : 6, row.ss.muted : false
updateVolumeRowH s=4, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
updateVolumeRowH s=0, ss.level : 4, row.lastAudibleLevel : 4, row.ss.muted : false
isSa


Part of this stream I find interesting is that there seems to be a change of PreVolumne / PreGain goint on which might be generating the skipping studdering I am hearing/

All my files have MP3Gain settings (Could this be causing these messages)

B4X:
updateVolumeRowH s=4, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
[ -410869632 ][ 48000 ]Exe_Pre() mRequiredPreVolume is changed - dB : -10.001529  mRequiredPreVolume : -10.001529
[ -410869632 ][ 48000 ]Exe_Pre() mRequiredPreGain is changed - dB : -10.001529  mRequiredPreGain : 0.000000
updateVolumeRowH s=0, ss.level : 4, row.lastAudibleLevel : 4, row.ss.muted : false
updateVolumeRowH s=6, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
[ -410869632 ][ 48000 ]Exe_Post() mRequiredPostVolume is changed - dB : -10.001529  mRequiredPostVolume : 0.000000
[ -410869632 ][ 48000 ]Exe_Post() mRequiredPostGain is changed - dB : -10.001529  mRequiredPostGain : -1.000000
updateVolumeRowH s=10, ss.level : 15, row.lastAudibleLevel : 15, row.ss.muted : false
setStreamVolume:3 index:6flags:0 package:com.BOBs.MusicDB device:0
GetAppDevice, uid=10142
add MULTI_SOUND flag
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 6
isEnabled
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 10, device 00000002, index 6
setStreamVolumeIndex() stream 9, device 00000002, index 6
setFineVolume device=2, streamVolume=60, fineVolume=0
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
setStreamVolume:3 index:15flags:0 package:com.BOBs.MusicDB device:0
getStreamVolume 3 index 60
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 600, changed = true, showUI = false
GetAppDevice, uid=10142
add MULTI_SOUND flag
isEnabled
GetAppDevice, uid=10019
updateVolumeRowH s=14, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
isSafeVolumeDialogShowing : false
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
SB_setVolume(0xe782a100)
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
[ -410869632 ][ 48000 ]Exe_Pre() mRequiredPreVolume is changed - dB : -28.001265  mRequiredPreVolume : -10.001265
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 15
setStreamVolumeIndex() stream 11, device 00000002, index 15
setStreamVolumeIndex() stream 11, device 00000002, index 15
setStreamVolumeIndex() stream 10, device 00000002, index 15
setStreamVolumeIndex() stream 9, device 00000002, index 15
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
[ -410869632 ][ 48000 ]Exe_Post() mRequiredPostVolume is changed - dB : -28.001265  mRequiredPostVolume : -18.000000
command EFFECT_CMD_SET_VOLUME left = 1.000000, right =1.000000
isEnabled
setFineVolume device=2, streamVolume=150, fineVolume=0
volumeChanged STREAM_MUSIC MULTI_SOUND
getStreamVolume 3 index 60
setStreamVolume:3 index:12flags:0 package:com.BOBs.MusicDB device:0
isEnabled
GetAppDevice, uid=10142
getStreamVolume 3 index 150
add MULTI_SOUND flag
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 1500, changed = true, showUI = false
isEnabled
GetAppDevice, uid=10019
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 12
setStreamVolumeIndex() stream 11, device 00000002, index 12
setStreamVolumeIndex() stream 11, device 00000002, index 12
setStreamVolumeIndex() stream 10, device 00000002, index 12
setStreamVolumeIndex() stream 9, device 00000002, index 12
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
SB_setVolume(0xe782a100)
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
[ -410869632 ][ 48000 ]Exe_Pre() mRequiredPreGain is changed - dB : -10.001529  mRequiredPreGain : 0.000000
isEnabled
setFineVolume device=2, streamVolume=120, fineVolume=0
updateVolumeRowH s=11, ss.level : 0, row.lastAudibleLevel : 1, row.ss.muted : false
[ -410869632 ][ 48000 ]Exe_Post() mRequiredPostGain is changed - dB : -10.001529  mRequiredPostGain : -1.000000
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
getStreamVolume 3 index 150
getStreamVolume 3 index 120
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 1200, changed = true, showUI = false
isEnabled
GetAppDevice, uid=10019
getStreamVolume 3 index 120
setStreamVolume:3 index:6flags:0 package:com.BOBs.MusicDB device:0
GetAppDevice, uid=10142
add MULTI_SOUND flag
[ -410869632 ][ 48000 ]Exe_Pre() mRequiredPreVolume is changed - dB : -10.001529  mRequiredPreVolume : -10.001529
[ -410869632 ][ 48000 ]Exe_Post() mRequiredPostVolume is changed - dB : -10.001529  mRequiredPostVolume : 0.000000
updateVolumeRowH s=12, ss.level : 1200, row.lastAudibleLevel : 1500, row.ss.muted : false
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 6
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 10, device 00000002, index 6
setStreamVolumeIndex() stream 9, device 00000002, index 6
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
isEnabled
setFineVolume device=2, streamVolume=60, fineVolume=0
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
getStreamVolume 3 index 60
setStreamVolume:3 index:15flags:0 package:com.BOBs.MusicDB device:0
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 600, changed = true, showUI = false
GetAppDevice, uid=10142
add MULTI_SOUND flag
i

onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 1200, changed = true, showUI = false
getStreamVolume 3 index 120
setStreamVolume:3 index:6flags:0 package:com.BOBs.MusicDB device:0
GetAppDevice, uid=10142
add MULTI_SOUND flag
updateVolumeRowH s=1, ss.level : 6, row.lastAudibleLevel : 6, row.ss.muted : false
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 6
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 11, device 00000002, index 6
setStreamVolumeIndex() stream 10, device 00000002, index 6
setStreamVolumeIndex() stream 9, device 00000002, index 6
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
isEnabled
setFineVolume device=2, streamVolume=60, fineVolume=0
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
SB_setVolume(0xe782a100)
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
getStreamVolume 3 index 60
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 600, changed = true, showUI = false
setStreamVolume:3 index:15flags:0 package:com.BOBs.MusicDB device:0
GetAppDevice, uid=10142
add MULTI_SOUND flag
updateVolumeRowH s=4, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
isEnabled
GetAppDevice, uid=10019
getStreamVolume 3 index 60
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 15
setStreamVolumeIndex() stream 11, device 00000002, index 15
setStreamVolumeIndex() stream 11, device 00000002, index 15
setStreamVolumeIndex() stream 10, device 00000002, index 15
setStreamVolumeIndex() stream 9, device 00000002, index 15
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 1.000000, right =1.000000
isEnabled
setFineVolume device=2, streamVolume=150, fineVolume=0
command EFFECT_CMD_SET_VOLUME left = 1.000000, right =1.000000
SB_setVolume(0xe782a100)
command EFFECT_CMD_SET_VOLUME left = 1.000000, right =1.000000
updateVolumeRowH s=0, ss.level : 4, row.lastAudibleLevel : 4, row.ss.muted : false
[ -410869632 ][ 48000 ]Exe_Pre() mRequiredPreVolume is changed - dB : 0.000087  mRequiredPreVolume : 0.000087
[ -410869632 ][ 48000 ]Exe_Post() mRequiredPostVolume is changed - dB : 0.000087  mRequiredPostVolume : 0.000000
volumeChanged STREAM_MUSIC MULTI_SOUND
setStreamVolume:3 index:12flags:0 package:com.BOBs.MusicDB device:0
isEnabled
getStreamVolume 3 index 150
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 1500, changed = true, showUI = false
GetAppDevice, uid=10142
add MULTI_SOUND flag
i

updateVolumeRowH s=3, ss.level : 1500, row.lastAudibleLevel : 1500, row.ss.muted : false
updateVolumeRowH s=1, ss.level : 6, row.lastAudibleLevel : 6, row.ss.muted : false
isSafeVolumeDialogShowing : false
updateVolumeRowH s=4, ss.level : 11, row.lastAudibleLevel : 11, row.ss.muted : false
isMediaSilentMode false
updateVolumeRowH s=0, ss.level : 4, row.lastAudibleLevel : 4, row.ss.muted : false
setStreamVolumeIndex() stream 3, device 00000002, index 12
setStreamVolumeIndex() stream 11, device 00000002, index 12
updateVolumeRowH s=6, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
setStreamVolumeIndex() stream 11, device 00000002, index 12
setStreamVolumeIndex() stream 10, device 00000002, index 12
setStreamVolumeIndex() stream 9, device 00000002, index 12
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
updateVolumeRowH s=10, ss.level : 15, row.lastAudibleLevel : 15, row.ss.muted : false
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 0.316162, right =0.316162
updateVolumeRowH s=14, ss.level : 7, row.lastAudibleLevel : 7, row.ss.muted : false
updateVolumeRowH s=11, ss.level : 0, row.lastAudibleLevel : 1, row.ss.muted : false
isEnabled

SB_setVolume(0xe782a100)
setStreamVolumeIndex() stream 10, device 00000002, index 6
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
setStreamVolumeIndex() stream 9, device 00000002, index 6
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
command EFFECT_CMD_SET_VOLUME left = 0.039795, right =0.039795
isEnabled
setFineVolume device=2, streamVolume=60, fineVolume=0
volumeChanged STREAM_MUSIC MULTI_SOUND
isEnabled
getStreamVolume 3 index 60
onVolumeChangedW stream = 12, flags = 16777216, lastAudibleStreamVolume = 600, changed = true, showUI = false
setStreamVolume:3 index:15flags:0 package:com.BOBs.MusicDB device:0
GetAppDevice, uid=10142
add MULTI_SOUND flag
isEnabled
GetAppDevice, uid=10019
getStreamVolume 3 index 60
isSafeVolumeDialogShowing : false
isMediaSilentMode false
setStreamVolumeIndex() stream 3, device 00000002, index 15
setStreamVolumeIndex() stream 11, device 00000002, index 15
setStreamVolumeIndex() stream 11, device 00000002, index 15
setStreamVolumeIndex() stream 10, device 00000002, index 15
setStreamVolumeIndex() stream 9, device 00000002, index 15
setAudioPolicyConfig: audioParam;fine_volume=0;fine_device=2
getNewOutputDevice() selected device 2
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I don't like to bump posts, but just wanted say what I have tried.

Reinstalled my Android (using Android-28) and installed JDK jdk1.8.0_191 to see if maybe I had a bad library or something corrupt on my drive.

No changes.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
FOUND the problem.

I added a Volume SeekBar in my program and read the last played volume and was setting it on startup

B4X:
Private Sub sMDB_ButtonBar_SeekBar_ValueChanged(Value As Int, UserChanged As Boolean)
           Log("Main::sMDB_ButtonBar_SeekBar_ValueChanged(" &Value &")  UserChanged:" &UserChanged)
           
                 Starter.gMyPhone.SetVolume(Starter.gMyPhone.VOLUME_MUSIC, Value, False)
           Else
                 Starter.gMyPhone.SetVolume(Starter.gMyPhone.VOLUME_MUSIC, Value, False)               

'               Log("Main::sMDB_ButtonBar_SeekBar_ValueChanged - Setting 2")
'               
'                 sMDB_ButtonBar_SeekBar.Value = Value   '  WHY I WAS DOING THIS I Do not know but this was causing the SeekBar to be called over and over again.
           End If
End Sub
 
Upvote 0
Top