Page 1 of 1

Playing a .wav file on load page

PostPosted: Thu Oct 17, 2019 3:29 pm
by Robert Stevenson
No idea if this still can be done but I'd sure like to play a .wav file on load page. If its still possible could you give me a few words to get me started?

Re: Playing a .wav file on load page

PostPosted: Thu Oct 17, 2019 3:53 pm
by Clifton
Couple of things to keep in mind:
  1. You CAN play an audio file on load page, but NOT the first page of your book. Current browser security generally prevents an audio file from playing until the user has interacted with the web page. This means the user must have clicked on something (like a go to next page button) before the browser will allow audio to play automatically on each load page thereafter. This is also true for video files which have audio tracks.
  2. It is best to convert your wav file(s) to mp3 as these are compressed and best for web streaming.
  3. You can use the PowerPac function pgSoundLoader() to play the audo on load page while keeping in mind the above requirements.

Re: Playing a .wav file on load page

PostPosted: Fri Oct 18, 2019 1:30 pm
by Robert Stevenson
Thank you again for this … I have converted all my .wav and .wma files to .mp3
In setting up the pgSoundLoader to play (on what is now the second page) I am stumped as to how I add the file. UrlPlaylist ? I presume on export I add the file to the export tree as well? I would love to see a screen shot of what this might look like.

Re: Playing a .wav file on load page

PostPosted: Fri Oct 18, 2019 10:19 pm
by Clifton
Below is a ToolBook export which uses a pilot page instructing the user to click to enter. Then an audio file begins playing as soon as the next page loads:

Here is the on load page action for the field "myAudioPlayer".
    Image 2.png
    On load page for field "myAudioPlayer" which contains the audio playback controls.
    Image 2.png (14.02 KiB) Viewed 4460 times

I usually create a folder inside the folder which contains the tbk file and name it audio. I put all my audio files into this folder and then add the folder to the export using the DHTML Export Tree Manager.
    Image 3.png
    DHTML Export Tree - Notice [audo] folder has been added.
    Image 3.png (81.58 KiB) Viewed 4460 times