I have a new problem that I can’t seem to solve. I use pgSoundLoader to play recordings in two different contexts. 1) While the recording is playing, the words of a sentence are selected one by one and when all have been selected the next sentence is dealt with in the same way. 2) The same technique is used by for one sentence only which is displayed on a smaller field on page 2 in an iframe to allow the user to make changes to pause times after words have been selected (the times are stored in a 2 dimensional array).
I would have thought that context 1 would be the more challenging but surprisingly I can repeat this over and over again and there are never any problems.
If, however, I use pgSoundLoader in context 2 and then go back to context 1, the performance is affected and the file takes longer to play, sometimes slightly longer, sometimes considerably longer. This is catastrophic for my system which is based of the duration of the mp3 file.
What causes the deterioration in the performance? I have tried several things. I always unload the file before loading the next one and I use reload like this:
- Code: Select all
tbfunction_pgSoundControl("reader", "unload");
tbfunction_pgSoundLoader( "/programs/" + sharedActions.currentFolder + "/" + sharedActions.currentPage + "-" + sharedActions.ctr + ".mp3", "reader", "", "reload");
tbfunction_pgTimer(true, 100, "button_read") //timer in button_read gets duration
I have also tried using two different objects, one for each context but this does not solve the problem either. I wonder if the system for getting the duration could be the cause:
- Code: Select all
<function name="myUser" event="user" params="evt,value" useTB="true">
<![CDATA[
let ready = tbfunction_pgSoundControl("reader", "duration");
if (ready)
{
tbfunction_pgTimer("", "", "button_read", true);
ready = Math.floor(ready);
sharedActions.length = ready;
}
]]>
</function>
</button_read>
I also wonder if using htmlVideoLoader for one context and pgSoundLoader for the other might help. Do you have any suggestions, please?
John