Android Question How to change playback speed with Media3 ExoPlayer in B4A 13.4?

khwarizmi

Active Member
Licensed User
Longtime User
Hello,


I have recently updated B4A to version 13.4, where ExoPlayer (Media3) is now included as an internal library.
I need to change the playback speed of an audio file.


I added at the beginning of the code:

B4X:
#AdditionalJar: androidx.core:core-ktx






Previously, I was using this code:



B4X:
Dim pp As JavaObject
pp.InitializeNewInstance("com.google.android.exoplayer2.PlaybackParameters", Array(1.5f, 1.0f))
Dim jo As JavaObject = player
jo.RunMethod("setPlaybackParameters", Array(pp))


But now I get an error saying that the class



B4X:
com.google.android.exoplayer2.PlaybackParameters


cannot be found.


It seems that in Media3 it has moved to:



B4X:
androidx.media3.common.PlaybackParameters


👉 What is the correct way to use PlaybackParameters with the new Media3 ExoPlayer in B4A 13.4 to change the playback speed?


Thanks in advance! 🌹
 
Last edited:

zed

Well-Known Member
Licensed User
 
Upvote 1
Solution
Top