0

你好 Stackoverflow 用户。我正在尝试向我的 JFrame 添加视频,我正在使用 Google 的 YouTube API。现在我被困在如何将视频条目实际添加到我的内容窗格中。

我的代码:(似乎不是正确的代码......?)

/**
 * Youtube Video's
 */
private void create(String video_id) {
    try {
    YouTubeService service = new YouTubeService("app", "abcd");

    String videoEntryURL = "http://gdata.youtube.com/feeds/api/videos/"+video_id;

    VideoEntry videoEntry = service.getEntry(new URL(videoEntryURL), VideoEntry.class);

    getContentPane().add(videoEntryURL);

    System.out.println(videoEntry.getTitle().getPlainText());
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ServiceException e) {
        e.printStackTrace();
    }
}

& 在我的void homeScreen方法中,我有这个:

/**
         * Youtube Video 1
         */
        //YouTubeService service = new YouTubeService("xxx.apps.googleusercontent.com",  "AAA");
        create("EKyirtVHsK0");

问题:我在我的create(String video_id)方法中替换 videoEntry 什么。

这个:

getContentPane().add(videoEntry);

4

0 回答 0