Let's consider the scenario where your browser is connected to a Nuxeo server, you have a few videos displayed (either in a folder or in a collection) and you would like to watch them one after another. Until today, the fastest way for doing so was to display the thumbnails view, click on a thumbnail, play the video in the lightbox, move to the next video, click the “Play” button, move to the next, and so on.
But now(1), you can install the nuxeo-video-playlist and enjoy watching the videos without having to click play on each video one by one! Once installed, when the plug-in detects that the current document has some videos to play a “Playlist” toolbar button is displayed:
A click on this button displays (in a dialog) all the videos found in the current document. Play the first video and once it is done playing, the next one in the list starts automatically.
For example, if you have 10 videos you now need only 2 clicks to play them all one after the other: one click to open the playlist, and one to start playing the first video. The previous Neandertal(2)way of doing the same thing took around 21 clicks: 1 click (display thumbnails view) + 1 click (thumbnail) + 1 click (play the video) + 1 click (next document) + 1 click (play the video) + …= 21 clicks for these 10 videos. Maybe more if your folder contained non-video documents!
Here is a video showing how easy to use this plug-in is:
In the README file of the plug-in you will find explanations about the filter used to show/hide the toolbar button. Let me summarize how the list of videos is built, it is a question of priority:
- First, if the current document has the “palette” facet it is used to get an ordered list of videos. This comes from nuxeo-palette, a plug-in written by my wonderful colleague Fred. I am sure Fred will soon write an incredible blog about this amazing plugin(3).
- If step #1 found no videos, the plug-in checks if the current document is a Collection and whether this Collection has some videos to display.
- Lastly, if all previous attempts to get a list of videos failed the plug-in checks if the current document has the “Folderish” facet. If yes, it searches for videos in its children and if it finds any it orders the list alphabetically (based on the title).
Also, as you may know I am a big fan of Nuxeo Studio(4). I can’t write a blog about something cool without talking about Studio because "cool" and "Nuxeo Studio" are meant to be in the same sentence! So here is a little trick (and it's free): You can use the
videoPlaylist.hasPlaylist()bean method of the plug-in to check if a folder contains at least one playable video. For example, let's say you want to display a toolbar button on top of a Folderish document only if it has at least one video in its children. In your user action’s “Action Activation” part:
- Set “Current document has facet” to “Folderish”
- In “Custom EL expression”, write:
Save, deploy, test, and enjoy!
(1) As in “Right now”, aka “immediately”.
(2) Or “pre 2015”. As you prefer.
(3) “wonderful”, “incredible” and “amazing” in the same small sentence. I think I’m ready for Marketing.
(4) Doing it Yoda’s style