Controlling Online Player Via Links

Hello,
I put this comment in another thread, but perhaps it got buried due to the topic.
I’m trying to setup Foundry to initiate calls to play sounds and moods.

The first trigger I am working on uses a macro that I can assign to a spell or action:
fetch('https://www.syrinscape.com/online/frontend-api/elements/415635/play/?auth_token=Secret', { mode: 'no-cors'})
This triggers the Bless spell fine, but it is too loud. Is there a way to modify this via the call to set volume of the sound to around 50%? I tried adding a {volume:‘0.50’} but it does not seem to register.

The second is not as critical, but annoying. When I trigger links from the journal to set moods or play one shots, for example: https://www.syrinscape.com/online/frontend-api/moods/28497/play/?auth_token=Secret
It opens a new tab to a Django Rest framework. Is there a way to have that tab not appear?

Thanks
~DrWiFi

Hey @DrWiFi,

Sorry you earlier post got missed = bumping is the right thing to do, like you did! :smiley: We can sort you out.

@sonofconan will have more specific answers, but I’ll help out as I can.

You can definitely call a link without opening a browser window.
Simply replace https:// with syrinscape-online://. That’ll call the bundled proxy which will catch the call and send it to the server and deal with the returned page invisibily.

I’m 96% sure you can set the element volume as well… though you MAY be able to set the OneShot volume (master) slider instead which may be a better fix.

There may be some info (code you can look at) here:

Helps?

@DrWiFi If you watch the network inspector in Chrome when you perform an action in the master interface (e.g. setting the volume for an element) you’ll see the request that is sent to our server.

For example, a POST request to /online/frontend-api/elements/8/set_current_volume/ with {"current_volume":0.72} as data.

You won’t be able to change volume and play an element with the same request, and the proxy won’t work for POST requests.

We will circle back to improvements like this at some point, but our focus right now is unfortunately on other work.

In the mean time, it would be possible for you to write your own local middleware/proxy app that handles any request you make from Foundry (e.g. “play with volume”), which then makes all the required requests to our server without opening a browser.

1 Like

Thank you for your replies. The syrinscape-online:// is not recognized by OS X as a proper web address, so both chrome and safari return errors.

I think I found a solution to the volume thing though as I was playing around tonight. It appears that if I set the volume of a sound in the master interface, it plays back at that volume when called by the link. So as long as those volumes levels don’t change, I should be good.
~DrWiFi

1 Like