MG lolenstine
MG lolenstine

Reputation: 969

Is there a way to only play audio from a video?

I want to play a downloaded talk show, but I only want to play audio. Whenever I do MediaPlayer.media().play("video.mp4"), it opens the video in a pop-up window. Is there a way to hide that window, or to disable video track if needed?

I've tried setting renderer to null, but it doesn't do anything

mediaPlayer.setRenderer(null);
String url = "video.mp4";
mediaPlayer.media().play(url);

I'd like to only play Audio from a video, but I always get a pop-up playing video track.

Upvotes: 3

Views: 262

Answers (1)

caprica
caprica

Reputation: 4146

You can do this with custom VLC switches passed as media player factory arguments:

MediaPlayerFactory factory = new MediaPlayerFactory("--novideo");
AudioMediaPlayerComponent mediaPlayer = new AudioMediaPlayerComponent(factory);

You don't need to use AudioMediaPlayerComponent, it just happens to be the most convenient.

Upvotes: 4

Related Questions