embedded javascript video player

Hi,

While building a newsportal i need to show a video next to an article. We have a video provider that provides us with video player js widgets to embed in the html.

In vaadin i tried to embed with Label or CustomLayout:

new CustomLayout(new ByteArrayInputStream("<script type="text/javascript" src="http://streamingplayer/x/x/x\“></script>”.getBytes()))

or

new Label("<script type="text/javascript" src="http://streamingplayer/x/x/x\“></script>”, Label.CONTENT_XHTML);

When i click on an article, the articleview opens without a video. While the actual script tags are there when i use “inspect element” in firebug. But the player is not called. Also tried . But nothing happened there either.

Is there any other way to embed native javascript ‘widgets’ in Vaadin?

Regards,

Edwin Eversdijk

Browsers have a security feature that they do not normally execute scripts in dynamically injected HTML fragments.

You can execute JS commands with, for example, mainWindow.executeJavaScript(“alert()”). That doesn’t however, insert a script at a particular position in the document.

You can include JS libraries by inserting the code in the HTML header in a custom ApplicationServlet. That just loads them at the startup of the application so that you can call them later.

You may need to make a custom integration widget with GWT.

An easyish workaround would be to make a static page/servlet/URIHandler that includes the script tag, and then embed that with Embedded component inside an iframe.

Thanks for the tip!

I will go for the iframe :slight_smile:

Regards,

Edwin