[Gambas-user] Supped up the WebAudio.class

Benoit Minisini benoit.minisini at gambas-basic.org
Wed Jul 27 22:14:00 CEST 2022


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).

> 
> [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.

> * 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.

> * 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.

> * NEW: WebAudio_Ended() event fires when a track finishes

Rename as 'End'.

> * NEW: WebAudio_HasPaused() event triggers when audio pauses.

Rename as 'Pause'.

> * New: WebAudio.SetPosition(Position As Float) sets playback position.

Replace by the 'Position' property.

> * 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.

Regards,

-- 
Benoît Minisini.


More information about the User mailing list