(BETA) The Flash Widget API can be used to create custom widgets using the widget data created in the Topspin platform. Currently, there are three types of widgets that this API supports:
Single Track Player
Email For Media
Since Topspin already provides these out of the box widgets, artists and developers may choose to create custom widgets with additional functionality and different UI, but still retain the Topspin event tracking based on campaigns. Using this API will abstract out any of the event logging logic so that is takes place automatically after registering the widget id (See below).
Developers must download the com.topspin.api package and add it to their classpath when compiling their AS3 widgets. The package can be downloaded either in swc format or a .zip file containing the classes and interfaces.
After you register and receive a TSWidgetEvent.WIDGET_LOAD_COMPLETE event, you may want to keep track of the campaign_id by using: ITSWidget.getCampaignId(). The campaign id must be sent in with each API call or the current campaign id is used. Use the ITSWidget to access data and perform certain actions against your widget_id.
To play an media, audio or video data, you must use the ITSPlaylist interface to ensure that proper event logging take place. The ITSPlaylist manages all the media in any given widget_id whether it be a Streaming Player or E4M. Both AudioData and VideoData implement an ITrackData interface so that loading, playing, seeking and playback functionality is identical regardless of the media type. The following is the it ITSPlaylist interface followed by ITrackData.
The ITSPlaylist manages a set of ITrackData objects. This interface is implemented by two classes, AudioData and VideoData which are wrappers for Sound and Video flash objects. Using the ITrackData interface, loading, getting info, and playback calls are made simple.