Flash Widget API Follow


(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:

  • Streaming Player
  • 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).

Getting Started

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.


You will need to load in a swf from our CDN (http://cdn.topspin.net/widgets/api/TSWidgetAPI.swf) and cast it as a com.topspin.api.data.ITSWidget.

Once the swf is loaded in, additional operations can take place. The following is an example of how the swf should be loaded into your application:

Loading an ITSWidget


Registering Your Widget ID

The widget id can be found in the published embed code from any of the 3 widgets types. 
For instance, the widget_id can be pulled from the flashvars below:

Streaming Widget Embed Code


Once you have an instance of the ITSWidget in your application, begin by adding listeners forcom.topspin.api.events.TSWidgetEvents and then register your widget id.

Register widget id


ITSWidget Interface

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.



ITSPlaylist Interface

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.



ITrackData Interface

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.




Additional documentation on the methods and such can be found in the source of the com.topspin.api package code. The source code for example project is also included in the .zip file.

Example: Topspin Flash Widget API Playground

Source Code

Latest source code is available on GitHub: 

Have more questions? Submit a request and our team will be able to help get you sorted.
Powered by Zendesk