gong-io/gecko

Doc request: where do you convert monologues object to wavesurfer regions ?

PaulLerner opened this issue · 5 comments

Hi,
I'd like to add some fields to the current json format, e.g. model confidence in the id of a speaker.
After writing a toy file with speaker looking like this:

"speaker" : {
      "id" : "Virgil",
      "confidence":0.8
    }

It gets correctly parsed to a monologue using app/textFormats/json.js parse function but I'm not sure where it gets converted into a wavesurfer region ?

On a related topic : I'd like that the user would not be able to resize and create new segments, so I added resize:false, in the options of the addRegion function.
However, after applying this it looks like the regions won't load and I get an error:

TypeError: elem.children[0] is undefined

which relates to this line : https://github.com/gong-io/gecko/blob/master/app/controller.js#L363

Hi,
I'd like to add some fields to the current json format, e.g. model confidence in the id of a speaker.
After writing a toy file with speaker looking like this:

"speaker" : {
      "id" : "Virgil",
      "confidence":0.8
    }

It gets correctly parsed to a monologue using app/textFormats/json.js parse function but I'm not sure where it gets converted into a wavesurfer region ?

Hi Paul

Yes, parsing/converting is going on in textFormats/json.js file

Later this parsed data converts to wavesurfer regions here

Ok, thank you.
Do you have any idea about the resize problem ?

On a related topic : I'd like that the user would not be able to resize and create new segments, so I added resize:false, in the options of the addRegion function.
However, after applying this it looks like the regions won't load and I get an error:

TypeError: elem.children[0] is undefined

which relates to this line : https://github.com/gong-io/gecko/blob/master/app/controller.js#L363

Hi Paul, sorry for long answer

Just wrap this line to

// unset handlers manual style
 if (elem.children.length) {
    elem.children[0].removeAttribute('style');
    elem.children[1].removeAttribute('style');
}

There is needed because with resize:false regions doesn't has a resize handles, so elem.children in an empty

No problem, thank you !