Android Question ExoPlayer setting the volume level

Discussion in 'Android Questions' started by rleiman, Jan 17, 2018.

  1. rleiman

    rleiman Well-Known Member Licensed User

    Nice library but it needs a more detailed tutorial.

    I tried to set the volume like this:

    Code:
    exoPlayer.Volume(.5)
    but I get an error telling me it expects an array. I have not used arrays yet so I found this example:

    Code:
    Creates a single dimension array of the specified type.
    The syntax 
    isArray [As type] (list of values).
    If the type is ommitted then an array of objects will be created.
    Example:
    Dim Days() As String
    Days = 
    Array As String("Sunday""Monday", ...)
    so I added the following code based on the example:

    Code:
    Dim VolumeArray() As Float
    VolumeArray = 
    Array As Float(.5)
    exoPlayer.Volume(VolumeArray)
    exoPlayer.Prepare(exoPlayer.CreateFileSource(
    File.DirAssets, "quarter.mp3"))
    exoPlayer.Play
    but I still get the array expected error. Looks like I did not code the array correctly.

    An example of setting the volume level would greatly be appreciated.

    Thanks.
     
  2. nobbi59

    nobbi59 Active Member Licensed User

    You dont need an Array for Volume, just do

    Code:
    exoPlayer.Volume = .5
     
    Erel and rleiman like this.
  3. rleiman

    rleiman Well-Known Member Licensed User

    Hi nobbi59,

    Thanks for the help. Works really well. :)
     
Loading...
  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