Track Video Player Events

You can track media players by creating functions attached to the video player event handlers

This lets you call Media.open, Media.play, Media.stop, and Media.close at the appropriate times. For example:

Load: Call Media.open and Media.play

Pause: Call Media.stop. For example, if a user pauses a video after 15 seconds, call s.Media.stop("Video1",15)

Buffer: Call Media.stop while the video buffers. Call Media.play when playback resumes.

Resume: Call Media.play. For example, when a user resumes a video after initially playing 15 seconds of the video, call s.Media.play("Video1",15).

Scrub (slider): When the user drags the video slider, call Media.stop. When the user releases the video slider, call Media.play.

End: Call Media.stop, then Media.close. For example, at the end of a 100-second video, call s.Media.stop("Video1",100), then s.Media.close("Video1").

To accomplish this,you can define four custom functions that you can call from the media player event handlers. The various parameters passed into Media.open, Media.play, Media.stop, and Media.close come from the player. The following pseudocode demonstrates how this might be done:

/*Call on video load*/
function startMovie(){	
	s.Media.open(mediaName,mediaLength,mediaPlayerName);
	playMovie();	
}

/*Call on video resume from pause and slider release*/
function playMovie(){
	s.Media.play(mediaName,mediaOffset, segmentNum, segment, segmentLength);
}

/*Call on video pause and slider grab*/
function stopMovie(){
	s.Media.stop(mediaName,mediaOffset);
}

/*Call on video end*/
function endMovie(){
	stopMovie();
	s.Media.close(mediaName);
}

JavaScript AutoTrack

The JavaScript media module for identifies all <embed> or <object> tags in the page HTML. It then searches the data in each tag to determine which media player, if any, is being used. If the player is Windows Media Player, Quicktime, or Real Player, autoTrack can be used, though autoTrack for Windows media player works only with Internet Explorer. Manual tracking for Windows Media Player is required to support all other browsers.

You must have the classid attribute set on the object you want to track. The classid is required to expose the event handlers used by the Media Module to automatically track the video.

s.Media.autoTrack = true