java - MediaPlayer written on JavaFx doesn't work -
i rewrote code form video https://www.youtube.com/watch?v=bwl98dhvf8q (to 7.51). use eclipse(the guy use intellij idea), video have @ directory /home/lynda/workspace/lab11/ , contains focus.mp4 , it`s trailer of film(2:24).
import javafx.application.application; import javafx.scene.group; import javafx.scene.scene; import javafx.stage.stage; import javafx.scene.media.media; import javafx.scene.media.mediaplayer; import javafx.scene.media.mediaview; import javafx.scene.paint.color; public class player extends application{ public static void main(string[] args) { launch(args); } @override public void start(stage stage) throws exception { group root = new group(); media md = new media("file:///home/lynda/workspace/lab11/focus.mp4"); mediaplayer plr = new mediaplayer(md); mediaview view = new mediaview(plr); root.getchildren().add(view); scene scn = new scene(root, 400, 400, color.black); stage.setscene(scn); stage.show(); plr.play(); } }
and have many problems this:
exception in application start method java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ com.sun.javafx.application.launcherimpl.launchapplicationwithargs(launcherimpl.java:389) @ com.sun.javafx.application.launcherimpl.launchapplication(launcherimpl.java:328) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ sun.launcher.launcherhelper$fxhelper.main(launcherhelper.java:767) caused by: java.lang.runtimeexception: exception in application start method @ com.sun.javafx.application.launcherimpl.launchapplication1(launcherimpl.java:917) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication$152(launcherimpl.java:182) @ com.sun.javafx.application.launcherimpl$$lambda$55/29803442.run(unknown source) @ java.lang.thread.run(thread.java:745) caused by: mediaexception: unknown : com.sun.media.jfxmedia.mediaexception: not create player! : com.sun.media.jfxmedia.mediaexception: not create player! @ javafx.scene.media.mediaexception.exceptiontomediaexception(mediaexception.java:146) @ javafx.scene.media.mediaplayer.init(mediaplayer.java:511) @ javafx.scene.media.mediaplayer.<init>(mediaplayer.java:414) @ player.start(player.java:23) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$159(launcherimpl.java:863) @ com.sun.javafx.application.launcherimpl$$lambda$58/4696732.run(unknown source) @ com.sun.javafx.application.platformimpl.lambda$runandwait$172(platformimpl.java:326) @ com.sun.javafx.application.platformimpl$$lambda$50/32203826.run(unknown source) @ com.sun.javafx.application.platformimpl.lambda$null$170(platformimpl.java:295) @ com.sun.javafx.application.platformimpl$$lambda$53/23680289.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ com.sun.javafx.application.platformimpl.lambda$runlater$171(platformimpl.java:294) @ com.sun.javafx.application.platformimpl$$lambda$51/21992497.run(unknown source) @ com.sun.glass.ui.invokelaterdispatcher$future.run(invokelaterdispatcher.java:95) @ com.sun.glass.ui.gtk.gtkapplication._runloop(native method) @ com.sun.glass.ui.gtk.gtkapplication.lambda$null$48(gtkapplication.java:139) @ com.sun.glass.ui.gtk.gtkapplication$$lambda$41/22543536.run(unknown source) ... 1 more caused by: com.sun.media.jfxmedia.mediaexception: not create player! @ com.sun.media.jfxmediaimpl.nativemediamanager.getplayer(nativemediamanager.java:224) @ com.sun.media.jfxmedia.mediamanager.getplayer(mediamanager.java:104) @ javafx.scene.media.mediaplayer.init(mediaplayer.java:467) ... 16 more exception running application player
and sorry english.
Comments
Post a Comment