<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Preview for AUDIO and VIDEO files on DM in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318107#M5108</link>
    <description>&lt;P&gt;Thank you for the feedback.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Sep 2014 18:30:27 GMT</pubDate>
    <dc:creator>Julien_Carsique</dc:creator>
    <dc:date>2014-09-04T18:30:27Z</dc:date>
    <item>
      <title>Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318100#M5101</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Is it possible to use the preview functionality using only the DM?&lt;/P&gt;
&lt;P&gt;I know that it is possible for DOC, PDF and image files.&lt;/P&gt;
&lt;P&gt;In the following picture you can see my example. I have a PDF, MOV, MP3 and DOC files. We can press the preview function only for PDF, and DOC(Office) files.&lt;/P&gt;
&lt;P&gt;When I try to preview the MP3 and MOV files the message error is:&lt;/P&gt;
&lt;P&gt;"
Preview can not be generated for this document&lt;/P&gt;
&lt;P&gt;Technical issue:&lt;/P&gt;
&lt;P&gt;Blob path: files:files/1/file&lt;/P&gt;
&lt;P&gt;org.nuxeo.ecm.platform.preview.api.PreviewException: Converter any2pdf is not available"&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://connect.hyland.com/upfiles/preview.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2014 21:08:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318100#M5101</guid>
      <dc:creator>SergioFerreira_</dc:creator>
      <dc:date>2014-07-18T21:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318101#M5102</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;This feature is provided by &lt;A href="https://connect.nuxeo.com/nuxeo/site/marketplace/package/nuxeo-dam"&gt;the DAM Marketplace Package&lt;/A&gt;. If you don't want the DAM interface, you can still try to deploy only the addons you're interested in: &lt;A href="https://maven-eu.nuxeo.org/nexus/index.html#nexus-search;gav%7E%7Enuxeo-platform-audio*%7E%7Ejar%7E"&gt;nuxeo-platform-audio&lt;/A&gt; and &lt;A href="https://maven-eu.nuxeo.org/nexus/index.html#nexus-search;gav%7E%7Enuxeo-platform-video*%7E%7Ejar%7E"&gt;nuxeo-platform-video&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 14:29:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318101#M5102</guid>
      <dc:creator>Julien_Carsique</dc:creator>
      <dc:date>2014-07-21T14:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318102#M5103</link>
      <description>&lt;P&gt;Hi Julien&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2014 15:24:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318102#M5103</guid>
      <dc:creator>SergioFerreira_</dc:creator>
      <dc:date>2014-07-21T15:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318103#M5104</link>
      <description>&lt;P&gt;You're missing a third-party library (&lt;CODE&gt;jaudiotagger-2.0.3.jar&lt;/CODE&gt; in that case) and probably a few others. That's the purpose of the Marketplace Package to also deploy the needed third-parties.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2014 14:54:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318103#M5104</guid>
      <dc:creator>Julien_Carsique</dc:creator>
      <dc:date>2014-07-24T14:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318104#M5105</link>
      <description>&lt;P&gt;Hi Julien&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2014 16:50:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318104#M5105</guid>
      <dc:creator>SergioFerreira_</dc:creator>
      <dc:date>2014-07-24T16:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318105#M5106</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 14:56:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318105#M5106</guid>
      <dc:creator>Julien_Carsique</dc:creator>
      <dc:date>2014-07-29T14:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318106#M5107</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;We finish this job.
The Solution was to create the VideoPreviewer and AudioPreviewer (they extends AbstractPreviewer class and implements MimeTypePreviewer class).&lt;/P&gt;
&lt;P&gt;I followed the Nuxeo document ( &lt;A href="http://doc.nuxeo.com/display/NXDOC/Preview?src=search#Preview-MimeTypePreviewerDetails" target="test_blank"&gt;http://doc.nuxeo.com/display/NXDOC/Preview?src=search#Preview-MimeTypePreviewerDetails&lt;/A&gt; ).
I contributed with these Preview classes using a config file, like these examples &lt;A href="http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewExtensionPoint/org.nuxeo.ecm.platform.preview.adapter.PreviewAdapterManagerComponent--MimeTypePreviewer" target="test_blank"&gt;http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewExtensionPoint/org.nuxeo.ecm.platform.preview.adapter.PreviewAdapterManagerComponent--MimeTypePreviewer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;VideoPreviewer.java&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;
public List&lt;BLOB&gt; getPreview(Blob blob, DocumentModel dm) throws PreviewException {
        List&lt;BLOB&gt; blobResults = new ArrayList&lt;BLOB&gt;();

        // Collect video parameters and create the Video entity
        Video video = createVideo(blob);

        // Converting the Video to WebM
        TranscodedVideo videoTranscoded = videoService.convert(video, "WebM 480p");
        File transcodedBlobFile = BlobHelper.getFileFromBlob(videoTranscoded.getBlob());

        // Create the WEB_SERVER/tmp directory. We need it because the browser
        // do not allow open videos from local directory
        String tmpFolderPath = createTmpFolder();

        // Now we have to move the Transcoded file to tmp directory
        File newTranscodedBlobFile = new File(tmpFolderPath + "/" + transcodedBlobFile.getName());
        try {
            Files.move(transcodedBlobFile, newTranscodedBlobFile);
        } catch (IOException e1) {
            e1.printStackTrace();
        }

        //To get the transcode URL. We need it to append on the HTML code
        String transcodedUrl = createTrancodedUrl(newTranscodedBlobFile);

        try {
            StringBuffer htmlPage = new StringBuffer();

            htmlPage.append("");
            htmlPage.append("");
            htmlPage.append("&lt;META http-equiv="\&amp;quot;Content-Type\&amp;quot;" content="\&amp;quot;text/html;" charset="UTF-8\&amp;quot;/" /&gt;");
            htmlPage.append("");
            htmlPage.append(dm.getName() + " - " + blob.getFilename());

            //Appending the videoJS (the video player and the transcoded URL) code into HTML page.
            htmlPage = appendVideoPlayer(htmlPage, transcodedUrl);

            htmlPage.append("");

            Blob mainBlob = new StringBlob(htmlPage.toString());
            mainBlob.setFilename("index.html");
            mainBlob.setMimeType("text/html");

            blobResults.add(mainBlob);
        } catch (Exception e) {
            throw new PreviewException("Unable to get document property", e);
        }

        return blobResults;
    }
&lt;/BLOB&gt;&lt;/BLOB&gt;&lt;/BLOB&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;AudioPreviewer.java&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;
public List&lt;BLOB&gt; getPreview(Blob blob, DocumentModel dm) throws PreviewException {
        List&lt;BLOB&gt; blobResults = new ArrayList&lt;BLOB&gt;();

        File audioBlobFile = BlobHelper.getFileFromBlob(blob);

        // Create the WEB_SERVER/tmp directory. We need it because the browser
        // do not allow open audios from local directory
        String tmpFolderPath = createTmpFolder();

        // Now we have to copy the Transcoded file to tmp directory
        File newAudioBlobFile = new File(tmpFolderPath + "/" + audioBlobFile.getName());
        try {
            Files.copy(audioBlobFile, newAudioBlobFile);
        } catch (IOException e1) {
            e1.printStackTrace();
        }

        //To get the transcode URL. We need it to append on the HTML code
        String audioUrl = createAudioUrl(newAudioBlobFile);


        try {
            StringBuffer htmlPage = new StringBuffer();

            htmlPage.append("");
            htmlPage.append("");
            htmlPage.append("&lt;META http-equiv="\&amp;quot;Content-Type\&amp;quot;" content="\&amp;quot;text/html;" charset="UTF-8\&amp;quot;/" /&gt;");
            htmlPage.append("");
            htmlPage.append(dm.getName() + " - " + blob.getFilename());

            //Appending the videoJS (the video player and the transcoded URL) code into HTML page.
            htmlPage = appendAudioPlayer(htmlPage, audioUrl);

            htmlPage.append("");

            Blob mainBlob = new StringBlob(htmlPage.toString());
            mainBlob.setFilename("index.html");
            mainBlob.setMimeType("text/html");

            blobResults.add(mainBlob);
        } catch (Exception e) {
            throw new PreviewException("Unable to get document property", e);
        }

        return blobResults;
    }
&lt;/BLOB&gt;&lt;/BLOB&gt;&lt;/BLOB&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result is: from every place where Nuxeo call the "Preview" action my classes are called.
I'm just using the DAM jars (audio and video)&lt;/P&gt;
&lt;P&gt;PS: I'm not sure if the VideoPreview conversion is the best solution, but it works.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 17:11:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318106#M5107</guid>
      <dc:creator>SergioFerreira_</dc:creator>
      <dc:date>2014-09-04T17:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Preview for AUDIO and VIDEO files on DM</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318107#M5108</link>
      <description>&lt;P&gt;Thank you for the feedback.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Sep 2014 18:30:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/preview-for-audio-and-video-files-on-dm/m-p/318107#M5108</guid>
      <dc:creator>Julien_Carsique</dc:creator>
      <dc:date>2014-09-04T18:30:27Z</dc:date>
    </item>
  </channel>
</rss>

