SyrinControl - WIP FoundryVTT module integration

Hi there!

For the last couple of days, I’ve been working on integrating Syrinscape Online with Foundry VTT. This tool only controls the Syrinscape Online via API you provided but does not stream sound.

I still find it very handy during my sessions, after all, it’s one less window to maintain, plus I can set a mood to a given scene and simply forget about it. Syrinscape will play right tone every time :slight_smile:

Please, keep in mind that this module is still in early-stages. Usable but very rough.

Meanwhile, I had to make a bypass for the CORS problem (referred many times in other topics). While making such a CORS proxy is possible for self-hosted games, it is going to be a huge pain for shared solutions like ForgeVTT which I use personally.
The authors of ForgeVTT do not want to add such a proxy and I can not blame them - it seems it should be fixed on the Syrinscape API side.

For now, I can still use my module on ForgeVTT by using dirty hack with CORS proxy on localhost docker container under NGINX proxy (for self-signed HTTPS certificate)…
But this is not the right way for an average GM.

I will be happy to cooperate with you and find a better solution.

6 Likes

This looks pretty cool!

@Steve uses Foundry… we should be able to take a look! :smiley: :trophy: :beer:

@ryan.cassar or @sonofconan may be able to comment on the proxy stuff, and shed a bit of light.

This looks great, I shall give it a try in my next game! :grin:

Perfect! I hope we can make this integration smooth and awesome :slight_smile:

I made a bug fix release that solves a few issues but mainly, it sets the default synchronization method to the CSV file. It means the GM needs to download a CSV file with control links from Master Panel and upload it to the foundry.

Thanks to this method, SyrinControl doesn’t need a CORS proxy. However, this is still far from an acceptable solution for an average GM.
With SuperSyrin subscription, the CSV file grows up to dozens of megabytes, making the whole sync unnecessarily slow.
What is more, this method requires further re-uploads whenever you release new content, or GM buys a new Soundset.

Therefore, I believe we need to find a way to use an API without CORS in the first place.
If you need extra details about FoundryVTT API, FoundryVTT Dev Team declared they are willing to help, as well as I am :slight_smile:

Hi @Steve and @benjamin,

I’m the project coordinator for Foundry VTT. If there is anything our team can do to help reconcile any API integration issues we’ll be glad to help out. We can arrange for a channel to communicate about Frondeus’ project in our community discord if it would be helpful; or open a joint email between all of us and the FVTT staff.

Whatever we can do to assist, please let us know.

Cheers,
Shane M. (Anathema)
Project Coordinator
Foundry VTT

1 Like

Hey @sm.anathema

Awesome! Let’s get this conversation going. I’ll chat with @Steve about what works best for him, email or Discord (I don’t really do Discord… but I could make it a thing).

We’ll jump on back here in soon. :slight_smile: :smiley:

Just tried it out. Works great. What I would love is if Syrinscape would allow my players to trigger sounds in foundry based on the fact that they are connected to a session where the GM is a SuperSyrinscape owner. That way the modules ability to create macros could be used for connected players to trigger spell sounds in the game.

2 Likes

This sounds great @sm.anathema, we would be very interested in having a chat to see how we could best approach this. As @benjamin mentioned above I use Foundry myself for my online gaming and would love to find an easy way to integrate the two.

I shall send you an email and then we can start to get the ball rolling :grin:

You can work around the CORS issue if you fetch blind:

    // Syrinscape currently doesn't allow CORS, so all we can get is
    // an opaque response.  That means that we can't report if
    // Syrinscape returns a 401 Forbidden.  We can detect network errors,
    // but for now we just let them go to the console.
    log("Sending Syrinscape API request for ", event);
    await fetch(apiUrl, {
        method: 'POST',      // XXX Supposedly sometimes should be GET
        mode: 'no-cors',
        cache: 'no-cache',
        credentials: 'omit',
        redirect: 'follow',
        referrerPolicy: 'no-referrer',
    });

However, I really would like to see Syrinscape add the CORS headers to the web API, so workarounds become unnecessary!

Yes, that’s precisely what SyrinControl does with the CSV synch method:

  • It can control Syrinscape Online by sending “blind” fetch (Fire and Forget)
  • However, it cannot ask Syrinscape Online for the list of all soundsets available because it needs to read the response.

That would be super cool. I think I’d need to introduce some kind of socket proxy but it is possible.

Ah, gotcha! I’m sorry; I hadn’t read the source (and missed an above post) before I posted that, and assumed you meant that you needed the proxy for all operations. (I’m very interested, but my game starts in an hour, and I’m barely prepped! On the upside I’ve got a great soundtrack going!) As your program can cache the CSV, especially since the user can upload it to be cached, then it may not be a big deal to require a proxy.

Rather than using direct user-to-user communication, what if you communicated through Foundry? You could, for instance, create a new DocumentCollection (I think there’s a tutorial for that). The player’s client creates new Documents to post requests for sounds, and the GM’s client hooks the various _onCreateDocuments etc. to fulfill them (and then delete them once fulfilled).

There’s other places where you could set requests, such as in a journal entry. But these are difficult to manage without race conditions.

Oh yes this would rock

Any advancement on this in the last few months?
I honestly want to give Syrinscape money (the company seems really cool), but I can’t use the product as all my gaming is done on Foundry.

Is it possible to get some help setting up my integration with Foundry VTT?

I installed the module Syrinscape control.
I input my auth token into the module settings
A list of my Syrinscape sound sets appears in my Foundry audio playlists
but…when I save module settings I get the error message;
Syrincontrol; get Soundsets; failed to fetch

Any idea what I’m doing wrong?
Thanks!

Hi there!
A month ago, I released a new version, but it still waits for the resolution of the CORS issue to fully leverage the API.

Hi, could you create an issue at https://github.com/frondeus/fvtt-syrin-control/issues?
It is the primary tool where I track all my progress for Syrin Control, plus I just created a template that should help you by asking a couple of questions that might give me extra details about what went wrong :slight_smile:

1 Like

Hey I am having an issue where everything looks fine, I get no error messages in the logs but no sound plays. Other sounds play within the system, all the messages come up telling a sound is playing, the controls show a sound is playing and I can even stop it. But I get no sound. I did create a ticket but thought I would discuss it here to see if anyone else ran into the issue and had a fix.

1 Like

Opps I missed the part where everyone needed the online player. Darn that is the issue I have, I was sort hoping it would stream through the Foundry application. Oh well :slight_smile:

1 Like