问题
I tried to embed a video using gwt but I realized that gwt doesn't allow iframe. Vimeo suggests to use this kind of code for embedding. Is there an alternative way to do this?
Supplement
After getting the answers I realized that I wanted to add <frame>
code to an HTML
element and that does not work but Frame
works as it is said below.
回答1:
The GWT Frame class wraps an IFrame and you can find the example use in the javadoc link below.
GWT is in 2.5 version and not 1.5. The link to latest Frame documentation is - http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/Frame.html
public class FrameExample implements EntryPoint {
public void onModuleLoad() {
// Make a new frame, and point it at Google.
Frame frame = new Frame("http://player.vimeo.com/video/"+VIDEO_ID);
// Add it to the root panel.
RootPanel.get().add(frame);
}
}
If you need to go for third party library then you can BST Player. Make use of Vimeo GWT wrappers from BST Player - http://code.google.com/p/bst-player/source/browse/#svn%2Ftrunk%2Fvimeo-player-provider
I would rather suggest you to stick to GWT Frame api only and not use any third party unless you need some other feature provided by the BST player.
回答2:
GWT supports IFRAME
Check:
http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/dom/client/IFrameElement.html
Here you can find the code to embed the video
Download gwt youtube api and use like below
http://code.google.com/p/gwt-youtube-api/source/browse/trunk/src/main/resources/com/google/youtube/showcase/Chromeless.gwt.xml?r=105
Then you can find the code to embed in your page .
Embedding youtube player in GWT (BST Player API)
And make sure the path of the video :)
来源:https://stackoverflow.com/questions/14812679/vimeo-embedding-in-gwt