Jump to content
RAGE Multiplayer Community

Custom sound with mp.game.audio.playSoundFrontend


MaRvZ
 Share

Recommended Posts

43 minutes ago, Kar said:

I have been searching and I have found this as an example:

 

<!DOCTYPE html>
<html>
<body>

<h3>A demonstration of how to access a AUDIO element</h3>

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

<p>Click the button to get the duration of the audio, in seconds.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("myAudio").duration;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

 

Would you know how to make some example of code to show us?

It would be very helpful

Link to comment
Share on other sites

I tried it like so: 

<audio id="sound" controls>
        <source src="../sound.ogg" type="audio/ogg">
        <source src="../sound.mp3" type="audio/mpeg">
        <source src="../sound.wav" type="audio/wav">
        Your browser does not support the audio element.
</audio>
<button onclick('startsound()')>Play Sound</button>
<script>
  function startsound()
  {
   	document.getElementById('sound').play();
	document.getElementById('sound').loop = true; 
  }
</script>

In my desktop browser it works all fine.

hISjzvS.png

But in GTA CEF-Browser is shows up like this:
vRahE1S.png

Seems that the sound could not be loadet from cef browser. 

  • Like 1
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
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...