javafx - MediaException: PLAYBACK_HALTED : DirectSoundCreate: (NULL)

209 Views Asked by At

I wanto to play a mp4 video inside of my java application. The software is running fine on my main PC where a sound card is installed. But on another PC with no sound device at all, this is the content of the player.getError:

MediaException: PLAYBACK_HALTED : DirectSoundCreate: (NULL)

This is a part of the code:

import java.awt.BorderLayout;
import java.io.File;

import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Mixer.Info;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;

Media m = new Media(file.toURI().toString());
MediaPlayer player = new MediaPlayer(m);
MediaView viewer = new MediaView(player);
             
player.setAutoPlay(true);
player.setCycleCount(MediaPlayer.INDEFINITE);
player.setOnError(()->Logging.getLogger().log("MediaPlayer setOnError: " + player.getError().toString(),Message.MESSAGE));

I can provide more code, if necessary. Once before I provided too much code and got bad comments about that.

My questions, how can I configure javaFX media player or one of it's components to run the video without a sound device. There must be something to configure. But I do not know.

Edit:

I was checking the versions of javafx on both PCs:

System.out.print(com.sun.javafx.runtime.VersionInfo.getRuntimeVersion());

8.0.311-b11 (Office PC where the code is working)

8.0.201-b08 (Shopfloor PC where the code is not working)

Edit:

I have installed a virtual sound card on the shopfloor PC. The error message disappeared. But no video is playing. No error message is showing. No exception is showing.

I need to get in contact with out MES supplier, because my java code on the shopfloor PC is running inside of a MES system.

(MES = Manufacturing Execution System)

0

There are 0 best solutions below