Media Previews is dead, long live Media Viewers

Showing results for 
Search instead for 
Did you mean: 

Media Previews is dead, long live Media Viewers

Active Member II
0 18 2,382
A while ago I wrote about the newly-extensible Document Preview component in Alfresco Share and how you can use it to customize the out-of-the-box viewers and add your own custom implementations.

I mentioned at the end of that post that there were some new examples of custom viewers coming in Share Extras and I'm excited that we're now ready to release them on the site.

Peter Löfgren had the great idea of using the pdf.js project to perform direct rendering of document content in the web browser using HTML5. I'd already started work on some simpler examples of custom viewers, and on refining the Flash audio/video players that Share Extras previously provided for Alfresco 3.3/3.4.

The result is what we're calling the Media Viewers add-on. This bundles up a total of six viewer implementations designed to show different ways of implementing custom document views, both with and without Flash.

  • PdfJs displays documents, presentations and any other file capable of being  transformed to PDF in-line in the web browser using the excellent pdf.js viewer, which uses the power of HTML5 to remove Share's Flash dependency for  document viewing.

    The viewer supports a number of features not directly supported by the Flash document previewer, such as a sidebar with thumbnail, outline and search views,  bookmarking of individual pages of a document, and will remember the page  number and zoom level of previous documents that you have viewed.

    PdfJs Viewer

  • FLVPlayer and MP3Player display compatible audio and video files respectively, within the web-browser using the  open source FLV Player and MP3 Player media players by neolao. Based on the  content's MIME type, the updated component automatically chooses the appropriate  previewer to use.

    While similar to the Flash players provided by Share out-of-the-box, these  implementations allow advanced customization of the player via configuration and if FFmpeg is installed, will fire up a transformation to allow viewing  of non-H264/FLV video and non-MP3 audio. The user is informed when conversion is in progress and the screen automatically updates when the content can be viewed.

  • Embed uses an in-line iFrame to embed the content itself directly inside the web page. It is suitable for use with content types that can be viewed  directly within the web browser such as plain text and PDF, with the Chrome or Acrobat plugins installed. Again, this can be used to avoid the use of  the Flash previewer for some clients.

  • Prettify allows formatted code, mark-up and other supported text formats to be displayed in directly in the document and uses the google-code-prettify project to provide an in-line browser-based view with syntax highlighting.

    Prettify Viewer

  • WebODF is an EXPERIMENTAL viewer which uses the AGPL-licensed WebODF project to display ODF content directly in the web browser.

    WebODF cannot be distributed with the add-in itself, so in order to use it you must also download the latest JAR file from the supporting share-webodf project and install it in the same way as the main media-viewers JAR file.

What's most exciting is that we're building on top of some great projects such as google-code-prettify, WebODF and pdf.js, that are evolving at a fast pace and changing the way that documents are viewed in a browser environment.

There is plenty more information including download links on the main Media Viewers project page on Share Extras. Please try it out, let us know what you think and help us to improve this collection.
Active Member
That's more than cool!!!

Don't like the existing Flash Previewer.

Searching right in the preview is a big advantage. Hope hightlighting is doable.

Thanks for this add-on!
Active Member
I am having a problem when I am trying to enable these previewers

Can anyone tell me how to solve this?
Active Member
Does anyone know how to upgrade this extension to include the moste recent pdf.js ?
Active Member II
@Victor: (1) Check out the latest pdf.js and build, (2) Check out the source of the add-on, (3) update the JS files under source/web/extras/components/preview/pdfjs with the updated versions from your pdf.js build, then (4) build the add-on from your source.

The version of pdf.js in the add-on is a few weeks old but no more. What are your reasons for needing the latest changes?
Active Member
Hi @Will Abson

I was wondering if using the latest version will fix this problem with my previews:

(the document is not shown, until I click 'Maximize')

Any suggestion?
Active Member II
I've not seen that issue before. It would be good to get more info - please could you fill out a bug report using the template in the Issues section of Share Extras -
Active Member
[...] on Share Extras and the Media Viewers project. Will has previously introduced this addon in this post. So now I’m going to give you the option for some hands on using the new Quick Share feature [...]
Active Member
[...] Share Extras och Media Viewers projektet. Will har tidigare presenterat det här tillägget i ettdetta inlägg. Så nu kommer jag ge er chansen till prova direkt själva med hjälp av den nya Quick [...]
Active Member
I have problem with mp3 file. When I opened with share, will appear:

we are unable to connect to the content you've requested.
Active Member
hi i need your help, i want to disable download menu on pdf.js. what must i do??
Active Member II
Why do you want to disable that menu item?
Active Member II
Please use the Issues section in the Share Extras project to report problems
Active Member
I am using Media Viewer 2.5.1 with Alfresco 4.2.b.

The document loads correctly in IE 7.0/8.0/9.0 but when I click on the download link in Share the document disappears from the viewer. The document displays when the page is refreshed.

It works fine on other browsers. Any suggestions? Thanks.
Active Member
i have same problem my company need read only permission. i can config on alfresco but viewer show download button. can i disable download button media viewer. sorry for my english skill. thank you
Active Member II
I've opened an enhancement already on the GitHub project for customizing the toolbar. Pull requests are welcome!
Active Member
When I used Media Viewers 2.5.1 on Windows Server 2012, I tried to view text and excel files which contained Japanese characters.

Japanese characters on the files were corrupted and cannot be read.

Are there ways to solve this problem?

Atsushi Matsuura
Active Member II
I am not aware of any such problems. Do you get the same issue with the native Alfresco (Flash) previews?

Development of the add-on has now moved to GitHub, so if you would like us to look at this further please file a bug report there -
Active Member II
Please could you file a bug for this, so the developers can look at it? Development has now moved to GitHub, you can find the project page at