B4J Question [ Linux Failure Media ] MediaException

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
hello everyone !!

i am trying to load some video with MediaPlayer, but when i run on Linux , i get this error :

B4X:
java:7619): Gtk-WARNING **: 16:25:44.783: Não foi possível localizar a ferramenta de temas no module_path: "murrine",

(java:7619): Gtk-WARNING **: 16:25:44.783: Não foi possível localizar a ferramenta de temas no module_path: "murrine",

(java:7619): Gtk-WARNING **: 16:25:44.783: Não foi possível localizar a ferramenta de temas no module_path: "murrine",

(java:7619): Gtk-WARNING **: 16:25:44.786: Não foi possível localizar a ferramenta de temas no module_path: "murrine",

(java:7619): Gtk-WARNING **: 16:25:44.786: Não foi possível localizar a ferramenta de temas no module_path: "murrine",

(java:7619): Gtk-WARNING **: 16:25:44.786: Não foi possível localizar a ferramenta de temas no module_path: "murrine",

(java:7619): Gtk-WARNING **: 16:25:44.786: Não foi possível localizar a ferramenta de temas no module_path: "murrine",
*** mainpage: B4XPage_Created
b4xpagesmanager._createpageifneeded (java line: 305)
java.lang.RuntimeException: java.lang.RuntimeException: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:513)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:459)
    at b4j.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:305)
    at b4j.example.b4xpagesmanager._showpage(b4xpagesmanager.java:720)
    at b4j.example.b4xpagesmanager._addpage(b4xpagesmanager.java:117)
    at b4j.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:124)
    at b4j.example.b4xpagesmanager._initialize(b4xpagesmanager.java:489)
    at b4j.example.main._appstart(main.java:72)
    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 anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
    at b4j.example.main.start(main.java:37)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$10(GtkApplication.java:245)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:137)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:504)
    ... 23 more
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:518)
    at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:421)
    at anywheresoftware.b4j.objects.MediaPlayerWrapper.Initialize(MediaPlayerWrapper.java:46)
    at b4j.example.b4xmainpage$ResumableSub_B4XPage_Created.resume(b4xmainpage.java:94)
    at b4j.example.b4xmainpage._b4xpage_created(b4xmainpage.java:55)
    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 anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    ... 24 more
Caused 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:474)
    ... 33 more

using this code :
B4X:
Dim mp As MediaPlayer
Dim jo,mv As JavaObject
mp.Initialize("mp",File.geturi(File.DirApp,"swgames.mp4"))
mv=jo.InitializeNewInstance("javafx.scene.media.MediaView",Array As Object(mp))
B4XPages.GetNativeParent(Me).RootPane.AddNode(mv,0,0,Root.Width,Root.Height)
mp.Play

what am I doing wrong ?
 

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
the warnings are gone, but the MediaException problem still persists...

B4X:
*** mainpage: B4XPage_Created
b4xpagesmanager._createpageifneeded (java line: 305)
java.lang.RuntimeException: java.lang.RuntimeException: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:513)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:459)
    at b4j.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:305)
    at b4j.example.b4xpagesmanager._showpage(b4xpagesmanager.java:720)
    at b4j.example.b4xpagesmanager._addpage(b4xpagesmanager.java:117)
    at b4j.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:124)
    at b4j.example.b4xpagesmanager._initialize(b4xpagesmanager.java:489)
    at b4j.example.main._appstart(main.java:72)
    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 anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
    at b4j.example.main.start(main.java:37)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(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$10(GtkApplication.java:245)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:137)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:504)
    ... 23 more
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:518)
    at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:421)
    at anywheresoftware.b4j.objects.MediaPlayerWrapper.Initialize(MediaPlayerWrapper.java:46)
    at b4j.example.b4xmainpage$ResumableSub_B4XPage_Created.resume(b4xmainpage.java:94)
    at b4j.example.b4xmainpage._b4xpage_created(b4xmainpage.java:55)
    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 anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
    ... 24 more
Caused 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:474)
    ... 33 more
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Have you tried reading the file from another directory, not dirapp.
 
Upvote 0
Top