These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

sound tool: Focus on page

vibgyor
Registered: Sep 27 2009
Posts: 7

I am playing a sound clip when the page opens up. I have this in a floating window with the title bar. When the sound starts playing, the player steals the focus and when I try to use the arrow key to scroll up or down, it reduces the volume.
Is there a way to de-focus from the player and back on to the page?

My Product Information:
Acrobat Pro 9.1.3, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
What do you mean by player? Are you using the Rich Media annot (flash) or the screen annot? Why the floating player? You can also play a sound using the sound annot.

The floating player you are descripting is a Modal window. The only way to put focus back on the PDF is to kill the player.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

vibgyor
Registered: Sep 27 2009
Posts: 7
Thanks for the response.
Well what I'd like to do is be able to play mp3 file into the document and start and stop it using page events.
I want my audio player (could be any, but currently defaults to media player) to be non-invasive and at the the same time give the reader a capability to shut it off. Hence a floating window with the title bar and closing control. This floating window is outside the document in the menu bar area of the application so that it doesn't hinder the normal reading.

The way I have gone about this is:
* Add a sound tool to a small area of the page and make the rectangle invisible (manually).
* Add a rendition manually through this screen annot's properties.
* Go to the page properties and create an event using the rendition.

I'd like to automate these steps completely using JavaScript. But,
1. How do I access an audio file from the document? So far, I have done this using "Add rendition", but I haven't been able to figure out a way to add renditions using JavaScript.
2. I know I can create a sound annot through Javascript, but couldn't find a way to attach mp3 file to it.

Maybe there's a simpler and better way of accomplishing what I'm doing, but I just don't know. Thanks for any input.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The import sound function is old and doesn't support many formats. But imported sounds are very simple and easy to use. You'd need to convert your MP3 into wave format to use the Sound Object.

However, you can still use the screen object to play the sound. It doesn't have to be visible to the user and you can add a button to the page for turning it off.

Unfortunately importing renditions into a PDF is not something that can be done with JavaScript. You can however play a media file from an URL with out any annotation or rendition on the form at all. This can all be done with JavaScript. The media object is pretty complex and has lots of quirks. The only thing you can do is look at the examples in the SDK and play around with it to get what you want.

However, if this PDF is for Acrobat 9 and later only, then I think your best bet is to use the Rich Media annot. Which is Modless when it floats.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

j4e8a16n
Registered: Mar 11 2008
Posts: 7
Sound in acrobat 8.

I embedded a sound in acrobat 8 but even if I set play as page visible the sound does not play automatically.
The prompt that ask if I want to play the sound file once does not show either.
I use .aiff format.

JP