我有一个使用G.W.T开发的简单邮件系统,我正在尝试添加一个功能来播放音频和视频文件,如果有视频或音频文件作为附件。
我一直在尝试使用播放器和HTML视频标签来开展工作,但我无法播放一些视频格式,例如.avi,.mpeg,.mpg等。
播放这些视频格式还能做些什么?
另一方面,我正在考虑在java servlet中转换视频文件,然后将该url提供给播放器,但我不知道这是否有意义。那应该是这样吗?
最后一件事是;是否有一种通用格式(可能是.flv?),首先必须将视频文件转换为可以由VlcPlayerPlugin或其他视频播放器播放?任何其他提示都会有所帮助。
感谢您的帮助。
答案 0 :(得分:0)
html5视频标记只能播放某些格式。您可以在此处找到支持的浏览器格式列表。
答案 1 :(得分:0)
我也遇到过BST播放器的问题,但至少它使用了以下代码:
public YoutubeVideoPopup( String youtubeUrl )
{
// PopupPanel's constructor takes 'auto-hide' as its boolean parameter.
// If this is set, the panel closes itself automatically when the user
// clicks outside of it.
super( true );
this.setAnimationEnabled( true );
Widget player = null;
try
{
player = new YouTubePlayer( youtubeUrl, "500", "375" );
player.setStyleName( "player" );
}
catch ( PluginVersionException e )
{
// catch plugin version exception and alert user to download plugin first.
// An option is to use the utility method in PlayerUtil class.
player = PlayerUtil.getMissingPluginNotice( Plugin.Auto, "Missing Plugin",
"You have to install a flash plaxer first!",
false );
}
catch ( PluginNotFoundException e )
{
// catch PluginNotFoundException and tell user to download plugin, possibly providing
// a link to the plugin download page.
player = new HTML( "You have to install a flash plaxer first!" );
}
setWidget( player );
}
public YoutubeVideoPopup( String youtubeUrl )
{
// PopupPanel's constructor takes 'auto-hide' as its boolean parameter.
// If this is set, the panel closes itself automatically when the user
// clicks outside of it.
super( true );
this.setAnimationEnabled( true );
Widget player = null;
try
{
player = new YouTubePlayer( youtubeUrl, "500", "375" );
player.setStyleName( "player" );
}
catch ( PluginVersionException e )
{
// catch plugin version exception and alert user to download plugin first.
// An option is to use the utility method in PlayerUtil class.
player = PlayerUtil.getMissingPluginNotice( Plugin.Auto, "Missing Plugin",
"You have to install a flash plaxer first!",
false );
}
catch ( PluginNotFoundException e )
{
// catch PluginNotFoundException and tell user to download plugin, possibly providing
// a link to the plugin download page.
player = new HTML( "You have to install a flash plaxer first!" );
}
setWidget( player );
}
正如您所看到的,我们在这里使用了youtube播放器,它具有正面效果,可以将视频放置在youtube上,并且每次重新部署GWT应用时都不得将其丢弃到服务器上。 您还可以播放flash其他格式,只需在try块中使用正确的Player类; flash的例子:
答案 2 :(得分:0)
很抱歉延迟,没有机会回复。因为VlcPlayer表现很奇怪并且在Ubuntu和Windows上显示不同的控制按钮,我决定使用BstPlayer的FlashPlayerPlugin.I首先使用{{将文件转换为flv 3}}在文档中描述,然后它将转换后的视频提供给FlashPlayer,它现在没有问题,谢谢大家的帮助。