0
Assign a sound to a formula button
Hi to all! Thanx to @RoSoft_Steven (who created this post: https://forum.ninox.com/t/35y3lcz ,
I am using custom buttons.
In my record, I created an embed of a small player that plays an mp3 file from the web. It works perfectly.
Here is the script assigned to it:
let xAudio := 'Audio Source'; html(--- <audio controls> <source src={ xAudio } type="audio/mpeg"> Your browser does not support the audio element. </audio><br/> ---)
What I would like to do now is to assign a button the ability to play the same sound.
I'm trying with this code:
let xAudio := 'Sorgente Audio';
let audioTag := html(---
<audio id="audioPlayer" style="display:none;">
<source src={ xAudio } type="audio/mpeg">
Your browser does not support the audio element.
</audio>
---);
let button := RSCustomPHButton({
text: {
label: "Player",
color: "#3381ff",
size: "14",
bold: "normal",
text: "No"
},
button: {
btnid: "1",
color: "#ffffff",
borderstyle: "solid",
borderwidth: "thick",
bordercolor: "#007F7F",
hovercolor: "#d6e6ff",
round: "10"
},
icon: {
name: "microphone",
weight: "-bold",
size: "26",
color: "#0b0c0e",
placement: "row"
},
action: {
js: "var player = document.getElementById('audioPlayer'); if (player) { player.paused ? player.play() : player.pause(); } else { console.error('Audio player not found.'); }"
}
});
html(---
{ audioTag }{ button }
---)
but it doesn't work...
Do you have any suggestions to solve the problem?
thanks for your attention
Reply
Content aside
- 2 mths agoLast active
- 51Views
-
1
Following