Umieszczenie Embed YouTube w swoim programie

0

Opierając się na tym poradniku i http://stackoverflow.com/questions/20440484/embed-a-youtube-video-to-jframe chciałem umieścić w swoim programie embed YouTube`a. Jednak po uruchomieniu programu pojawia mi się taki komunikat https://zapodaj.net/bbf8e4f9a471b.png.html
Kod:

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;

public class YouTubeViewer {

public static void main(String[] args) {
    NativeInterface.open();
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            JFrame frame = new JFrame("YouTube Viewer");
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.getContentPane().add(getBrowserPanel(), BorderLayout.CENTER);
            frame.setSize(800, 600);
            frame.setLocationByPlatform(true);
            frame.setVisible(true);
        }
    });
    NativeInterface.runEventPump();
    // don't forget to properly close native components
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
            NativeInterface.close();
        }
    }));
}

public static JPanel getBrowserPanel() {
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    JWebBrowser webBrowser = new JWebBrowser();
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    webBrowser.setBarsVisible(false);
    webBrowser.navigate("https://www.youtube.com/v/b-Cr0EWwaTk?fs=1");
    return webBrowserPanel;
}
}
0

Adres jest jakiś lewy. Kliknij prawym na film i wybierz "Copy embed code". Dla tego filmiku będzie to: https://www.youtube.com/embed/b-Cr0EWwaTk

0

Też nie działa. Ciągle jest czarny ekran.

0

U mnie działa zarówno z pod IntelliJ jak i z wyeksportowanego jara. Dodałem tylko do projektu:

<dependency>
    <groupId>com.sun.jna</groupId>
    <artifactId>jna</artifactId>
    <version>3.0.9</version>
</dependency>

Oraz jary: DJNativeSwing.jar, DJNativeSwing-SWT.jar, swt.jar.

1 użytkowników online, w tym zalogowanych: 0, gości: 1