pgSoundLoader

Workarounds and usability notes.

pgSoundLoader

Postby John Robin Dove » Mon Dec 06, 2021 6:00 am

Hi Clifton,

I have a slight problem with pgSoundLoader. If I understand correctly, it is possible to set the initial volume level when the sound file is loaded. This does not appear to be working. It works if the sound object is visible but not if it is hidden unless I am doing something wrong. I have put a zip here https://www.mediacours.com/tb_examples/sound.zip
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgSoundLoader

Postby Clifton » Mon Dec 06, 2021 1:05 pm

Hi John,
There are a few things that are occurring here.
  1. Apparently, it is not possible to set volume to 0 in pgSoundLoader(). This is both a PowerPac bug and a browser quirk which I will address. The workaround is the set volume to 1 in pgSoundLoader() and then call pgSoundControl() after a delay of about 300-500ms to set the volume to 0. The browser issue is that if an audio is playing and the browser detects the audio is silent (volume 0) then it flags the audio as NOT playing even though it is actually playing silently. It is as though the browser thinks it is muted, but actually the volume is just set to 0.
  2. Dynamically setting volume does work.
    However, you have a problem in your XML logic. To restart an audio using a previously used [name] parameter, you must first unload the previously running audio to clear the channel for the next one. Otherwise, the function thinks you just want to start another audio channel and then it doesn't know which one to manipulate since more than one audio is playing using the same name. I've attached an XML with these issues fixed.
The next PowerPac release will fix the pgSoundLoader() volume bug so you can set the audio to 0.
Attachments
sound1.zip
Updated:
Dropin replacement for sound1.xml
(932 Bytes) Downloaded 310 times
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgSoundLoader

Postby John Robin Dove » Mon Dec 06, 2021 1:40 pm

OK Thanks very much.
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgSoundLoader

Postby Clifton » Mon Dec 06, 2021 5:41 pm

The setting volume issue for pgSoundLoader() has been fixed in PowerPac v15.092.9.

Thank you for reporting this!
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgSoundLoader

Postby John Robin Dove » Tue Dec 07, 2021 5:32 am

Hi Clifton,

1) Tried to load v15.092.9. by clicking on Check for updates but I get this message.
Image

2) I'm not sure what you mean about unloading the audio. Here is the context: the user clicks on a button which plays the audio file from start to finish. There are potentially 30 different files. The user may choose to listen to the same file more than once or may listen to a differnt file. Here's the code:
<spk>
<function name="myLoad" event="load" params="e" useTB="true">
<![CDATA[
tbfunction_pgStyleObject("spk", "cursor", "pointer");
]]>
</function>

<function name="myClick" event="click" params="" useTB="true">
<![CDATA[
var docName = sharedActions.currentLine[1];
var nameDetail = docName.split("");
var percent = tbfunction_readCookie("MDC_Vol2", "private");
var fileName = nameDetail[0] + nameDetail[1] + nameDetail[2] + sharedActions.phaseNo + ".mp3";
tbfunction_pgSoundLoader("/programs/" + sharedActions.myArray[1] + "/" + sharedActions.myArray[4] + "/teachers/" + sharedActions.myArray[6] + "/" + sharedActions.myArray[5] + "/" + sharedActions.myArray[2] + "/" + fileName, "audioTeacher", "", "play", "", percent);
]]>
</function>
</spk>


Apart from the volume issue this has always functioned as planned. Do I need to change it?
Thanks for your help.
John
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgSoundLoader

Postby Clifton » Tue Dec 07, 2021 8:40 am

Please download and examine the sound1.xml that I posted. You will see that if you start a different audio file under the same name, or if you restart the same audio file while it is playing, and the restart carries the same [name] parameter, you will lose the ability the control the audio (volume, etc.). This has always been the way these two functions behave. This allows the audio to stay loaded when using audio controls that are bound to a field object.
    Basically you need to run pgSoundControl() to unload before starting/restarting any audio using the same [name] parameter.
    tbfunction_pgSoundControl( "audioTeacher", "unload" ); //Ensures clean DOM audio object for audio and exposes control to your scripts
    tbfunction_pgSoundLoader( [myaudioURL], "audioTeacher", "", "play", "", [volume] ); //Start or restart audio
I'm checking on the alert. Seems like a web server issue. In the meantime, just download the PowerPac (trial version is same as update version) using my website:
https://pgsoftwaretools.com/index.html#PowerPac
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgSoundLoader

Postby John Robin Dove » Tue Dec 07, 2021 9:05 am

I did download the sound1.xml that you sent and I did read it. Being rather dumb I was uncertain how to proceed but I came to the conclusion that I should run pgSoundControl before pgSoundLoader every time as you suggest but it seemed a bit counterituitive. Re download, I tried to follow your instructions but got this
Error 500 internal error on server.
I doesn't seem to be a lucky day. :| I'll try again later.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgSoundLoader

Postby Clifton » Tue Dec 07, 2021 9:26 am

The updater should work now.
Sorry, if I suggested that you hadn't read my modified sound1.xml.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: pgSoundLoader

Postby John Robin Dove » Tue Dec 07, 2021 9:37 am

Success! :) I manage to download from the trial version link but not without problems. Windows Security went into overdrive and told me I had a serious virus on board. I managed to override this but I had to download a second time. Then when I ran the installation the Smart Screen popped up and threaened to destroy the file. It is very difficult to distribute independent software these days! But I think we have already discussed this. I still suspect that the French version of Windows probably takes more liberties than the US version.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: pgSoundLoader

Postby Clifton » Tue Dec 07, 2021 9:59 am

The auto-updater is working again too!
The Windows security alerts are false positives. Just create an exception to the PowerPac file(s) as needed.
Sorry.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron