9 Replies Latest reply on Mar 26, 2011 5:37 AM by Dave Merchant

    Position and hide a video

    jay fresno Level 1

      Using Acrobat 9 Pro, I've placed a video file on the page.

      • Is it possible to hide the video when it is finished playing?
      • When the video is in a floating window, is it possible to position it in the center of the page instead of the upper right?

       

      Would very much appreciate any suggestions.

        • 1. Re: Position and hide a video
          Dave Merchant MVP & Adobe Community Professional

          You can deactivate a video (returning to the poster image) using Acrobat JavaScript, but can't make it happen automatically at the end of playback unless you use a custom videoplayer widget. The standard widget doesn't fire an event when playback ends.

           

          You cannot reposition the floating window in Acrobat X via the user interface, but if you use a plugin or direct editor to add the appropriate dictionary objects to the PDF stream, Acrobat X will respect them.

          1 person found this helpful
          • 2. Re: Position and hide a video
            Dave Merchant MVP & Adobe Community Professional

            In terms of the use of the RichMediaPosition object, I've posted an example on the Ninja Blog.

             

            I'll post an explanation of how to do it without a plugin later today.

            • 3. Re: Position and hide a video
              jay fresno Level 1

              Dave,

              Thank you for your comments.

              You mentioned using a custom videoplayer widget to deactivate the video. Has anyone created such a widget?

              Sounds like the Rich Media Object for repositioning the floating window does not work at all with Acrobat 9. Is that the case that I would have to upgrade to Acrobat X and anyone viewing the PDF would need Acrobat X or Reader X?

              Looking forward to your post explaining how to do it without a plugin.

              • 4. Re: Position and hide a video
                Dave Merchant MVP & Adobe Community Professional

                I've got an extended video player widget on my site that can be instructed to send video status events to a listener function in Acrobat JavaScript, so you could watch for end of playback and disable the RMA. Free to download and works with Acrobat 9 and X.

                 

                Part two of the blog is also up, with a video showing how to add the RichMediaPosition dict into a PDF file using only a text editor.

                 

                In terms of compatibility, if you're playing back a PDF using a positioned floating window in Acrobat or Reader 9, it will be centered. In Acrobat or Reader X it'll be where you told it to be. Doesn't matter which version of Acrobat you used to create the PDF, as the changes are made after it's been saved.

                • 5. Re: Position and hide a video
                  jay fresno Level 1

                  Dave,

                   

                  Thank you so much for your clear and detailed video explanation. I watched it carefully and tried to replicate what you did. I used Acrobat X because you said that the video would always appear in the upper right in Acrobat 9.

                   

                  This is what the Notepad++ file looked like after I inserted the snippet:

                  Untitled-2.gif

                   

                  After using Notepad++, and opening the UC file in Acrobat X, I recieved the following message in the PDF file:

                  Untitled-1.gif

                  Nevertheless, when I clicked the video, it did play -- but it played in the upper right corner instead of in the middle.

                   

                  Thinking that perhaps Notepad++ was not compatible with my computer, I tried the whole process again, this time using EditPad Pro. I didn't get an error message, but the video still played in the upper right.

                   

                  What could I possibly be doing wrong?

                   

                  ------------

                  I also downloaded and installed your extended video player widget. Is it possible to use your widget to center the video in Acrobat 9 or Acrobat X? If so, how would I go about doing that?

                  -----------

                   

                  Looking forward to your reply.

                  • 6. Re: Position and hide a video
                    Dave Merchant MVP & Adobe Community Professional

                    You got lost with a pair of double-brackets by the look of things.

                     

                    In your screenshot from Notepad++, line 71 contains the start of the /Position entry, then the RichMediaPosition object (surrounded by << and >>) follows on lines 72 to 77, all correct.

                     

                    However look at the end of the line above (line 70, it's long and wrapped). You can see the last characters are "16 0 R", but go back a few and you'll see that's part of a dict, which started with the double-brackets in front of "<</Default 14 0 R..."

                     

                    I suspect you've just broken the line two brackets early, so delete the first two from the long row at the beginning of line 78, and put to back at the end of line 70.

                     

                     

                    Notepadd++ has a useful feature under the TextFX/Quick menu to find and select the characters between matching braces, including < and >, which you can use to check where you are in a stack. Select the first bracket character on line 78 and press Ctrl-Shift-B, it'll highlight backwards to where that bracket started, which *should* be between "Window" and "Height" if you've got your counts right. Looking at your screenshot, I guess it'll mark only as far as the bracket between "Width" and "Default", showing they're in the wrong order.

                    1 person found this helpful
                    • 7. Re: Position and hide a video
                      Dave Merchant MVP & Adobe Community Professional
                      I also downloaded and installed your extended video player widget. Is it possible to use your widget to center the video in Acrobat 9 or Acrobat X? If so, how would I go about doing that?

                       

                      Acrobat, and the text-editing method we're talking about here, don't care at all what the Rich Media Annotation contains (video, flash, 3D, etc) provided it's set to open in a floating window.

                       

                      When you embed "video" in Acrobat 9+, what it actually does is embed a copy of the default videoPlayer widget, and the video itself, so the annotation is basically identical to a "Flash" annotation.In fact if you poke a little further down your uncompressed PDF you'll find a couple of lines that define the widget (search for "VideoPlayer.swf") followed by a Binding object that shows the variables passed to the SWF which control playback, just as they do on a website, then a dict containing the SWF itself (stored as a "stream" of binary data).

                       

                      You can change the widget to whatever you want (the default, mine, one you write, even a video player from a website), but nothing the widget does can influence the postion it floats in; as that's solely the domain of Acrobat. In fact the widget doesn't even know it's floating.

                       

                       

                      I may be sounding like Tank, but sometimes if you want to know how something works in Acrobat, the best way is to read the uncompressed file and see how things are defined. It also reveals some interesting things about what data is hidden in a PDF, for example if you search your file around the Binding tag you'll see the filename, creation and modification date are in there, even though Acrobat won't display them. Possibly worth remembering if your video filename is rude! Waaay back when the world was young, we used to write PostScript files by hand; a PDF with video is larger but no more complicated once you've got your head around the language.

                      • 8. Re: Position and hide a video
                        jay fresno Level 1

                        Dave,

                        Thank you for catching the bracket problem.

                        After fixing that, when opening the UC file in Acrobat and clicking to play the movie, it did appear in the center of the window!!! Yay!

                        However, the movie itself did not appear. It looks like an outline with nothing in it, as below. Do you have any idea what might be causing this? The Insufficient Data message did not appear this time, but perhaps that has something to do with it.

                        Untitled-1.gif

                        This is what the Notepad++ now looks like:

                        Untitled-2.gif

                        • 9. Re: Position and hide a video
                          Dave Merchant MVP & Adobe Community Professional

                          For the benefit of others reading this thread, Jay's last post has been resolved.

                           

                          When editing a PDF file in a text editor you must work with the uncompressed version (saved via Preflight). Compressed PDF files, as normally saved by Acrobat, can look very similar in a text editor but use a compression algorithm that can be broken by changes to the structure tags, and when Acrobat reopens such a file it will attempt to clean up the mess. Often this results in unexpected effects, as was the case here, where the embedded data for the videoPlayer widget was deleted (hence the blank window in the previous post).