java - MediaPlayer in JavaFX -
java - MediaPlayer in JavaFX -
i concerned fact javafx has suffered modifications since day of tutorial: http://www.youtube.com/watch?v=bwl98dhvf8q .
please, give me hints should alter in code, or kind of code valid, @ all? give thanks you.
here's code:
import javafx.application.application; import javafx.scene.scene; import javafx.scene.media.media; import javafx.scene.media.mediaplayer; import javafx.scene.media.mediaview; import javafx.scene.paint.color; import javafx.stage.stage; import javafx.scene.group; public class biplayer extends application { public static void main(string[] args){ launch(args); } @override public void start(stage primarystage) throws exception { grouping videopane = new group(); media media = new media("c:\\users\\insanovation\\downloads\\p.mp4"); mediaplayer player = new mediaplayer(media); mediaview view = new mediaview(player); videopane.getchildren().add(view); scene scene = new scene (videopane, 400, 400, color.black); primarystage.setscene(scene); primarystage.show(); player.play(); } }
here's output:
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:483) @ com.sun.javafx.application.launcherimpl.launchapplicationwithargs(launcherimpl.java:363) @ com.sun.javafx.application.launcherimpl.launchapplication(launcherimpl.java:303) @ 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:483) @ 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:875) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication$147(launcherimpl.java:157) @ com.sun.javafx.application.launcherimpl$$lambda$48/1394438858.run(unknown source) @ java.lang.thread.run(thread.java:745) caused by: java.lang.illegalargumentexception: java.net.urisyntaxexception: illegal character in opaque part @ index 2: c:\users\insanovation\downloads\f.mp3 @ javafx.scene.media.media.<init>(media.java:383) @ biplayer.biplayer.start(biplayer.java:24) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$153(launcherimpl.java:821) @ com.sun.javafx.application.launcherimpl$$lambda$51/270894642.run(unknown source) @ com.sun.javafx.application.platformimpl.lambda$runandwait$166(platformimpl.java:323) @ com.sun.javafx.application.platformimpl$$lambda$44/1147985808.run(unknown source) @ com.sun.javafx.application.platformimpl.lambda$null$164(platformimpl.java:292) @ com.sun.javafx.application.platformimpl$$lambda$47/1822121612.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ com.sun.javafx.application.platformimpl.lambda$runlater$165(platformimpl.java:291) @ com.sun.javafx.application.platformimpl$$lambda$45/1267032364.run(unknown source) @ com.sun.glass.ui.invokelaterdispatcher$future.run(invokelaterdispatcher.java:95) @ com.sun.glass.ui.win.winapplication._runloop(native method) @ com.sun.glass.ui.win.winapplication.lambda$null$141(winapplication.java:102) @ com.sun.glass.ui.win.winapplication$$lambda$37/636718812.run(unknown source) ... 1 more caused by: java.net.urisyntaxexception: illegal character in opaque part @ index 2: c:\users\insanovation\downloads\f.mp3 @ java.net.uri$parser.fail(uri.java:2848) @ java.net.uri$parser.checkchars(uri.java:3021) @ java.net.uri$parser.parse(uri.java:3058) @ java.net.uri.<init>(uri.java:588) @ javafx.scene.media.media.<init>(media.java:381) ... 15 more exception running application biplayer.biplayer java result: 1
looking @ exception you've copied , pasted, it's clear exception thrown urisyntaxexception. lists problem character, @ index 2 (the backslash character).
if documentation of uris here , here, you'll see forwards slashes acceptable in uris. if changed backslashes in path forwards slashes so:
file:c:/users/insanovation/downloads/f.mp4
i believe should work.
java javafx media-player media
Comments
Post a Comment