Forum Stats

  • 3,853,900 Users
  • 2,264,290 Discussions
  • 7,905,500 Comments

Discussions

MediaView on Linux

^^ javi ^^
^^ javi ^^ Member Posts: 21
edited Sep 17, 2016 11:57AM in JavaFX 2.0 and Later

Hi!,

I have tried these two tutorials but I do not work either. The video will not play.

IDE Netbeans 8.1

JDK 1.8.0_101

OS Fedora 24 64bits

It could be a bug?

The video can be played locally with VLC.

Best regards.

https://docs.oracle.com/javase/8/javafx/media-tutorial/playercontrol.htm

https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/media-player.htm

Tagged:

Answers

  • ^^ javi ^^
    ^^ javi ^^ Member Posts: 21
    edited Aug 23, 2016 12:10PM

    I installed JDK 1.8.0_102 but video not works.

    I have tested this code in another IDE but does not work.

    [Java] MediaView JavaFX - Pastebin.com

    // create media player

        Media media = new Media("file:///home/user/sample.mp4");

        System.out.println("The Source--> " + media.getSource());

        MediaPlayer mediaPlayer = new MediaPlayer(media);

        mediaPlayer.play();

        MediaControl mediaControl = new MediaControl(mediaPlayer);

        scene.setRoot(mediaControl);

    I haved error in line MediaPlayer mediaPlayer = new MediaPlayer(media);

    Sample video in mp4 format -->  http://www.sample-videos.com/

    The Source--> file:/home/user/sample.mp4Exception in Application start methodjava.lang.reflect.InvocationTargetException  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  at java.lang.reflect.Method.invoke(Method.java:498)  at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)  at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  at java.lang.reflect.Method.invoke(Method.java:498)  at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)Caused by: java.lang.RuntimeException: Exception in Application start method  at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)  at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)  at java.lang.Thread.run(Thread.java:745)Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!  at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)  at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)  at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)  at application.Main.start(Main.java:255)  at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)  at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)  at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)  at java.security.AccessController.doPrivileged(Native Method)  at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)  at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)  at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)  at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)  ... 1 moreCaused by: com.sun.media.jfxmedia.MediaException: Could not create player!  at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:274)  at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118)  at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)  ... 11 moreException running application application.Main

    MPlayer output to FLV video:

    mplayer oow2010-2.flv MPlayer 1.3.0-6.1.1 (C) 2000-2016 MPlayer Teamdo_connect: could not connect to socketconnect: No such file or directoryFailed to open LIRC support. You will not be able to use your remote control.Playing oow2010-2.flv.libavformat version 57.41.100 (external)libavformat file format detected.[flv @ 0x7f60f01d94e0]audio stream discovered after head already parsed[flv @ 0x7f60f01d94e0]video stream discovered after head already parsed[lavf] stream 0: audio (mp3), -aid 0[lavf] stream 1: video (vp6f), -vid 0VIDEO:  [VP6F]  540x209  0bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory[vdpau] Error when calling vdp_device_create_x11: 1[VO_XV] It seems there is no Xvideo support for your video card available.[VO_XV] Run 'xvinfo' to verify its Xv support and read[VO_XV] DOCS/HTML/en/video.html#xv![VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.[VO_XV] Try -vo x11.==========================================================================Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec familylibavcodec version 57.48.101 (external)Selected video codec: [ffvp6f] vfm: ffmpeg (FFmpeg VP6 Flash)==========================================================================Clip info: audiodelay: 0 canSeekToEnd: trueLoad subtitles in ./==========================================================================Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, IIIAUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)==========================================================================AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)Starting playback...Movie-Aspect is undefined - no prescaling applied.VO: [x11] 540x209 => 540x209 Planar YV12 [swscaler @ 0x7f60f0692120]bicubic scaler, from yuv420p to bgra using MMXEXTMovie-Aspect is undefined - no prescaling applied.VO: [x11] 540x209 => 540x209 Planar YV12 A:   0.1 V:   0.1 A-V:  0.017 ct:  0.001   0/  0 ??% ??% ??,?% 0 0                                                                               [VD_FFMPEG] DRI failure.A:  76.3 V:  76.4 A-V: -0.147 ct: -0.012   0/  0  5%  4%  0.4% 0 0                                                                               Exiting... (End of file)

    MPlayer output to MP4 video,

    mplayer sample.mp4 MPlayer 1.3.0-6.1.1 (C) 2000-2016 MPlayer Teamdo_connect: could not connect to socketconnect: No such file or directoryFailed to open LIRC support. You will not be able to use your remote control.Playing sample.mp4.libavformat version 57.41.100 (external)libavformat file format detected.[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f0032d4e4e0]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol[lavf] stream 0: video (h264), -vid 0[lavf] stream 1: audio (aac), -aid 0, -alang undVIDEO:  [H264]  1280x720  24bpp  25.000 fps  1206.0 kbps (147.2 kbyte/s)Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory[vdpau] Error when calling vdp_device_create_x11: 1[VO_XV] It seems there is no Xvideo support for your video card available.[VO_XV] Run 'xvinfo' to verify its Xv support and read[VO_XV] DOCS/HTML/en/video.html#xv![VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.[VO_XV] Try -vo x11.==========================================================================Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec familylibavcodec version 57.48.101 (external)Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)==========================================================================Clip info: major_brand: isom minor_version: 512 compatible_brands: isomiso2avc1mp41 creation_time: 1970-01-01 00:00:00 encoder: Lavf53.24.2Load subtitles in ./==========================================================================Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decodersAUDIO: 48000 Hz, 6 ch, floatle, 384.8 kbit/4.18% (ratio: 48103->1152000)Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))==========================================================================AO: [pulse] 48000Hz 2ch floatle (4 bytes per sample)Starting playback...Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.VO: [x11] 1280x720 => 1280x720 Planar YV12 [swscaler @ 0x7f0033207120]bicubic scaler, from yuv420p to bgra using MMXEXT[swscaler @ 0x7f0033207120]using unscaled yuv420p -> bgra special converter

    A:   5.2 V:   5.2 A-V: -0.072 ct:  0.030   0/  0 16% 10%  0.8% 1 0                                                                             

    Exiting... (End of file)

  • ^^ javi ^^
    ^^ javi ^^ Member Posts: 21
    edited Aug 27, 2016 1:44PM

    Hello,

    In Windows works fine.

    It is possible to make it work on Fedora?

    Regards

  • Manius
    Manius Member Posts: 29
    edited Sep 17, 2016 11:57AM

    Did you notice this line in your error logs? 

    connect: No such file or directory

    Also check permissions, maybe it's not reporting back an appropriate error message.  As a last resort you could try digging into the jfx source code for other clues, since that stack trace tells you where to look.

    Can you play other videos created from entirely different sources?

This discussion has been closed.