H.264 media player with JavaFX

H.264 media player with JavaFX



I am trying to display a H.264 stream (of the Raspberry Pi camera, thanks to uv4l) in a JavaFX app. H.264 is supposed to be supported by JavaFX. However, I keep getting a blank screen and this error :



MediaException: MEDIA_UNSUPPORTED : Unrecognized file signature!

at javafx.scene.media.Media._setError(Media.java:513)

at javafx.scene.media.Media$InitLocator.run(Media.java:566)

at java.lang.Thread.run(Thread.java:745)



Here's my code :


import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;
import javafx.stage.Stage;

public class Main extends Application

private static MediaView mv = new MediaView();
private Media media;

public static void main(String args)
launch(args);

@Override
public void start(Stage stage) throws Exception
media = new Media("http://192.168.0.10:8080/stream/video.h264");
MediaPlayer mp = new MediaPlayer(media);
mp.setAutoPlay(true);
mv.setMediaPlayer(mp);
Group root = new Group(mv);
Scene scene = new Scene(root, 640, 480);
stage.setTitle("Pi_Cam");
stage.setScene(scene);
stage.show();
mp.errorProperty().addListener((observable, oldValue, newValue) ->
newValue.printStackTrace();
);





0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)