Playing a .wav file on load page

Topics related to using ToolBook for building web apps.

Playing a .wav file on load page

Postby Robert Stevenson » Thu Oct 17, 2019 3:29 pm

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?
Robert Stevenson
 
Posts: 138
Joined: Wed May 14, 2014 11:46 am

Re: Playing a .wav file on load page

Postby Clifton » Thu Oct 17, 2019 3:53 pm

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.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Playing a .wav file on load page

Postby Robert Stevenson » Fri Oct 18, 2019 1:30 pm

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.
Robert Stevenson
 
Posts: 138
Joined: Wed May 14, 2014 11:46 am

Re: Playing a .wav file on load page

Postby Clifton » Fri Oct 18, 2019 10:19 pm

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 4381 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 4381 times

Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am


Return to Web (DHTML) Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron