Android Question ExoPlayer setting the volume level

rleiman

Well-Known Member
Licensed User
Nice library but it needs a more detailed tutorial.

I tried to set the volume like this:

B4X:
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:

B4X:
Creates a single dimension array of the specified type.
The syntax is: Array [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:

B4X:
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.
 
Top