Wanna add your favorite video onto the WebSpace Portal or display a flash video ad... follow these steps to add a simple flash player to play your flv files. For better understanding on using Content Management System, Web Content Display Portlet just skim through KLV's blog

Download and install latest webspace install here.

In this post I am going to use jw flash player for demo. Download the free player and do the following:

1. Upload player.swf(from downloaded jwplayer) to document library and note the url from the file details.

2. Upload your flv file to document library and note the url from the file details.

Create a Structure:

1. Login as admin@example.com

2. Go to Control Panel.

3. Select Web Content from left navigation under Content category.

4. Select Structures tab to create a new structure for FLV player user inputs.

5. Click on Add Structure.

6. Check Autogenerate ID, provide Name("FLV Player Structure") and Description.

7. Click on Add Row. Provide Name as "file". Select type from dropdown as "Text".

8. Click on Add Row again. Provide Name as "player". Select type from dropdown as "Text".

9. Click on Save.

Create a Template:

1. Select Templates tab -> Click on Add Template button.

2. In the Template form, check Autogenerate ID, Name("FLV Player"), Description.

3. Click on Select button and select the Structure created above.

4. Click on Launch Editor. Here you can create the vm template.

5. Clear the commented text and copy the following in it.

<embed width="100%" height="300" align="center" flashvars="file=$file.data" allowscriptaccess="sameDomain" allowfullscreen="true" wmode="opaque" scalemode="showall"
movie="$player.data" swliveconnect="false" salign="" menu="false" play="false" loop="true"
devicefont="true" bgcolor="#FFFFFF" base="." quality="best" name="player" id="player" style=""
src="
$player.data" type="application/x-shockwave-flash"/>

6. Click on Update button which closes the editor and Click Save button in the Template form.

We are ready to Add Content to the template which we have created just now.

Add Web Content:

1. In the same Templates tab Click on Actions button next to the template created above.

2. In the context menu populated select "Add Web Content".

3. In the Web Content form provide Name("My Video"), in File text field enter your flv file context path location, the document library url of flv video uploaded.

4. Provide the player URL with the document library url of player.swf file.

5. Click on Save and Approve button.

We are done with Control Panel part and now we are ready to display the video content onto the portal.

1. Go to your page or create a new page by clicking on Add Page.

2. Go to Menu -> Add Application -> Content Management and add Web Content Display portlet.

3. Click on Configuration on the portlet -> Select the WebContent("My Video") you created above.

4. We just added content to the Web Content Display portlet. Click on Return to full Page.



Comments:

<WEBSPACE_HOME>\webspace-gfv2-windows\glassfish2\domains\domain1\applications\j2ee-modules\webspace

The applications\j2ee-modules directory is the internal deployment directory of glassfish. This directory may deleted if the webspace war file is redeployed.

It is never a good idea to write files into the webapplication deployment area.
IMHO the portlet should be designed to create/read/write directories under <WEBSPACE_HOME> or some other directory

Posted by Raju on February 15, 2009 at 12:20 AM IST #

Agreed. Intention of this post is to demo the usage flexibility of WebSpace's Web Content without the need to write a new portlet from scratch. In the future releases file types swf, flv can be stored and accessed by WebContent from document library(http://docs.sun.com/app/docs/doc/820-7054/ghpfk?a=view).

Posted by Santh Chadalavada on February 16, 2009 at 02:33 AM IST #

As Chetan said, the best solution would be to store the swf file in the document library. Document Library assigns a URL to each file that is uploaded into it. Use this URL in the movie attribute.
This will work if the browser uses Flash Player 9, but does not work in Flash Player 10. See the below link:
http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head32

To fix this, the document library should set the content-disposition header to "inline" in case of swf files. This fix will be included in the next update release of Glassfish Web Space Server.

Thanks,
Prakash

Posted by Prakash Reddy KLV on February 16, 2009 at 10:48 AM IST #

Thank you very much for given this post............

Posted by FLV Player on May 25, 2009 at 05:50 PM IST #

Great Article !!! Thank you for posted this...

Posted by FLV Player on June 03, 2009 at 11:14 AM IST #

I bookmarked this page. Thanks for given this great post....f

Posted by flv player on July 04, 2009 at 07:08 PM IST #

Hi Chetan,

How would i deploy the webcontent portlets on a clustered setup like we do war deployment on DAS node?

Thanks,
Ram

Posted by Rammohan Kamineni on July 30, 2009 at 11:51 AM IST #

Teach you how to play flv video on mac os http://www.imediacreator.com/howtoburn/flv/free-play-flv-on-mac.html#128 ~

Posted by shenuna on September 16, 2009 at 11:40 AM IST #

Nice! Now i can display easily.

Posted by Flv Player on September 21, 2009 at 04:42 PM IST #

Thanks to author.

Posted by wn on September 29, 2009 at 02:41 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Chetan Chadalavada