Android Question Making a Vumeter with a Vizualizer PeakLevelAudio for Exoplayer

Discussion in 'Android Questions' started by scsjc, Oct 27, 2018.

  1. scsjc

    scsjc Well-Known Member Licensed User

    I use this code to create a Vumeter with the Vizualizer class playing audio url with Exoplayer.

    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)

    Dim sources As List
    'Initialize the Visualizer
        Dim audiosession As Int = player1.CurrentWindowIndex
        Viz.Initialize(Me, audiosession)
        Viz.CaptureSize = Viz.CaptureSizeRange(
        Viz.SetDataCaptureListener(Viz.GetMaxCaptureRate / 
        Viz.MeasurementMode = 

        Viz.Enabled = 
    End Sub
    Sub Activity_Resume
    End Sub
    Sub Activity_Pause (UserClosed As Boolean)
    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
    End Sub

    Sub Player_Error (Message As String)
    Log("Player_Error " & Message)
    End Sub

    Sub 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 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

    Attached Files:

  2. stevel05

    stevel05 Expert Licensed User

    I have not used SimpleExoplayer, but player1.CurrentWindowIndex does not return a valid audiosystem id that can be used to initialize the Visualizer engine.
    Peter Simpson likes this.
  3. scsjc

    scsjc Well-Known Member Licensed User

    It's true, I just realized. But leaving that variable at 0, it continues to work perfectly in this example. and I do not know why it could be that in an app that I have in production, applying the same does not work.

    Thank you
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice