1

I have a VideoView, and I want to play a short looped video with no audio. The problem is, when I'm listening to a book or music through my phone and then I get to the activity that plays this looped video, my music is paused. Is there a way to play the video without interrupting whatever audio might be already playing on the phone?

videoView.setVideoURI(descriptionVideo.getUri(getPackageName()));
            videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mediaPlayer) {
                    mediaPlayer.setVolume(0f,0f);
                    mediaPlayer.setLooping(true);
                    videoView.start();
                }
            });
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
  • 1
    Possible duplicate of [How to prevent VideoView/MediaPlayer from stopping other apps' audio?](https://stackoverflow.com/questions/29280191/how-to-prevent-videoview-mediaplayer-from-stopping-other-apps-audio) – Dan Harms Jan 04 '19 at 17:35

1 Answers1

0

I think it's because the VideoView asked for audio focus. You could try below videoView.setAudioFocusRequest(AudioManager.AUDIOFOCUS_NONE)

오효민
  • 181
  • 1
  • 4