[Gambas-user] Supped up the WebAudio.class

Bruce Steers bsteers4 at gmail.com
Wed Jul 27 18:26:45 CEST 2022


On Wed, 27 Jul 2022 at 14:45, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> On Wed, 27 Jul 2022 at 13:13, Safiur Rahman <isafiur at gmail.com> wrote:
>
>> Wonderful
>>
>
> Cheers.
> In the last commit i made it stand-alone.
> I had previously added some things to lib.js but have removed them since
> adding the observer, so the WebAudio.class will work on it's own with
> normal gambas.
> (It's possibly too bloated now for Ben's taste so might not be a candidate
> for inclusion to the mainframe)
>
> Just download the file @
> https://gitlab.com/bsteers4/gambas/-/blob/WebAudio-upgrade/comp/src/gb.web.gui/.src/WebAudio.class
> and import it into a project to use it.
>

Note:
Using the default lib.js for the Play function will unpause at the start of
the track not where it paused as it sets currentTime to 0
I've addressed that in my commits.
fix by adding your own play function to a custom js file and omit the
currentTime=0; line
Eg...

gx = {

  sound:
  {

    play: function(id)
    {
      var elt = $_(id);
      elt.play();
    }
   }

}

then change the Play function in WebAudio.class to use gx not gw..
Public Sub Play()

  WebForm._AddJavascript("gx.sound.play(" & JS(Me.Name) & ")")
  $bPaused = False

End


I'm already using it on my web server where i have made a player  😎
Bruces gambas music page <http://bws.org.uk/cgi-bin/MyPlayer.gambas>

Wishing Well
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220727/a23f478a/attachment-0001.htm>


More information about the User mailing list