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

Audio Java Script

patra
Registered: Oct 19 2006
Posts: 270

I have add a page action, when page open to play a sound.
My proplem it is, every time I have to come back at page 1(with the page action) I hear again and again the same sound!
There is any way to hear the sound only ONE time when the document opens onle?
I use Acr 8.0 Pro
Thanks

My Product Information:
Acrobat Pro 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, you can do this with JavaScript. Use either a Sound Object or a Screen Annotation. Both objects can be controled with JavaScript. If it's a simple sound then the sound object is the easiest to control. Look up the Sound object in the Acrobat JS Ref.

If you need more complex control you'll need to use the Screen annotation and the Multimedia API. The simplest use is with the "app.media.startPlayer()" function

Whatever playback method you use, you'll need to qualify running the code with a document level variable that's set after the first play.

EX: The example uses a screen annotation where both the rendition and the screen annot are give simple names. This is the simplest use of the MultiMedia API.

if(this.bFirstTime){var ant = this.media.getAnnot({nPage: 0, cAnnotTitle: "test1" });var rnd = this.media.getRendition("testrend");app.media.startPlayer({annot:ant,rendition:rnd})}

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

patra
Registered: Oct 19 2006
Posts: 270
Thom, thanks for your answer but what you mean when you say: "Whatever playback method you use, you'll need to qualify running the code with a document level variable that's set after the first play".
Also where your code much be insert, into the document javascript?
Thanks again