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?

1 Like

@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

Did you find a solution to stopping the DJANGO tab opening?

Have answered on the other thread where you asked this @Abourious :slight_smile:

NOTE: Syrinscape Online is NOT the same thing as the Syrinscape Web Player.

Though, the things that DID control Syrinscape Online will control the Web Player in the same way.

EVERYONE!

@benjamin (this is really important for Foundry users, if you can possibly make this more widespread)
@DrWiFi, @sonofconan

I have a solution for FOUNDRY! If you are wanting to use the remote control links.

Between you brilliant lot here and the amazing macro people at Foundry discord I have got a simple solution for playing the sound and stopping the DJANGO tab opening.

Here is an example of the macro, my AUTH code is old and doesn’t work now so this won’t actually work, but this is what it should look like. I have tested and tested.
I copied the remote control from Syrinscape Online player and pasted it in between - fetch(“PASTE”) - it is as simple as that.

fetch(“https://syrinscape.com/online/frontend-api/elements/246763/play/?auth_token=cac89a2d64139af83769526b1cd5bac1831d5112”)

Or

await fetch(“https://syrinscape.com/online/frontend-api/elements/246763/play/?auth_token=cac89a2d64139af83769526b1cd5bac1831d5112”)

P.S. I couldn’t reply on the other thread as it said I can’t reply 3 times in a row.

1 Like

Additional!

You can go into Foundry via Firefox and make all the changes and add the links to Syrinscape with Syrincontrol Mod and then go back to Chrome and they all work.

You just can’t edit the sound sets in Chrome on Foundry for some bizarre reason.

1 Like