[Gambas-user] Supped up the WebAudio.class

Bruce Steers bsteers4 at gmail.com
Wed Jul 27 23:24:26 CEST 2022


On Wed, 27 Jul 2022, 21:15 Benoit Minisini, <
benoit.minisini at gambas-basic.org> wrote:

> Le 27/07/2022 à 13:57, Bruce Steers a écrit :
> > want a upgraded up WebAudio Ben?
> >
> > Mods make it MUCH more useful.
> >
> > I basically made a web player and needed these changes to make it better.
> >
> > https://gitlab.com/bsteers4/gambas/-/tree/WebAudio-upgrade
> > <https://gitlab.com/bsteers4/gambas/-/tree/WebAudio-upgrade>
> >
> > changes...
>
> I'm not against the principle, but I don't like the interface you
> chosen: you must follow the same standards as the other Gambas classes
> as much as possible (look in 'gb.media' for example).
>

Okay will do.

>
> >
> > [GB.WEB.GUI]
> > * NEW: WebAudio.AutoPlay, Autoplay audio on loading.
> > * NEW: WebAudio.OtherSources for alternative <source> items.
>
> Rename as just "Sources", and fix your code: by copying the array
> internally, by detecting when the property value is null...
>
> > * NEW: WebAudio.UnsupportedText sets message to display if browser does
> not support audio..
>
> I don't find this property useful. Just implement a standard
> translatable message inside the component.
>

Okay

> * NEW: WebAudio_Ready(Duration as Float) event fires when audio loads and
> contains track length.
>
> Don't pass 'Duration' as argument. The user will read the property


But with this and the timeupdate event passing the argument is how the
property ges set.

Is there another way to get the javascript elt.currentTime value to the
Duration property ?

> * NEW: WebAudio_TimeUpdate(Position As Float) event fires as audio plays
> with time pos.
>
> Rename the event as 'Position', with no argument. The user will read the
> property.
>

But there is the property Position already. Can an event share a property
name. (I am at work so cannot test)

>
> > * NEW: WebAudio_Ended() event fires when a track finishes
>
> Rename as 'End'.
>

Sure

>
> > * NEW: WebAudio_HasPaused() event triggers when audio pauses.
>
> Rename as 'Pause'.
>

Will it clash with the existing .Pause() method?

>
> > * New: WebAudio.SetPosition(Position As Float) sets playback position.
>
> Replace by the 'Position' property.
>

Yes oops, already did that.

>
> > * NEW: Use an observer to get event data internally.
> > * NEW: Property WebAudio.Duration gets song length.
> > * NEW: Property WebAudio.Position, get or set song position.
> > * NEW: Property Paused gets or sets paused state.
> > * OPT: clean up code and add inline wiki help.
> >
>
> The remaining seems to be ok.
>

Okay I'll get on it and submit a merge soon...

Respects
BruceS


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


More information about the User mailing list