How to mute/unmute Video using Exoplayer control view with Imagebutton icon

1.8k Views Asked by At

Hi Im developing one video application Here I am using exoplayerview for playing video.In this videoview Im using exoplayer control view.In this control I change custom icon such as Mute/Unmute Icon.while Im clicking the icon the coontrol view is getting hide.But not able to mute or unmute the video.Can you Please help how to fix this problems..

1

There are 1 best solutions below

0
Aleyam On BEST ANSWER

hope you're doing good, here is a snippet you can use to achieve what you want to do

fun setTwoStateVolume(mute : Boolean) {
        player?.volume = if (mute) 0F else 1F
}

so call this function inside your "mute" and "unmute" button listener where player here is an instance of SimpleExoPlayer

for more info checkout this link.