Page 1 of 1

Can't stop audio when naviagting between ToolBook Files

PostPosted: Fri Jan 16, 2015 2:36 pm
by ghall
PowerPac v. 12.128

I am using pgSoundLoader (with showControls set to an rgb value and stopOnPageNav set to true) to play mp3 files. A field named "Player" is on each page and it calls pgSoundLoader when each new page loads. Each lesson is created in its own ToolBook file. Each page in each lesson plays only a single audio file and audio for each page is unique.

All works well within each lesson; when navigating to a new page the old page's audio stops and the new page's audio starts. However when navigating to another lesson file, two audio files play. On click, the navigation button to the next lesson calls pgSoundLoader with action "unload" and then calls to Go to page to go to the next lesson. The audio from the current lesson stops and the next lesson window pops up (as expected) but then audio from both the old lesson page and the new lesson page begins to play simultaneously.

I tried using a differently named player in the next lesson (Player2) but the results were the same.

Any ideas on how I can get audio from the previous toolbook file to stop when navigating to a new toolbook file?

Thanks,
Gene

Re: Can't stop audio when naviagting between ToolBook Files

PostPosted: Sat Jan 17, 2015 1:42 pm
by Clifton
Can you indicate the method that is being used to navigate to the next lesson or ToolBook file?
The method used to load the next lesson may not be replacing the previous lesson, thus causing the audio from the previous lesson to continue playing. There may be workarounds for this situation, but we would have to know a little more about the structure of the lessons and how they navigate one to the next. The PowerPac function pgGotoURL() will fully replace a previous book and kill any previous audio that was playing.

Nevertheless, you should use pgSoundControl() and set the action to "unload" or "destroy" before navigating. In your post it looks like you are using pgSoundLoader() to "unload" the sound, but that action is NOT SUPPORTED in that function. You have to "unload" an audio using pgSoundControl() instead.

Re: Can't stop audio when naviagting between ToolBook Files

PostPosted: Wed Jan 28, 2015 1:53 pm
by ghall
Thanks for that advice. Using pgSoundControl to unload and pgGotoURL to navigate works great.