Accessing the Syrinscape API with javascript

I might have found a workaround. i can build all the links I need when I have the Auth key and the information provided in syrinscape_remote_control_links_Sven_.csv
Either i can use the public version, or I have to do regular updates of my scripts manually.
A Public version would of course be easier :slight_smile:

I’m really glad someone’s building this! I’ve been putting sound links I want to use in journal entries and individual macros manually, and that works well for a scene or very often used sounds. But, I’d prefer something purpose-built in the long run.

It’s my first foray into proper coding. But i managed to parse the csv. So I might get a prototype running soon.

I’d be happy to help test if you need a guinea pig.

1 Like

I hit a small milestone today. I managed to create a module that reads in the csv and outputs the values to the console.
Not much but baby steps :smiley:

4 Likes

Im super interested in this and your work here.

2 Likes

I was a bit busy the last few days, so I didn’t make much progress. I will have some time off soon though and I plan to use that to continue on the module.

Just keep in mind that this is only a remote. It won’t be able to pipe audio into fvtt directly. That would need a way to add your own player and AFAIK this isn’t planned yet.

1 Like

Small Update:

I got the Parsing off the CSV down, now I need to create the control menus from that data:

  • Using Categories as filters for Soundsets
  • Using the Soundset as Filter for Moods
  • Generating the Links for each Mood
  • Generating a Stop Button (I think I need to use the Silence Soundset for that)
  • Building a nice Menu around all that.

I would also love to find a way, so i can add the Soundsets to Journal Entries and the like in order to start them Quickly.

I shall keep posting updates here.

3 Likes

Thanks for the update @chrome it’s looking really promising :slight_smile:

1 Like

Hello, I’m a Senior Software Engineer. I’m interested I’m helping. I build APIs.

2 Likes

Heya,

Grab us at support at syrinscape dot com and we’ll set you up with the info you need. :slight_smile:

1 Like

Any updates on this? I am eager to try out whatever anyone might have in the works.

Unfortunately I still lack the skill to work with the API as it is right now. I placed my findings in the hands of some other Foundry Devs - hopefully they will be able to pick up th torch.

A few others have picked up the torch and eadorin (patreon “Foundry Workshop”) has a basic mod working (still in alpha), but unfortunately there is no current support for turning Foundry into a minion that broadcasts the sound output by the DM’s Syrinscape Online Player. One can make an interface / GUI in Foundry that allows one to duplicate the functionality of the Master Interface (so you don’t have to switch tabs to change sounds, though you do have to manage an additional window within Foundry). Your players, though, still have to have an Online Player downloaded and connected to your Syrinscape instance, and that Control Panel / Online Player manages things like syncronicity and runs in addition to Foundry.

It’s disappointing to be sure, given the issues a lot of us have with our players struggling around the Online Player / connecting to the DM / a-sync issues / dropped-sounds, but that is where things stand at present.

Hi,

I’ve been working on a custom remote much like the OP, and run into the same CORS issues. I am not a javascript developer, so I’m on a bit of a learning curve - apologies if I ask a stupid question!

It seems (from the little I understand!) that any XHR request from javascript will not be able to return a response - is that right?

Is it possible to consider relaxing the CORS policy, at least for some request URLs? I’m hoping that maybe @sonofconan will be able to give some pointers, if it’s not a bother!

Thanks,
Tom

@yamahito that’s correct. I’ll reply here where we have made the necessary changes on our end to relax CORS requirements. But I can’t say when that might be.

In the meantime, you would need to implement your own local proxy. For example a Python web server that handles your requests and then makes its own request to our server directly without CORS restrictions, or the Node.js proxy linked to earlier in this thread:

1 Like

Thanks for the quick reply!

I’ll have a think about the node.js proxy, but as it may require more hosting, I may just try to be patient :wink:

1 Like

I totally caved and got cors-anywhere working… #SorryNotSorry

2 Likes

I’m trying to get this to work as well, I was able to comment most of the macro the OP posted and it does work…

If I make a Macro in Foundry VTT to play on casting the Bless spell for instance
fetch('https://www.syrinscape.com/online/frontend-api/elements/415635/play/?auth_token=SecretToken', { mode: 'no-cors'})

It plays, but at max volume. Is there a way through the link to specify to play at like 50%? I have the One Shot volume at 100% due to needing the voices to be heard, but if we cast a spell it is very loud.

Thanks

Hi,

My control panel has been working for weeks - until tonight’s game.

I’m now getting 401 responses from syrinscape via the cors-anywhere proxy. Is there an updated way of accessing the URIs?