dimanche 8 février 2015

Programmatically Changing the volume of video at specfic time interval when it is playing

I want to decrease the volume of video after a specific time interval when it is being played.I can think of using



videoView.postDelayed(new Runnable() {

@Override
public void run() {


}
}, 20000);


to create an event after specified time.But for changing volume we need to get the MediaPlayer instance of VideoView(mediaplayer.setVolume(0,0)) which can be done by following listeners



void setOnCompletionListener(MediaPlayer.OnCompletionListener l)
void setOnErrorListener(MediaPlayer.OnErrorListener l)
void setOnInfoListener(MediaPlayer.OnInfoListener l)
void setOnPreparedListener(MediaPlayer.OnPreparedListener l)


but all of these listeners are called either at the beginning of video or at the end of video or when we get error.But i need mediaplayer instance at a specific time interval.How can I change the volume of video at specific time interval when it is being played?


Aucun commentaire:

Enregistrer un commentaire