Is It Possible to Use HTML to Allow For Sound Volume Levels / Fade In?

Hello!

Quest's native support for audio is lacking and I was wondering if HTML could be used to allow for more dynamic audio.

There are a couple methods using HTML to allow for multiple audio files to play at once.
(For example: https://textadventures.co.uk/forum/quest/topic/yi_bli6vdeucpve3im3v9g/two-sounds-at-once-solved)

Is it possible to utilize HTML's <audio volume=> function to do something similar?

Thank you for reading!


I don't know.

Why?

Edit: On second thought, I don't know.


Just curious! I saw a forum post bemoaning about it not being possible so I was curious if it was. I was messing up my implementation (I'm a novice at Java, completely new to HTML) and I wanted to know if I was attempting something in vain.

Thank you again!


Hello.

The desktop version of Quest has an older version of the Chromium browser, which sometimes can't handle some newer browser features.

I would advise trying that code out in one place and testing it out first.


As an aside, why is it so hard to update Quest's version of Chromium?


why is it so hard to update Quest's version of Chromium?

I wish I knew enough to have a solid theory on that . . .

Visual Studio has an option to update all the dependencies (like Chromium) in the Quest project, but updating any of them usually broke my Quest build in more ways than one.

Ya' see kids (sorry; I've been watching Deadpool), Quest consists of tons of code and also includes a veritable cornucopia of dependencies. I tried to update Chromium three or four different times, but I could never get everything to work together. Updating Chromium breaks dependencies. I tried and tried (and tried) to figure it out. Even after conducting a (what I believed to be) thorough 'Search & Replace' in every single document in Quest's code that referenced Chromium, and updating all of the other dependencies which seemed to depend upon Chromium, I still got nothing but errors after updating Chromium.

If memory serves, I learned that some of Quest's dependencies are basically obsolete and will not work with newer versions of Chromium. I tried to use the most recent version of Chromium that should have worked with those dependencies, but that didn't work out for me either.

However, I believe someone familiar with Visual Studio and/or building Chromium could probably update Quest's version of Chromium. The only time I've ever used Visual Studio was when I was fooling around with the Quest code. I'm a complete novice. I've never successfully built Chromium from its source code either.

So, yeah: I think someone versed in Windows, Visual Studio, and Chromium could probably pull it off.


NOTE:

If Pixie is making good progress with Quest 6 (which will run in the user's internet browser anyway), none of this will matter.


Thanks for your answer and your hard work on Chrome. Pixie is our only hope now!


Thanks for your answer and your hard work on Chrome.

Ha-ha!

It was less like work and more like just f--king around (whilst having fun f--king s--t up), but I do appreciate the sentiment. (Nyuck, nyuck, nyuck!)


Pixie is our only hope now!

image of Princess Leia


She's beautiful!


Leia: "Help me Pixie, you're my only hope!"

Luke: "Who is she? She's beautiful!"

Obi-Wan: "Settle down, boy. That's your sister!"


Joe Dirt's sister: "I'm your sister! I'm your sister!"


Whoa.

I just realized that I could probably focus on the OP and come up with something helpful . . .

Be right back!


It looks like we can (maybe) make HTML audio fade in and out in Quest with a little JS code, but first:

Are you using the desktop version of Quest to create your game, or the online version?


Anyone wanting to try this can do an online search for "html audio fadein".

That should (eventually) lead to some JS code that might work in Quest.

REMEMBER: The Quest desktop player will not load MP3 (or MP4) files from HTML audio tags. This is because of the old version of Chromium in Quest. Also, some browsers (especially mobile browsers) will behave similarly (because MPEG is not a free format). Also, don't forget to add the autoplay attribute to your HTML audio tag. Otherwise, Quest will load the sound, but not play it.


https://www.w3schools.com/tags/tag_audio.asp


Hello! Sorry for not replying right away! Yes I am using the desktop player. I'll look more into the page you linked and see if I can get an answer too! Thank you!


Yes I am using the desktop player.

Very good!

I shall return with code.


This works for me:

      JS.eval ("$('audio').remove();")
      // The first line removes any existing HTML audio elements.
      msg ("<audio id='my-audio' src=\"" + GetFileURL("inst.wav") + "\" autoplay></audio>")
      // The above line creates an HTML audio element with an ID 'my-audio'
      // My source file is named "inst.wav", and it is in my game's folder along with my ASLX file.
      // I added the 'autoplay' attribute, so the sound will play.
      JS.eval ("document.getElementById('my-audio').volume=0.0;")
      // The above line of code sets my newly created audio element's volume to 0.0.
      JS.eval ("$('#my-audio').animate({volume: 1.0}, 5000);")
      // The above line of code fades my new audio element's volume to max (1.0) over a 5 second duration.


Well, crap . . .

That doesn't work when playing the game online in my Firefox browser. I get this error:

Autoplay is only allowed when approved by the user, the site is activated by the user, or media is muted.


I tried removing the autoplay, adding ```muted``, and using JS to play the sound once it was loaded, but that threw this error:

AbortError: The fetching process for the media resource was aborted by the user agent at the user's request.


So, yeah . . .

I once shared a library called "AudioVideoLib" with everyone, but, due to cross-platform issues such as this one -- which didn't exist when I created the library, but were introduced along with various browser updates, I pulled the library.


It does work correctly in my Chromium browser.

...but, in my Android phone's Chrome browser, it plays the audio, but the fade doesn't work.

Grrr!

It seems like Firefox is usually a step or few ahead of Chromium (and all the other browsers) where updates such as this are concerned. So . . . I assume it won't be long before it won't work in any browser.

[EXPLETIVE DELETED]

This is what put me off of learning how to create websites (after having fooled around with it for a little over a year and learning quite a bit about it (mostly thanks to the kindly people on this site (and I still very much appreciate the help and the knowledge, by the way))).


Anyway, my advice is to avoid using audio or video in a text adventure.

...unless you make it so it can't be played online -- which would most probably put quite a dent in a game's popularity.


To publish a game and make it download only:

1. Create your Quest game as you normally would.
2. Create a directory which you will eventually zip and upload to this site as a zipped website file.
3. Place a copy of your Quest game (the file ending in the .quest extension) into your new directory.
4. Create an HTML file in your new directory which includes a link to your Quest game file.
5. Zip the directory, then upload it to this site.


Yes, it sucks putting in a lot of work into something and then having it negated due to updates beyond your control. I second your "Grrr!".

That last bit about publishing a game to make it downloadable only is a great and very handy nugget of knowledge! Thank you for sharing that!


THANK YOU!! You've been a big help! I was planning on making it download only anyway! Thank you again!


Log in to post a reply.

Support

Forums