I'm new to JavaFX and Socket Programming. I'm working on a desktop application in which users will connect to a server and put YouTube link in textbox and the video will be streamed synchronously to all the users connected to server. Everything will happen in application without use of external browser. I will be using JavaFX for the GUI and Socket for network. I'm looking for some guidance on how can i implement it properly. Thanks.
Asked
Active
Viewed 101 times
0
-
@BasilBourque sorry this is my first time using StackOverflow – dedx Feb 17 '20 at 17:57
-
No need to apologize. Good rewrite of title. Also: You also need to get more focused. Exactly what is the problem that needs solving? Stack Overflow is not for open-ended discussions, nor for wide-ranging guidance. For discussion/guidance go to a site such as JavaRanch.com. P.S. You should mention what versions of Java and JavaFX you will be deploying. Significant changes have developed in recent years. – Basil Bourque Feb 17 '20 at 18:05
-
Thanks for your comments @user12914234. Can you please be more specific with your question. – sparkyspider Feb 17 '20 at 18:05
-
@Spider I'm creating project for my last year. I will make GUI with JavaFX. Multiple users will be connected on the application. Any user can put a YouTube link and the video will be streamed synchronously to everyone on the application. I wanted to know how i can implement this. – dedx Feb 17 '20 at 18:08
-
Possibly related: https://stackoverflow.com/questions/2795031/synchronizing-audio-over-a-network – Slaw Feb 18 '20 at 02:45
-
Also https://stackoverflow.com/questions/598778/how-to-synchronize-media-playback-over-an-unreliable-network – Slaw Feb 18 '20 at 02:48
1 Answers
1
You can use WebView to load youtube video. There is some limitations to play youtube video in media player. So webview will the best solution
package com.jenkov.javafx;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class WebViewExample extends Application {
public static void main(String[] args) {
launch(args);
}
public void start(Stage primaryStage) {
primaryStage.setTitle("JavaFX WebView Example");
WebView webView = new WebView();
webView.getEngine().load("https://www.youtube.com/watch?v=asdfghj");
VBox vBox = new VBox(webView);
Scene scene = new Scene(vBox, 960, 600);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Please see the answer Play a Youtube video using JavaFX

Aziz Ahmed
- 81
- 12