Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Juan Gonzalez
Preview/play video in Liferay
June 3, 2011 2:17 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Hi all!

I am thinking about developing a preview/play video feature for Liferay document library. It would be something like previewing documents in Liferay 6.1. I wanted to make it for Liferay core (not portlet or ext-plugin).

After looking throught code (current trunk) I think I am going to follow these steps :

  1. Create new class (VideoProcessorUtil). It will be something like com.liferay.portlet.documentlibrary.util.PDFProcessorUtil. This class should manage all necessary code to create flash file that would be saved as file preview. In this step, how could I add libraries to Liferay?
  2. Create new messageListener to execute that file preview process (I guess this is made this way for PDF to be asynchronous), same as PDFProcessorMessageListener. I should have to add the listener properly in file META-INF/messaging-misc-spring.xml to enable it.
  3. Modify portal-web/docroot/html/portlet/document_library/view_file_entry.jsp to get the preview and write all required javascript to render the video player (initially could be flash like FlowPlayer or JWPlayer). Here I have another question. What is the easiest (and correct) way to know if a file is of one type or another (video, etc), so I can call different classes to get the previews from different manner?


Any suggestions will be appreciated! All this work will be commited to Liferay staff so they can get it into Liferay code.

Thanks!
Jorge Ferrer
RE: Preview/play video in Liferay
June 3, 2011 2:52 AM
Answer

Jorge Ferrer

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2756

Join Date: August 31, 2006

Recent Posts

Hi Juan,

First of all, thanks a lot for working on this. Please find my answers below.
Juan Gonzalez P:

Create new class (VideoProcessorUtil). It will be something like com.liferay.portlet.documentlibrary.util.PDFProcessorUtil. This class should manage all necessary code to create flash file that would be saved as file preview. In this step, how could I add libraries to Liferay?


Sounds good. If you mean adding new JAR files. You need to add them within the lib/portal directory in the Liferay sources. Also, you should add an entry in lib/versions.xml to register information about the JAR. Note that it's only possible to include libraries that use a license that is Open Source, compatible with LGPL and that doesn't add additional restrictions (like GPL). For example, Apache, LGPL, MIT or BSD licenses are all fine.

Juan Gonzalez P:

Create new messageListener to execute that file preview process (I guess this is made this way for PDF to be asynchronous), same as PDFProcessorMessageListener. I should have to add the listener properly in file META-INF/messaging-misc-spring.xml to enable it.


Yup, this all sounds good.

Juan Gonzalez P:

Modify portal-web/docroot/html/portlet/document_library/view_file_entry.jsp to get the preview and write all required javascript to render the video player (initially could be flash like FlowPlayer or JWPlayer). Here I have another question. What is the easiest (and correct) way to know if a file is of one type or another (video, etc), so I can call different classes to get the previews from different manner?


The fileEntry object has a getMimeType() method that you can use for that.

Regarding the video player, be aware of the license, which I think rules out those two options. Flowplayer is GPL and JW Player is not Open Source (it just has a non-commercial CC license). The only editor that I've seen out there whose license would allow inclusion in Liferay is http://f4player.org/ (LGPL license) and http://openvideoplayer.sourceforge.net/flash (BSD license)
Juan Gonzalez
RE: Preview/play video in Liferay
June 3, 2011 4:24 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Jorge Ferrer:

Regarding the video player, be aware of the license, which I think rules out those two options. Flowplayer is GPL and JW Player is not Open Source (it just has a non-commercial CC license). The only editor that I've seen out there whose license would allow inclusion in Liferay is http://f4player.org/ (LGPL license) and http://openvideoplayer.sourceforge.net/flash (BSD license)


Hi Jorge,
Seems good both of them. I'll try and chose the best.

Thanks for pointing that out....
Hitoshi Ozawa
RE: Preview/play video in Liferay
June 3, 2011 4:51 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

If it's going to be part of the core, please also consider internationalization when selecting the player.
Jorge Ferrer
RE: Preview/play video in Liferay
June 5, 2011 9:48 AM
Answer

Jorge Ferrer

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2756

Join Date: August 31, 2006

Recent Posts

Hi Hitoshi,

That's a good point. Can you take a look at the two players that I linked to and let us know if they have good internationalization support?
Juan Gonzalez
RE: Preview/play video in Liferay
June 5, 2011 10:27 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Jorge Ferrer:
Hi Hitoshi,

That's a good point. Can you take a look at the two players that I linked to and let us know if they have good internationalization support?



Hi Jorge,

I couldn't make working Open Video Player demo (that seems the best player for me), so for the moment I am going to use mpw player (demo here: http://nettuts.s3.amazonaws.com/274_flashVideo/Source/index.html). It has valid license for Liferay, check it to be sure. These player doesn't have any text so doesn't require internationalization at the moment (after make this new feature working I will try to change to Open Video Player).
Juan Gonzalez
RE: Preview/play video in Liferay
June 6, 2011 12:07 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Another player to look at:

http://www.video-flash.de/flv-flash-fullscreen-video-player/
Jorge Ferrer
RE: Preview/play video in Liferay
June 6, 2011 6:37 AM
Answer

Jorge Ferrer

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2756

Join Date: August 31, 2006

Recent Posts

Hi Juan,

FLV Flash Fullscreen looks quite good, seems quite flexible and it's LGPL. For MPW player I couldn't find the license.
Juan Gonzalez
RE: Preview/play video in Liferay
June 6, 2011 7:44 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Jorge Ferrer:
Hi Juan,

FLV Flash Fullscreen looks quite good, seems quite flexible and it's LGPL. For MPW player I couldn't find the license.


Sorry Jorge,

That link was to see a working demo.

Project link is this:

http://sourceforge.net/projects/mpwplayer/

and it seems it has BSD license.
Jorge Ferrer
RE: Preview/play video in Liferay
June 6, 2011 10:21 AM
Answer

Jorge Ferrer

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2756

Join Date: August 31, 2006

Recent Posts

Hi Juan,

Thanks for the link. I'll let you choose the one that you think is best. We can always extract everything specific to the player to a single JSP so that it's easy to replace it with another one from a hook.
Juan Gonzalez
RE: Preview/play video in Liferay
June 6, 2011 10:56 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

I almost have it! Now I can preview video files without downloading them! Just as Youtube does :-P

Before uploading the patch and instructions I wanna ask a few things:

* when viewing a document I check what extension that files has, to show different javascript (to build the viewer with right params and URL's). Is there any way to check if a file is video type (extensions avi, mov, etc) or do I have to check the extensions in the same condition one by one?
* what is the best way of adding environmental variables to Liferay? Because I am using Xuggler to encode videos to other format (flv) I have to set some variables (I can do this in TOMCAT setenv.sh file, but don't know if there are better ways to do that).
Jorge Ferrer
RE: Preview/play video in Liferay
June 6, 2011 12:10 PM
Answer

Jorge Ferrer

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2756

Join Date: August 31, 2006

Recent Posts

Juan Gonzalez P:

* when viewing a document I check what extension that files has, to show different javascript (to build the viewer with right params and URL's). Is there any way to check if a file is video type (extensions avi, mov, etc) or do I have to check the extensions in the same condition one by one?

I think it's better to use the mime type which is available through the fileEntry object.

Juan Gonzalez P:

* what is the best way of adding environmental variables to Liferay? Because I am using Xuggler to encode videos to other format (flv) I have to set some variables (I can do this in TOMCAT setenv.sh file, but don't know if there are better ways to do that).


You can use system.properties for that.
Juan Gonzalez
RE: Preview/play video in Liferay
June 7, 2011 1:46 PM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Hi guys!

I am very close to finish this.

I have only a few corrections on this, like adjusting the size of the viewer, and other little ones....

I hope to upload a patch tomorrow and the instructions to get this working (in fact install Xuggler will be the required step).

See the attached file to see how does it look like...

Enjoy!
Attachment

Attachments: liferay_video_preview.jpg (81.7k)
Juan Gonzalez
RE: Preview/play video in Liferay
June 8, 2011 5:26 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

FYI, I've created a JIRA for this feature:

http://issues.liferay.com/browse/LPS-18004
karthik reddy
RE: Preview/play video in Liferay
July 9, 2013 4:28 AM
Answer

karthik reddy

Rank: New Member

Posts: 21

Join Date: April 8, 2013

Recent Posts

Juan Gonzalez:
FYI, I've created a JIRA for this feature:
Hi I am trying this requirement like to preview the video and also I want to play the video in same place.Can you please share me the steps for preview and play through documents and media library

Thanks & Regards
M.Karthik Reddy
http://issues.liferay.com/browse/LPS-18004
suresh R
RE: Preview/play video in Liferay
July 9, 2013 4:57 AM
Answer

suresh R

Rank: New Member

Posts: 18

Join Date: June 13, 2013

Recent Posts

Hi juan,

Xuggler:
We need to install Xuggler .
Xuggler allows for audio and video previews and lets you play audio and video files in your browser and extracts thumbnails from video files. and it supports most of the media formats.


Thanks,
Suresh.
Juan Gonzalez
RE: Preview/play video in Liferay
July 9, 2013 7:01 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: October 28, 2008

Recent Posts

Hi karthik,

please read this wiki:

http://www.liferay.com/es/community/wiki/-/wiki/Main/Preview+Generation#section-Preview+Generation-Audio+and+Video+Previews