Copy link to clipboard
Copied
I am making an e-book and want to have songs play to accompany certain pages of the book.
The problem is that if the song doesn't finish playing it continues onto the next page where a new song is supposed to start - so they play over each other.
Is there a way to fix this?
Copy link to clipboard
Copied
Just set the sound object to "Disable When: The page containing the content is closed." in the properties panel.
Copy link to clipboard
Copied
the only problem is some sounds are meant to continue over multiple pages
Copy link to clipboard
Copied
Ok - So testing for understanding...
You'd like the currently playing sound to stop playing when it reaches the end of the sound file or when the user gets to a page that has it's own sound annotation on it?
How are the sounds get started playing?
J-
Copy link to clipboard
Copied
Yes, exactly.
The sounds start playing when the user opens to the page with the sound media player on it .
In adobe acrobat I went to tools - content - multimedia - sound - then drew a box and chose the mp3 I wanted to upload.
Copy link to clipboard
Copied
Ok - I haven't actually tested this code but I think I got it right. If you can send me the file in question, I can check it.
Anyway. Since the user can activate a rich media annotation in a variety of ways and you can't reliably get a handle to which ones one active, you need to turn every one of them in the document off before starting the one on the page you want.
Add this code to the "Page Open" script for each page with a sound. The code will go through the document page by page looking for sound annotations and turning them off when not on the active page. Then it will turn on the sound on the current page.
// iterate through all the pages in the document and deactivate any playing sound files
for (var i=0;i < this.numPages;i++) {
// chech that we're not on the current page
if (i != this.pageNum) {
// check if the page has a richMediaAnnotation
if (typeof this.getAnnotsRichMedia(i) !== "undefined") {
// assuming there is only one sound file
if (this.getAnnotsRichMedia(i)[0].activated == true) {
this.getAnnotsRichMedia(i)[0].activated = false;
}
}
}
}
// Activate the sound on the page the user is on.
this.getAnnotsRichMedia(this.pageNum)[0].activated == true;
Copy link to clipboard
Copied
Okay - looks promising! I just tried figuring out how to put in the code myself and I couldn't do it.
I think it would be better if you could try it - if you have time!
Here is a link to download my e-book
https://www.dropbox.com/s/0n295jrglwj0a00/E-Book.pdf.zip?dl=0
Also here is my email
Thanks so much for all of your help!
Copy link to clipboard
Copied
actually use this pdf
Copy link to clipboard
Copied
Ok - I'll take a look and see what I can do.
J-
Find more inspiration, events, and resources on the new Adobe Community
Explore Now