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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.