In the Advanced settings of sound & vibration, you can change the Volume button function.
Path:
realme UI 3.0 & above versions: Settings > Sound & vibration > Advanced/More settings > Volume button function, select Media volume or Ringtone volume.
realme UI 2.0: Settings > Sound & vibration >Volume button function, select Media volume or Ringtone volume.
realme UI 1.0: Settings > Sound & vibration > Volume button function, select Media volume or Ringtone volume.
realme UI R & T & S & Go Edition: Not supported, you can adjust the volume in Settings > Sound & vibration
Related Articles:
How to set Volume button function?
Absolute volume (media volume sync) introduction