mozilla/popcorn-js

json parser and the code plugin

Opened this issue · 0 comments

It's currently not possible (I think) to use the code plugin through a json data file. Peeking here:

https://github.com/mozilla/popcorn-js/blob/master/parsers/parserJSON/popcorn.parserJSON.js

It seems like the json structure is passed straight to the plugin call, so the onstart and onframe values are always going to be strings and therefore not callable. Functions aren't valid json, so it seems like the code plugin would have to be special cased to eval the string in some way?

Just to be clear, I'd like to do something like

{
  "code": {
    "start": 10,
    "onStart": "function(){alert("hello")};"
  }
},