SwfdecPlayerScripting

## SwfdecPlayerScripting SwfdecPlayerScripting — integration with external scripts |

## Synopsis

    #include <swfdec/swfdec.h>

                        SwfdecPlayerScripting;
                        SwfdecPlayerScriptingClass;

## Object Hierarchy

      GObject
       +----SwfdecPlayerScripting

## Description

The `SwfdecPlayerScripting` object is used to implement the ExternalInterface object inside Flash. By providing your own custom implementation of this object using `swfdec_player_set_scripting()`, you can allow a Flash file to call your own custom functions. And you can call functions inside the Flash player.

The functions are emitted using a custom XML format. The same format is used to call functions in the Flash player. FIXME: describe the XML format in use.

## Details

### SwfdecPlayerScripting

    typedef struct _SwfdecPlayerScripting SwfdecPlayerScripting;

The object you have to create.

### SwfdecPlayerScriptingClass

    typedef struct {
      char *		(* js_get_id)	(SwfdecPlayerScripting *scripting,
    					 SwfdecPlayer *		player);
      char *		(* js_call)	(SwfdecPlayerScripting *scripting,
    					 SwfdecPlayer *         player,
    					 const char *		code);
      char *		(* xml_call)	(SwfdecPlayerScripting *scripting,
    					 SwfdecPlayer *         player,
    					 const char *		xml);
    } SwfdecPlayerScriptingClass;

You have to implement the virtual functions in this object to get a working scripting implementation.

`js_get_id` () | optional function. Returns the string by which the scripting object can reference itself in calls to the `js_call` function.
`js_call` () | optional function. Emits Javascript code that you have to interpret. You must also implement the `js_get_id` function to make this function work. The return value must be in the custom XML format.
`xml_call` () | optional function. If the Javascript functions aren't implemented, an xml format is used to encode the function call and the call is then done using this function. The return value is to be provided in the same custom XML format.