logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Dist  
#1 Posted : Monday, June 27, 2022 9:28:28 PM(UTC)
Dist

Rank: Advanced Member

Groups: Registered
Joined: 12/19/2019(UTC)
Posts: 41
United Kingdom

Was thanked: 23 time(s) in 16 post(s)
Is it possible to structure a JSON data source in a way for vMix to treat it as if it was multiple tables (like a Google Sheet data source).

I'm currently developing the Google Sheet module for Companion, and working on allowing it to be used as a data source for vMix as the native handling of Google Sheets is improperly done. Currently I can structure each individual sheet in a way that's suitable to be used as a Data Source in vMix but it will only show as a single table, meaning that if a Google Spreadsheet has 20 individual sheets, it would need 20 data sources. What I'm looking for is if there is any way to structure a single JSON data source so that vMix will split it into multiple tables?
doggy  
#2 Posted : Friday, July 1, 2022 5:44:57 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,088
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
WOuld it not be easier to make it a XML instead of Json so one can select the sheet per XPATH ? That way could ask for a multi xpath select option like one can with sheets ?
Dist  
#3 Posted : Friday, July 1, 2022 9:25:12 PM(UTC)
Dist

Rank: Advanced Member

Groups: Registered
Joined: 12/19/2019(UTC)
Posts: 41
United Kingdom

Was thanked: 23 time(s) in 16 post(s)
No, XML would not be easier.

Not only is JSON more performant than XML when it comes to parsing and in transit, but it's also the data structure used within Companion.

Additionally, if vMix did support multiple sheets within a JSON data source then I could let the user decide which sheets they want to request, or all of them, simply by adjusting the query params.

Because vMix doesn't appear to support multiple sheets when using JSON as a data source, it means that a user has to have each sheet they want as an individual data source. It's tedious, but the benefit of it is that it's dramatically more responsive than using the Google Sheet in vMix as a data source, as from my testing it appears vMix uses 1 request per Google Spreadsheet to get a list of all sheets in that spreadsheet, and then 1 request per sheet. Which means for example on a 21 page sheet you're making 22 requests every interval set, and with Google's default rate limit for sheets being 100 requests per 100 seconds, that means you'd need to set the polling interval over 20 seconds. Where as on that same 21 sheet spreadsheet, with Companion and that same default 100/100 rate limit I'm able to poll every 1.25 seconds (and I could do it faster, but that is suitable for testing).
doggy  
#4 Posted : Saturday, July 2, 2022 12:45:23 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,088
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
Originally Posted by: Dist Go to Quoted Post
but it's also the data structure used within Companion.


vMix doesn't take companion into account as it has its own Stream Deck interface

Quote:
Additionally, if vMix did support multiple sheets within a JSON data source then I could let the user decide which sheets they want to request, or all of them, simply by adjusting the query params.


Like one currently can with xml DS?

Seems the issue is rather google sheets due to their polling limitation .

Had something similar recently and just used a small external app (script) where i could select what i wanted (16 * 4 selection options ) that would transfer that selection into a single datasource file in vMix. was easy to select through dropboxes and the DS automatically updated accordingly




Dist  
#5 Posted : Saturday, July 2, 2022 1:02:12 AM(UTC)
Dist

Rank: Advanced Member

Groups: Registered
Joined: 12/19/2019(UTC)
Posts: 41
United Kingdom

Was thanked: 23 time(s) in 16 post(s)
Originally Posted by: doggy Go to Quoted Post

vMix doesn't take companion into account as it has its own Stream Deck interface


So what's convenient and most performant for 3rd party devs is not something vMix developers take into account? It's not just Companion, JSON is quite popular ;)


Originally Posted by: doggy Go to Quoted Post

Seems the issue is rather google sheets due to their polling limitation .


No, vMix is not properly implementing Google Sheets API, and is making significantly more requests than required to get the exact same data that anyone else can get. Googles Developer support themselves when questioned on this said rate limiting issue can be solved with batch requests, which Companion uses so can poll the exact same data with significantly greater frequency than vMix. Companion can poll 400,000 cells from 21 sheets of a Google Spreadsheet every 1.25 seconds without 429'ing, vMix for that exact same data 429's due to too many requests if set to poll faster than every 22 seconds, that's the fault of vMix, not Google and their polling rate limits.


An example of the sort of thing I'm asking for is a simple check if the JSON is an array, or an object. Currently it expects an array, such as:
[{ "A": "cell A1", "B": "Cell B1" }, { "A": "cell A2", "B": "Cell B2" }]

All it would take to support multiple tables in a single JSON data source:
{ table1: [{ "A": "cell A1", "B": "Cell B1" }, { "A": "cell A2", "B": "Cell B2" }], someOtherTable: [{ "A": "cell A1", "B": "Cell B1" }, { "A": "cell A2", "B": "Cell B2" }] }


The former requires 1 data source per table, the latter would only need 1 data source for as many or as few tables from a sheet the user needs.

Edit: and just to add, if vMix did properly poll the Google Sheets API and wouldn't use excessive requests then this'd be less of an issue as users wouldn't need to proxy a data source through Companion to be more responsive than vMix as vMix's native solution could have the same performance.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.