I cant seem to find an event that listens for playback state. I am mostly interested in the play/pause
state. I am using MediaController
which has a Play/Pause
button, but I have a secondary button that also controls Play/Pause
. Using my custom button, I can play/pause
, but if I play/pause
using the MediaController
play/pause
button, I currently have no way to change the image on my custom play/pause
button to either play or pause.
Is there an event that I do not know about so I can do some work during play/pause?
This is a very similar question: How to catch event when click pause/play button on MediaController
If you're using the
MediaController
in combination with aVideoView
, it should be relatively easy to extend the latter and add your own listener to it.The custom VideoView would then look something like this in its most basic form:
Using it is identical to using a regular
VideoView
, with the only difference being that we can now hook up our own listener to it.Finally, you may also declare it in your xml layout and inflate it (as shown above) - just make sure your use
<package_name>.CustomVideoView
. Example:You should be able to set your own MediaController.MediaPlayerControl and override pause and start