The custom dynamic plug-in should do the following. Once compiled, you can use it like the pre-built dynamic plug-in.
1. Import com.omniture.AppMeasurementExtension.
2. Define a class that will be the SWF that extends AppMeasurementExtension.
3. Override the public function customizeExtension():void method.
4. Inside of your customizeExtension method, update the “s” member as needed. The “s” member is the instance of
AppMeasurement inside of the AppMeasurementExtension.
5. Compile your custom SWF linking against AppMeasurementExtensionOSMF.swc.
For example, the following ActionScript code for a custom dynamic plug-in does the following:
1. Overrides the video name tracked with the episodeID from the OSMF metadata.
2. In the Media.monitor method, sets eVar1 to the “series” key, eVar2 to the “season” key, and eVar3 to the “episode” key in
the http://www.corp1.com/ namespace.
3. In the Media.monitor method, sends in custom events “event1” as video starts and “event2” as video stops.
package {
import com.omniture.AppMeasurementExtension;
public class CustomPlugin extends AppMeasurementExtension {
public function customizeExtension():void {
super();
s.Media.autoTrackMediaName = "{media.player.metadata(http://www.corp1.com/
,episodeID)"
s.Media.monitor = function (s:Object,media:Object) {
s.trackVars = "events,eVar1,eVar2,eVar3";
s.trackEvents = "event1,event2";
s.eVar1 = media.player.metadata("http://www.corp1.com/","series");
s.eVar2 = media.player.metadata("http://www.corp1.com/","season");
s.eVar3 = media.player.metadata("http://www.corp1.com/","episode");
if (media.mediaEvent == "OPEN") {
s.events = "event1";
s.Media.track(media.name);
} else if (media.mediaEvent == "CLOSE") {
s.events = "event2";
s.Media.track(media.name);
}
}
}
}
}
OSMF Metadata
You can access OSMF metadata within your video player.
To use OSMF metadata inside of your Media.monitor method, call media.player.metadata(namespace,key), where:
namespace: (Optional) The OSMF metadata namespace you want to use. If you do not specify a namespace, the AppMeasurement
OSMF plug-in uses the first matching key it locates in any namespace. When looking for keys, the plug-in looks first at
MediaElement metadata, then at MediaResource metadata.
key: The specific metadata value you want to use.
For example, the following custom Media.monitor method sets eVar1 to the “series” key, eVar2 to the “season” key, and eVar3
to the “episode” key in the http://www.corp1.com/ namespace:
s.Media.monitor = function (s:Object,media:Object) {
s.trackVars = "events,eVar1,eVar2,eVar3";
s.trackEvents = "event1,event2";
s.eVar1 = media.player.metadata("http://www.corp1.com/","series");
s.eVar2 = media.player.metadata("http://www.corp1.com/","season");
s.eVar3 = media.player.metadata("http://www.corp1.com/","episode");
if (media.mediaEvent == "OPEN") {
s.events = "event1";
30Measuring Video for Developers