Info

Adform Video component ensures the proper performance of Adform Video Banners.

Public Methods

There are several public methods that can be used with the video player instance.

setVideoSource

public function setVideoSource(source:String):void
 
This method is used to change a video source in the video components runtime. The new video source will be started from the begining and will be in the play or pause state depending of the last video state. Mute and full screen will also be in the same state as they were in the previous video.
 
Parameters
source:String - Full link to a video source or an asset id in "settings.xml".
 

Events

AdformVideoEvent class is used to create and dispatch video events. User can do custom actions, interact and communicate with the video player through these events.
 
AdformVideoEvent.PLAY
  • Value: 'adformVideoEventPlay'
  • Description: Whenever a video source starts playing.

AdformVideoEvent.STOP

  • Value: 'adformVideoEventStop'
  • Description: Whenever a video source stops.

AdformVideoEvent.PAUSE

  • Value: 'adformVideoEventPause'
  • Description: Whenever a video source starts pausing.

AdformVideoEvent.LOAD_COMPLETE

  • Value: 'adformVideoEventLoadComplete'
  • Description: Dispatched when a video has loaded successfully.

AdformVideoEvent.LOAD_PROGRESS

  • Value: 'adformVideoEventLoadProgress'
  • Description: Dispatched when data is received as the download operation progresses.

AdformVideoEvent.PLAY_PROGRESS

  • Value: 'adformVideoEventPlayProgress'
  • Description: Dispatched when the video playing operation progresses.

AdformVideoEvent.START_SEEK

  • Value: 'adformVideoEventStartSeek'
  • Description: Dispatched when a video has started seeking.

AdformVideoEvent.END_SEEK

  • Value: 'adformVideoEventEndSeek'
  • Description: Dispatched when a video has stoped seeking.

AdformVideoEvent.COMPLETE

  • Value: 'adformVideoEventComplete'
  • Description: Dispatched when a video was played successfully till the end.

AdformVideoEvent.ON_CUE_POINT

  • Value: 'adformVideoEventOnCuePoint'
  • Description: Invoked when an embedded cue point is reached while playing a video file.

AdformVideoEvent.ON_META_DATA

  • Value: 'adformVideoEventOnMetaData'
  • Description: Dispatched when the application receives descriptive information embedded in the video that is being played.

AdformVideoEvent.SOUND_ON

  • Value: 'adformVideoEventSoundOn'
  • Description: Whenever the sound button has been toggled on.

AdformVideoEvent.SOUND_OFF

  • Value: 'adformVideoEventSoundOff'
  • Description: Whenever the sound button has been toggled off.

AdformVideoEvent.FULL_SCREEN_ON

  • Value: 'adformVideoEventFullScreenOn'
  • Description: Whenever a video enters the video fullscreen mode.

AdformVideoEvent.FULL_SCREEN_OFF

  • Value: 'adformVideoEventFullScreenOff'
  • Description: Whenever a video leaves the video fullscreen mode.

AdformVideoEvent.NET_CONNECTION_STATUS

  • Value: 'adformVideoEventNetConnectionStatus'
  • Description: Whenever the video net connection status changes (can be used only with streaming videos).

AdformVideoEvent.SWITCH_VIDEO_SOURCE

  • Value: 'adformVideoEventSwitchVideoSource'
  • Description: Whenever a video source was switched.

AdformVideoEvent.SET_VOLUME

  • Value: 'adformVideoEventSetVolume'
  • Description: This event is used to control volume of a video player. Also volume property must be set in the event constructor.

Examples

ActionScript2

Example 1:

import com.adform.events.AdformEventDispatcher;
import com.adform.events.AdformVideoEvent;

//event listener
AdformEventDispatcher.addAdformEventListener(AdformVideoEvent.PLAY, eventHandler);
function eventHandler(eObj:Object):Void
{
// custom code
}

//event dispatch
this.btn.onRelease = function() : Void{
   AdformEventDispatcher.dispatchAdformEvent({type:AdformVideoEvent.PLAY, targetsArr:["adformVideoPlayer"]});
}

Example 2:

import com.adform.events.AdformEventDispatcher;
import com.adform.events.AdformVideoEvent;

AdformEventDispatcher.addAdformEventListener(AdformVideoEvent.PLAY, callback);
AdformEventDispatcher.addAdformEventListener(AdformVideoEvent.ON_META_DATA, callback);

function callback(event:Object):Void {
    var response:String = '';

    switch (event.type) {
        case AdformVideoEvent.PLAY:
            response = 'Playing Video';
            break;

        case AdformVideoEvent.ON_META_DATA:
            response = 'Metadata event: framerate:  ' + eventObj.metaDataObj.framerate + ' fps.';
            break;
       }

    trace(response);
}

ActionScript3

Example 1:

import com.adform.events.AdformEventDispatcher;
import com.adform.events.AdformVideoEvent;

//event listener
AdformEventDispatcher.addAdformEventListener(AdformVideoEvent.PLAY, eventHandler);
function eventHandler(eObj:AdformVideoEvent):void
{
// custom code
}

//event dispatch
btn.addEventListener(MouseEvent.CLICK, playButtonClick);
function playButtonClick(e:MouseEvent):void{
    AdformEventDispatcher.dispatchAdformEvent(new AdformVideoEvent(AdformVideoEvent.PLAY,["adformVideoPlayer"]));
}

Example 2:

import com.adform.events.AdformEventDispatcher;
import com.adform.events.AdformVideoEvent;

AdformEventDispatcher.addAdformEventListener(AdformVideoEvent.PLAY, callback);
AdformEventDispatcher.addAdformEventListener(AdformVideoEvent.ON_META_DATA, callback);

function callback(event:AdformVideoEvent):void {
    var response:String = '';

    switch (event.type) {
        case AdformVideoEvent.PLAY:
            response = 'Playing Video';
            break;

        case AdformVideoEvent.ON_META_DATA:
            response = 'Metadata event: framerate:  ' + event.metaDataObj.framerate + ' fps.';
            break;
    }

    trace(response);
}

Video Event Object

AdformVideoEvent object is passed with every video event and depending of its type may have the following properties.

{event}.cuePointObj Object

Event property cuePointObj has the following properties.
 

{event}.metaDataObj Object

Event property metaDataObj has the following properties.
 

{event}.netConnectionObj Object

Event property netConnectionObj has the following properties.
 
 

Video Componets Inspector Properties

Video player and its controls' basic properties can be defined using the component inspector in Flash IDE. However, these values will be always overwritten by flash vars.
 

Video Controls (adformVideoPlayButton, adformVideoSeekBar, etc.)

Video Controls (adformVideoPlayButton, adformVideoSeekBar, etc.)

settings.xml

„settings.xml“ is a file that contains data with all the video assets belonging to a current banner. Video component will try loading „settings.xml“ file when „Asset ID“ is defined and ,also, it will try to play the video asset depending of an indicated „Asset ID“ (see example).
 

Example

			<root>
  <assets>
    <asset id="1" bitrate="530"  bwsource="0" source="rtmp://yourserver.com/cbr/video-530.flv" />
    <asset id="2" bitrate="498"  bwsource="1" source="rtmp://yourserver.com/cbr/video-498.flv" />
    <asset id="3" bitrate="372"  bwsource="1" source="rtmp://yourserver.com/cbr/video-372.flv" />
    <asset id="4" bitrate="718"  bwsource="1" source="rtmp://yourserver.com/cbr/video-718.flv" />
    <asset id="5" bitrate="950"  bwsource="0" source="rtmp://yourserver.com/cbr/video-950.flv" />
    <asset id="6" bitrate="1255" bwsource="5" source="rtmp://yourserver.com/cbr/video-1255.flv" />
    <asset id="7" bitrate="0" bwsource="0" source="http://www.yourserver.com/other_video.flv" />
  </assets>
</root>

 

Weight

ActionScript2:

adformVideoPlayer – 17095 bytes;
 

ActionScript3:

adformVideoPlayer – 19076 bytes;