Anybody encounter this? All objects on page invisible

Topics related to using ToolBook for building web apps.

Re: Anybody encounter this? All objects on page invisible

Postby Clifton » Thu Sep 09, 2021 5:22 pm

To debug what is happening, I would add/replace the code below:
--------------------------------------------------------------------------------
Actions for Field "Audios" of Page "Start"
--------------------------------------------------------------------------------

-- On User event... ------------------------------------------------------------
Define local variable "timer" (Initial value: "")

Set timer to item 2 of value
If not isNumber ( timer )
Comment: Audio End event
Set visible of Button "aStop" to false
End if

With this code:
--------------------------------------------------------------------------------
Actions for Field "Audios" of Page "Start"
--------------------------------------------------------------------------------

-- On User event... ------------------------------------------------------------
if value contains "end"
Show Alert: "Your audio has ended: " & value
end if

Now export the problem page and check if the alert shows when the audio finishes playing.

UPDATE: Can you send me the audio file that is giving trouble? My thinking here is that there is some corruption toward the end of the file causing it to just stop/pause before the end of file. I would suggest opening the file in Audacity and looking at the wave portion toward the last second or so of the file and see if anything looks strange. Also, you may try re-exporting the mp3 from Audacity as it may clean up the file. I cannot necessarily say there is anything wrong with your actions logic.
 
 
Clifton
Site Admin
 
Posts: 731
Joined: Tue Jan 14, 2014 1:04 am

Re: Anybody encounter this? All objects on page invisible

Postby Andy » Fri Sep 10, 2021 9:10 am

I modified the Audios action to display any event, and no event was received when the audio ends.
You may be right about the audio file being unusual, so I am sending it to you separately.
In my further exploration, using the latest version of PowerPac I republished the old book that worked with PowerPac v14, and it now fails in the same way.
Andy
 
Posts: 47
Joined: Tue Sep 09, 2014 3:40 pm

Re: Anybody encounter this? All objects on page invisible

Postby Clifton » Fri Sep 10, 2021 9:40 am

Thank you for the mp3 file.
I dropped it into my test case and it played fine and triggered the end of audio notification as expected.

Now, to debug this further I would recommend one of two things:
  • Send me a single page that demonstrates the problem and I will inspect what is actually going on.
  • OR, try removing references to pgSoundLoader() and recreate the pgSoundLoader() action(s).
I would recommend the first option as it will probably be quicker for me to find out exactly what is going on as I have additional diagnostic tools that I can use.
 
Clifton
Site Admin
 
Posts: 731
Joined: Tue Jan 14, 2014 1:04 am

Re: Anybody encounter this? All objects on page invisible

Postby Clifton » Fri Sep 10, 2021 3:08 pm

Thank you for sending the TBK page.
After debugging the page, here is the problem:
  • When you call pgSoundLoader() on the button "aPlay" the file name in the field "Audios" is sent as the file to play. Because the file in the field has a carriage return at the end of the string, pgSoundLoader() converts this as textlines to an array. However, the second item in the array is empty. So when the audio finishes, pgSoundLoader() attempts to load the empty string as an audio to play. This effectively aborts the rest of the playback and causes the notification event when the playlist has finished to never arrive as a user event on the field "Audios".
  • While several checks and balances are in place to prevent invalid parameters, pgSoundLoader() currently does not verify the integrity of submitted strings (only arrays). I'm now fixing this so it doesn't happen again for anyone.
A solution you can employ:
  1. Remove the carriage return in the text of field "Audios" and all should work fine.
  2. A more secure method to prevent this from occurring is to initialize the local variable audioFile as an array.
  3. Then change your actions on the button "aPlay" to be as follows:
    Image 003.png
    Image 003.png (5.9 KiB) Viewed 23110 times
  4. pgSort_Shuffle() is designed to make an array out of textlines and stacks (comma-separated) AND at the same time remove empty values.
    The parameter setup for pgSort_Shuffle() looks like this:
    Image 001.png
    Image 001.png (17.58 KiB) Viewed 23110 times
  5. Then adjust the IF condition as shown in the actions list; and fix the parameters for pgSoundLoader() like this:
    Image 002.png
    Image 002.png (18.97 KiB) Viewed 23110 times
A PowerPac update to version 15.091.2 will include its own internal check mechanism, but it is a good idea to make sure your parameter strings are in the expect form.
 
Clifton
Site Admin
 
Posts: 731
Joined: Tue Jan 14, 2014 1:04 am

Previous

Return to Web (DHTML) Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron