Jump to content

Play a soundfile ?!


Sn00py

Recommended Posts

How i am able to play a soundfile with that cef framework? 2 Solutions i testes will not work...

 

<script>
var audio = new Audio('login.mp3');
audio.play();
</script>


 <audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio> 

 

Link to comment
Share on other sites

function playAudio(name, volume) {
        audioPlayer = new Audio("./directory/filename.ogg");
        audioPlayer.volume = volume;
        audioPlayer.play();
}

That example was posted in the discord, never tried it but it should work. You can also only use .ogg format, no other sound format will work. I know you posted this in another thread, but did you test in your own browser to see if it works?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...