Media Viewers 2.6 Released

Hot on the heels of the Alfresco Enterprise 4.2 release this week, the Share Extras team have been busy pushing out an updated version of the Media Viewers add-on, which provides support for viewing documents, audio, video and code directly within the web browser in place of the standard Share previewer.
Screen Shot 2013-10-31 at 15.41.29
A key part of the release involved fixing up a few 4.2-specific issues and adding additional support for the new document library views in 4.2 such as the Filmstrip View. But users of any recent version of Alfresco should be able to benefit from some new features – such as a new Present Mode for PowerPoint and ODP files – and developers are also able to customize the toolbar using extensibility modules.
The full list of features is available from the releases page on the GitHub project. But what’s also significant is that this is the first major release we’ve completed for a Share Extras add-on since we completed the migration to GitHub recently. The new process ensures that the release is tagged in the repo, and has binary artifacts available from GitHub and from our new Maven repo (I’m indebted to Gab Columbro for this, who helped to set it up).
I’ll be at Alfresco Summit this year in Barcelona talking about what was involved in the migration, both from a project management and from a technical standpoint in my talk Lessons Learned from Share Extras. You can catch me in Boston too, and at both conferences you’re welcome to book a time to chat about Alfresco Integrations, Share Extras or add-ons in general at the Alfresco Experts bar.

Changes to Transformers configuration in Alfresco 4.2

If like me you have configured some custom transformers against the Alfresco repository in order to convert from one file type to another, you’ll need to be aware of some changes that have been made in the 4.2 codeline currently available in the HEAD branch in SVN and in the latest nightly builds.
The major change is that the mimetype mappings which were previously defined via the Spring bean definitions have now moved to repository properties. This has the benefit that the Spring configuration is much simpler and sys admins can more easily change which transformers are used for specific transforms, as well as the priority assigned to them.
Today I added some default properties to the media-viewers add-on on Share Extras, which you may find useful as a guide to converting over any custom transformer configuration.
Previously in the project, the transformer mimetype mappings were defined on the transformers’ Spring beans via the explicitTransformations property. Here is an extract.

<bean id="transformer.ffmpeg.flv">
    ...
    <property name="explicitTransformations">
        <list>
            <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails">
                <property name="sourceMimetype"><value>video/mpeg</value></property>
                <property name="targetMimetype"><value>video/x-flv</value></property>
            </bean>
            ...
        </list>
    </property>
    ...
</bean>

This configuration configures this a transformer with the bean ID transformer.ffmpeg.flv, which is capable of converting an MPEG-2 file to Flash Video format (note that the transformation itself is performed by a separate worker bean since Alfresco 4.0, and that whilst not generally recommended, the explicitTransformation list can also be applied to that bean).
In 4.2.d onwards the explicitTransformation property is no longer used, so we must define the following repository properties in addition to the Spring configuration.

# Define a default priority for this transformer
content.transformer.ffmpeg.flv.priority=50
# List the transformations that are supported
content.transformer.ffmpeg.flv.extensions.mpg.flv.supported=true
content.transformer.ffmpeg.flv.extensions.mpg.flv.priority=50
...

It is important to get the format of the properties right, with a prefix of content. followed by the Spring bean ID of the transformer (transformer.ffmpeg.flv in this case), followed by the suffixes above. First we define a numerical priority for this transformer, then each supported transformation must be listed separately, one on each line, with the source and target mimetypes identified by their default file extensions, which can be obtained from the mimetypes web script, e.g. http://localhost:8080/alfresco/service/mimetypes.
As per Alan’s advice on this related JIRA ticket, you can simply add the properties to your installation’s alfresco-global.properties, and they will take effect immediately after a restart, but if your transformer config is packaged up in an add-on then you probably want to ship these properties with it, otherwise the transformer will be automatically configured to transform any mimetype into all others defined in the system (see this issue if you want to understand the consequences of this).
For the media-viewers project I utilised the ability of Alfresco Subsystems to pull in extended configuration properties placed on the classpath under alfresco/extension/subsystems. In this case I used the Transformers subsystem but perhaps thirdParty is also applicable for this, or you could even define your own custom subsystem!
I added the properties in a new file config/alfresco/extension/subsystems/Transformers/default/default/org_sharextras_media-viewers.properties in my project with the above contents (source). The config prefix is part of the standard project source layout and is removed from the classpath of the assets at build time, and the slightly obtuse file name ensures that different add-ons will not clash with each other if they both add additional properties (the file name can be anything, so long as it ends with the .properties extension.
Normally you would remove the explicitTransformations properties from the Spring configuration with these applied, in order to supress the warnings that are now output in the logs, but I made the decision to leave it in, in order to preserve backwards-compatibility with 4.0 and 4.1.
Thanks to the contributors davidyg and touchvignesh who reported these issues with the media-viewers add-on! The updated code is in the master branch on Github or you can grab a JAR file containing the latest code to try it out yourself.

Media Viewers 2.5 Released!

If you’ve been following the recent activity on Share Extras you’ll notice that most of the work for the last few weeks has been going into the Media Viewers project and in particular the ‘PdfJs’ based viewer which it supplies.
If you’re not familiar with the underlying pdf.js project then you should know that it provides a means of direct rendering of PDF content items using HTML5 and JavaScript in the web browser, with no requirement from additional client-side plugins such as Flash.
Combined with the ability of the Alfresco repository to transform just about any standard document into PDF format, we think this provides a compelling reason to try the Media Viewer add-on if you have not done so before.
An initial version of the PdfJs viewer shipped in the Media Viewers 2.0 release for Alfresco 4, and version 2.5 which we’re releasing today builds on that with support for Alfresco 4.2 while also maintaining backwards compatible with the 4.0 and 4.1 Alfresco product lines.
There’s so much in this release that it felt like much more than a v2.1 release and 2.5 seemed much more appropriate. You can read on for more details of these exciting new capabilities, or go straight to the download, installation and configuration instructions to try it out today.

Easy Configuration

The first thing you’ll notice when enabling the add-on using Share’s Module Deployment console is that additional modules have been added, which provide the configuration needed to bind the viewer into the document details page.
Unless you want a specific custom configuration, you can just enable the new PdfJs Configuration module (in addition to the existing PdfJs Viewer module), click Apply Changes and you should see PDF documents will now use the new viewer. You no longer need to edit your web-preview.get.config.xml file although if you’ve made changes there they will continue to be respected.

Persistent View Settings

Can’t see the text clearly? You can use the zoom controls in the viewer to zoom in, our out if you want to see more. Or pick a preset from the drop-down and the zoom will be auto-calculated.
The next time you come back to the document, these settings – plus the page number you were on – will be remembered.

Powerful Search

Use the Search button in the toolbar or Ctrl+F (Cmd+F on MacOS) to search through the document contents for a particular item of text. You can easily step through the matches one by one, or highlight all matches found.

When you’ve found what you’re after, you can copy the relevant text to the clipboard in order to include it somewhere else, for example in an e-mail.
The feature I like the most will make you wonder how you lived without it before, if you’ve ever searched for a document in Alfresco and then struggled to find the reference to that term in the document itself.
Now, the viewer detects that you have clicked through from the search page, and automatically searches for and highlights the first match of that term. Just hit Enter to continue through any further matches, or Escape to close the search dialog.

Link to Document

The Link button in the toolbar generates a link to the document, or even to a specific page in the document, that you can send to co-workers. If you want them to review Slide 24 in your presentation then simply send them straight there.

Improved Sidebar

You can click the button on the left of the toolbar to toggle the side bar on and off. The side bar shows a thumbnail view of all pages in the document by default and can also show an outline of the document structure if available in the file.

Presentation Mode

At DevCon last November Jared neatly showed how you can use the the new Google Docs integration to deliver a presentation directly from your web browser using Google Drive’s presentation mode, but with the PdfJs viewer you can now do the same thing directly from the Document Details page.
Just click Ctrl+Enter (or Cmd+Enter on MacOS) to go full-screen, then use the left and right arrow keys to move between your slides (the arrow keys will also work in the normal Document Details view).

Document Viewer Dashlet

Just like Site Admins can use the Wiki dashlet to add a selected page to a site dashboard, the Document View dashlet supplied with the add-on allows you to display any chosen document on the dashboard.
The dashlet works well with the PdfJs viewer, but will also work with the others supplied by the add-on or the base viewers supplied with Share (yes, that includes the Flash document viewer, if you really want).

Password-protected PDFs

Viewing password-protected PDFs is no longer a problem with the PdfJs viewer. You will be promoted for the password required to open the file and once supplied the viewer will work as normal.

Lots More

Of course there are many other improvements that you can’t see directly, but that you will benefit from. Peter has been working tirelessly to keep the version of the pdf.js library up-to-date, ensuring that we stay up to date with the improvements in performance and compatibility that the latest versions now provide. We have also improved the performance of page rendering within the dashlet code itself, with improved lazy rendering of all page and thumbnail content.
And of course PdfJs is not the only viewer in the add-on. The Flash-based audio and video players are still supplied, the Embed viewer offers a compelling Flash-free alternative for IE users not on IE 10 who have the Adobe Reader or another PDF plugin installed and the Prettify viewer is great at syntax highlighting any code stored in Alfresco.

Feedback

Like all Share Extras add-ons, we welcome constructive feedback to help us to deliver the next version of Media Viewers. Please use the Issues section on the project to report specific technical issues or ideas for enhancements, or general feedback can be left as comments below.

Share Extras moving to GitHub

Cross-posted to the Share Extras Development Group today.
Share Extras will be moving to a new platform in the next few weeks. The new platform will be GitHub, with the version control obviously provided by Git instead of Subversion, which is used at present.
There are many reasons for moving to Git from Subversion. I’ve spent a while reviewing the project issue list this week and it’s clear to me that there are many enhancement requests which may not be appropriate to make in the main Extras code base, or are simply not achievable within the project due to people’s time constraints.
Git will enable the wider community to fork individual any add-on as they feel the need to. I hope this will lead to more contributions back to the main project and foster greater collaboration (and perhaps a bit of competition?) with others.
Specifically, there is also the need to improve on the localisation of add-ons in a consistent manner, and there are some great tools available for doing that based on Git.
Whilst I had originally intended to simply migrate to a new Git VCS within Google Code, the frequent downtime and increasingly poor feature set and user interface when compared to other providers has led me to conclude that it is not a viable platform for future development.
In contrast, GitHub supports the notion of projects within an overall organisation much better (I have already registered Share Extras as an organisation) and has some great options for improving our documentation using cool standards such as Markdown.
I propose to migrate the current trunk codeline (and perhaps the 1.0 branch should time allow) at the end of August. There are several things that committers need to do before then, in order to help make it a success, such as ensuring that they have a README.md file in all their projects (this will become the main source of documentation, rather than the wiki), and helping to close down any issues that remain open on Google Code (issues will not be migrated over).
As always, if you have any feedback, please let me know. Otherwise I will be in touch with the main committers separately in the coming week or so.