MaRvZ

Custom sound with mp.game.audio.playSoundFrontend

Recommended Posts

Hey there,

is there a way to play custom sound sounds with this function?

mp.game.audio.playSoundFrontend

Or is there another way to play custom sounds in RAGE?

Greets
MaRvZ

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

try to use absolute paths. Maybe debug your cef to see, which folder "../" is for real.

Share this post


Link to post
Share on other sites

how to debug my ?
../ is my root folder from the client ressource 

Share this post


Link to post
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.