Forums de discussion

Preview/play video in Liferay

thumbnail
Juan Gonzalez P, modifié il y a 12 années.

Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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 :

  • 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?
  • 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.
  • 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!
thumbnail
Jorge Ferrer, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 2871 Date d'inscription: 31/08/06 Publications récentes
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)
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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....
thumbnail
Hitoshi Ozawa, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
If it's going to be part of the core, please also consider internationalization when selecting the player.
thumbnail
Jorge Ferrer, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 2871 Date d'inscription: 31/08/06 Publications récentes
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?
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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).
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
thumbnail
Jorge Ferrer, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 2871 Date d'inscription: 31/08/06 Publications récentes
Hi Juan,

FLV Flash Fullscreen looks quite good, seems quite flexible and it's LGPL. For MPW player I couldn't find the license.
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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.
thumbnail
Jorge Ferrer, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 2871 Date d'inscription: 31/08/06 Publications récentes
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.
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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).
thumbnail
Jorge Ferrer, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 2871 Date d'inscription: 31/08/06 Publications récentes
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.
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
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!
sureshnaik ramavath, modifié il y a 10 années.

RE: Preview/play video in Liferay

New Member Publications: 18 Date d'inscription: 14/06/13 Publications récentes
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.
thumbnail
Mohammad Hejazi, modifié il y a 9 années.

RE: Preview/play video in Liferay

New Member Publications: 6 Date d'inscription: 09/11/14 Publications récentes
Hi all
Xuggler:
Xuggler set and install in liferay 6.2 but not play video in liferay document
thumbnail
Juan Gonzalez, modifié il y a 9 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Mohammad Hejazi:
Hi all
Xuggler:
Xuggler set and install in liferay 6.2 but not play video in liferay document



Please open a new thread for this problem you are having, and try to ellaborate a little bit more.
thumbnail
Juan Gonzalez P, modifié il y a 12 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
FYI, I've created a JIRA for this feature:

http://issues.liferay.com/browse/LPS-18004
karthik reddy, modifié il y a 10 années.

RE: Preview/play video in Liferay

Junior Member Publications: 60 Date d'inscription: 08/04/13 Publications récentes
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
thumbnail
Juan Gonzalez, modifié il y a 10 années.

RE: Preview/play video in Liferay

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Hi karthik,

please read this wiki:

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