在GWT中嵌入youtube播放器(BST Player API) [英] Embedding youtube player in GWT (BST Player API)

查看:119
本文介绍了在GWT中嵌入youtube播放器(BST Player API)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个GWT应用程序。我需要在我的应用程序中嵌入YouTube视频。

我已经尝试了BST播放器API,但是我没有成功地在播放器上显示视频。

我已经下载BST Player.jar 并将其添加到我的构建路径中,然后继承 gwtapp.gwt.xml 中的以下jar:

  **继承name ='com.bramosystems.oss.player.core.Core'** 
**继承name ='com.bramosystems.oss.player.youtube.YouTube'**

然后我尝试在BST页面上给出的例子:

  simplePanel = new SimplePanel(); 
add(simplePanel);
simplePanel.setSize(,);
尝试{
//创建播放器,指定媒体的URL
player =新的ChromelessPlayer(http://www.youtube.com/watch?v=O3CZFfyed3M,80% ,350px);
CustomPlayerControl cpc = new CustomPlayerControl(player);
FlowPanel fp = new FlowPanel();
fp.add(player);
fp.add(cpc);
simplePanel.setWidget(fp); //将播放器和自定义控件添加到面板。
} catch(PluginVersionException e){
//必填Flash插件版本不可用,
//警告用户可能提供链接到插件下载页面。
simplePanel.setWidget(新的HTML(..一些不错的消息告诉+用户先下载插件..));
} catch(PluginNotFoundException e){
//所需的Flash插件未找到,显示友好通知。
simplePanel.setWidget(PlayerUtil.getMissingPluginNotice(e.getPlugin()));
}

我可以用YouTube播放器看到面板,但看不到视频加载或播放。我试过 player.playMedia(),这没有帮助。任何有关如何继续和制作视频的想法?

  http://www.youtube.com/v/O3CZFfyed3M 


I'm developing a GWT application. I need to embed a YouTube video in my application.
I've tried BST player API but I wasn't successful in bringing up the video on the player.
I've downloaded BST Player.jar and added it to my buildpath, then inherited the following jars in gwtapp.gwt.xml:

**inherits name ='com.bramosystems.oss.player.core.Core'**
**inherits name ='com.bramosystems.oss.player.youtube.YouTube'**

Then I tried the example given on BST page:

simplePanel = new SimplePanel();
add(simplePanel);
simplePanel.setSize("", "");
try {
    // create the player, specifing URL of media
    player = new ChromelessPlayer("http://www.youtube.com/watch?v=O3CZFfyed3M", "80%", "350px");
    CustomPlayerControl cpc = new CustomPlayerControl(player);
    FlowPanel fp = new FlowPanel();
    fp.add(player);
    fp.add(cpc);
    simplePanel.setWidget(fp); // add player and custom control to panel.
} catch (PluginVersionException e) {
    // required Flash plugin version is not available,
    // alert user possibly providing a link to the plugin download page.
    simplePanel.setWidget(new HTML(".. some nice message telling the " + "user to download plugin first .."));
} catch(PluginNotFoundException e) {
    // required Flash plugin not found, display a friendly notice.
    simplePanel.setWidget(PlayerUtil.getMissingPluginNotice(e.getPlugin()));
}

I could see the panel with the YouTube player but I couldn't see the video loading nor playing. I've tried player.playMedia() and it was of no help. Any ideas of how to proceed and make the video work?

解决方案

You probably need to be passing this URL instead:

http://www.youtube.com/v/O3CZFfyed3M

这篇关于在GWT中嵌入youtube播放器(BST Player API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆