PyWebIO icon indicating copy to clipboard operation
PyWebIO copied to clipboard

custom function in pywebio

Open mlakshmi22 opened this issue 3 years ago • 1 comments

I would like to add an mp3 player in UI, kindly suggest to me how to start or which function (in PYWEBIO) support the mentioned task?

mlakshmi22 avatar Jun 24 '22 04:06 mlakshmi22

Isnt a built-in.

Maybe write or use a javascript library that adds mp3 player ui support. Then inject the javascript in the config similar to https://pywebio.readthedocs.io/en/latest/cookbook.html?highlight=javascript#add-google-adsense-analytics-code

Also i think mp3 is patent-free and not is supported in the HTML5 <audio> tag so possibility you can research on using PyWebIO put_html function.

Good luck

SavSanta avatar Jun 26 '22 16:06 SavSanta

@SavSanta HTML5 audio does support mp3, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio

@mlakshmi22 There is a put_audio() added to pywebio battery, see https://pywebio.readthedocs.io/en/latest/battery.html#pywebio_battery.put_audio

wang0618 avatar Aug 04 '23 14:08 wang0618

@wang0618 Yes sir. When iwrote that last year i made a typo. The 'is not' shouldve been 'is now'. As it is payent-free.

Either way good to see that a new function existsfor folks in the future other than injecting javascripting or using put_html with audio tags.

Nice work!

SavSanta avatar Aug 04 '23 16:08 SavSanta