简体   繁体   English

使用vlcj设置声音输出设备

[英]Set sound output device using vlcj

I would like to set my vlcj created player to output sound to virtual audio cable, is it possible? 我想设置我的vlcj创建的播放器将声音输出到虚拟音频线,是否可能? The vlcj player doesn't seem to inherit the options from the native player, so I dont really know how I could change the output. vlcj播放器似乎没有从本机播放器继承选项,所以我真的不知道如何更改输出。 Thanks 谢谢

edit: This is basically how far i've gotten, but nothing actually happens: 编辑:这基本上是我已经走了多远,但实际上没有发生任何事情:

mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
    mediaPlayerComponent.getMediaPlayer().setPlaySubItems(true);

    List<AudioOutput> outputs = mediaPlayerComponent.getMediaPlayerFactory().getAudioOutputs();

    for (AudioOutput i : outputs) {
        System.out.println(i);
        List<AudioDevice> devices = i.getDevices();
        if (!devices.isEmpty()) {
            for (AudioDevice itdev : devices) {
                System.out.println(itdev.getDeviceId());
            }
        }
    }
    mediaPlayerComponent.getMediaPlayer().setAudioOutputDevice(outputs.get(5).getDevices().get(3).toString(), outputs.get(5).getDevices().get(3).toString());

Presumably your "virtual audio cable" is a specific audio output device. 据推测,您的“虚拟音频线”是一种特定的音频输出设备。

So, get the list of AudioOutput from the MediaPlayerFactory . 因此,从MediaPlayerFactory获取AudioOutput列表。

Enumerate that list of outputs to find the one you want, by name. 枚举该输出列表,按名称查找所需的输出。

When you find the audio output you want, you can inspect the list of AudioDevice associated with that output. 找到所需的音频输出后,可以检查与该输出关联的AudioDevice列表。

When you find the audio device you want, set it on the MediaPlayer . 找到所需的音频设备后,在MediaPlayer上进行设置。 There are setAudioOutput() and setAudioOutputDevice() methods there. 那里有setAudioOutput()setAudioOutputDevice()方法。

The associated vlcj-player project at github shows one way to build a menu of audio devices and allows you to select one. github上相关的vlcj-player项目显示了构建音频设备菜单的一种方法,并允许您选择一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM