I use this code to create a Vumeter with the Vizualizer class playing audio url with Exoplayer.
This example works correctly, but I do not know why because when I try to add it to my code it gives me this error:
I have read on https://github.com/felixpalmer/android-visualizer/issues/31 that may be due "android.permission.RECORD_AUDIO", but I have it correctly.
Has anyone had a similar problem? or have some better solution than this to be able to do a Vumeter using the ExoPlayer
B4X:
Sub Process_Globals
Dim Timer As Timer
Private player1 As SimpleExoPlayer
End Sub
Sub Globals
Dim Viz As Vizualizer
End Sub
Sub Activity_Create(FirstTime As Boolean)
player1.Initialize("player")
Dim sources As List
sources.Initialize
sources.Add(player1.CreateUriSource("http://icecast-streaming.nice264.com/europafm"))
player1.Prepare(player1.CreateListSource(sources))
'Initialize the Visualizer
Dim audiosession As Int = player1.CurrentWindowIndex
Viz.Initialize(Me, audiosession)
Viz.CaptureSize = Viz.CaptureSizeRange(1)
Viz.SetDataCaptureListener(Viz.GetMaxCaptureRate / 2,True,True)
Viz.MeasurementMode = 1
Timer.Initialize("Timer", 100)
Timer.Enabled=True
Viz.Enabled = True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Viz.StopDataCapture
Viz.Release
End Sub
Sub FFT_Capture(Data() As Byte,SamplingRate As Int)
' Log("FFT " & Data.Length)
' Log(SamplingRate)
End Sub
Sub Wave_Capture(Data() As Byte,SamplingRate As Int)
' Log("Wav " & Data.Length)
' Log(SamplingRate)
End Sub
Sub Timer_Tick
Log("Peak LevelAudio: " & Viz.getMeasurementPeakRms.mPeak)
End Sub
Sub Player_Ready
Log("Player_Ready")
player1.Play
End Sub
Sub Player_Error (Message As String)
Log("Player_Error " & Message)
End Sub
Sub Player_Complete
Log("Player_Complete")
End Sub
This example works correctly, but I do not know why because when I try to add it to my code it gives me this error:
I have read on https://github.com/felixpalmer/android-visualizer/issues/31 that may be due "android.permission.RECORD_AUDIO", but I have it correctly.
Has anyone had a similar problem? or have some better solution than this to be able to do a Vumeter using the ExoPlayer