Good day. I want to get streaming video in a small java application organized using swing. I rummaged through the entire Internet, but did not find anything concrete. The task is this: take and show videos from youtube, for example, in the window. Are there any ready-made implementations of such functionality, or at least a library that knew how to decode and play?
2 answers
You can also use JavaFx tools to display video:
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.web.WebView; import javafx.stage.Stage; public class VideoPlayer extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { WebView webview = new WebView(); webview.getEngine().load( "http://www.youtube.com/embed/flDjU_u35U0?autoplay=1" ); webview.setPrefSize(640, 390); stage.setScene(new Scene(webview)); stage.show(); } } |
There is an open source project Xuggler .
This is a java-library that works with video streams. With it, you can modify the video on the fly.
- The project has long stopped and does not develop. I'm looking for something more modern. - PirateNinja
- @PirateNinja The wikipedia.org has a good article on the Java Media Framework ru.wikipedia.org/wiki/Java_Media_Framework . There the table shows the main libraries that can be used (besides Xyuggler). Perhaps something can come up. - java1cprog
|