Info

Adform Video component ensures proper performance of Adform Video Banners.

Public Methods

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

setVideoSource

public function setVideoSource(source:String):void
 
This method is used to change video source in video components runtime. The new video source will be started from begining and will be in 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 previous video.
 
Parameters
source:String - Full link to the video source or asset id in "settings.xml".
 

Events

AdformVideoEvent class is used to create and dispatch video events. User can do custom actions, iteract and comunicate with video player through these events.
 
AdformVideoEvent.PLAY
  • Value: 'adformVideoEventPlay'
  • Description: Whenever video source starts to play.

AdformVideoEvent.STOP

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

AdformVideoEvent.PAUSE

  • Value: 'adformVideoEventPause'
  • Description: Whenever video source starts to pauses.

AdformVideoEvent.LOAD_COMPLETE

  • Value: 'adformVideoEventLoadComplete'
  • Description: Dispatched when 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 video playing operation progresses.

AdformVideoEvent.START_SEEK

  • Value: 'adformVideoEventStartSeek'
  • Description: Dispatched when video has been started to seek.

AdformVideoEvent.END_SEEK

  • Value: 'adformVideoEventEndSeek'
  • Description: Dispatched when video has been stoped to seek.

AdformVideoEvent.COMPLETE

  • Value: 'adformVideoEventComplete'
  • Description: Dispatched when video has 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 being played.

AdformVideoEvent.SOUND_ON

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

AdformVideoEvent.SOUND_OFF

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

AdformVideoEvent.FULL_SCREEN_ON

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

AdformVideoEvent.FULL_SCREEN_OFF

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

AdformVideoEvent.NET_CONNECTION_STATUS

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

AdformVideoEvent.SWITCH_VIDEO_SOURCE

  • Value: 'adformVideoEventSwitchVideoSource'
  • Description: Whenever 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 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 video assets belonging to current banner. Video component will try to load „settings.xml“ file when „Asset ID“ is defined and also it will try to play a video asset depending of 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;