Advertising in the Player Framework on Windows 8 and Windows Phone 8

(JavaScript and Xaml versions)

Microsoft Media Platform Player Framework now includes support for video advertising through a set of optional advertising plugins.

Scheduling ads

Scheduling is the first step to playing ads in the player framework. This allows your app to telling the player framework when to play each ad. Ad scheduling is separate from the ad handling (playing the ad) and is independent of the type of ad you want to
play.

Available scheduling options

VMAP (Digital Video Multiple Ad Playlist).
VMAP is an IAB recommended xml schema that defines when ads should play for a given piece of content. The player framework includes a VMAP scheduler plugin that will download, parse and consume to control the timing of ads for you.

MAST (Media Abstract Sequencing Template).MAST is an xml schema that defines when ads should play. The player framework includes a MAST scheduler plugin that will download,
parse and consume to control the timing of ads for you.

FreeWheel SmartXML. FreeWheel is a company that serves ads. FreeWheel supports VAST as well as a proprietary standard known as SmartXML. The player framework ships with a plugin specifically made for FreeWheel's
SmartXML. Unlike VMAP or MAST, SmartXML includes both scheduling and ad payload information in a single XML file.

AdSchedulerPlugin. This is recommended path for most apps looking for out-of the box scheduling but and are willing to help programmatically provide metadata about when each ad should play. With this option, you simply populate a collection of ads
and info about when each ad will play. The AdSchedulerPlugin will do the rest.

DIY scheduling. Another option is to not use the options above and instead have finer grained control over scheduling in your app. This is the recommended approach if you have specific requirements that the options above do not support. There are
two ways to create your own scheduling logic:

Build a custom player framework plugin to schedule ads. Feel free to look at the source code for the AdSchedulerPlugin to see how we did it.

Simply call AdHandlerPlugin.PlayAd when it is time to play an ad. A Task (or promise in JavaScript) is returned to help track the ad or ad pod. Additionally, the AdHandlerPlugin exposes the active VPAID player (which in turn has events) for greater detail
about what is happening during the course of an ad.

Types of scheduled ads

There are three different categories of scheduled ads…

Prerolls are played before the user sees the first frame of the main content.

Midrolls can be interspersed throughout the main content. The main content is paused while a mid-roll plays. Users are not able to seek or FF during an ad, but can still perform some functions such as changing the volume or pausing the ad. Optionally,
ads can be configured to allow skipping after a certain amount of time.

Postrolls are played after the main content finishes. If using a playlist, Postrolls will play before the next video in the playlist.

Playing ads

Ad Formats

When it is time to play an ad, the player framework needs to know the format of the ad payload. Here are different types of ad payloads that are supported.

VAST: The most popular format is the IAB endorsed standard called
VAST. Here, ads, ad pods, business rules specific to the ad, and tracking data is included in a single xml file stored on an ad server. Simply give MMPPF a VAST URL, stream, or deserialized model for a VAST document and
we’ll do the rest.

Simple clips: Another route is to just play a clip. You can simply tell the player framework what the URL for your clip is, the mime type, and optionally a click through URL. The player framework will do the rest.

Custom ad formats: Lastly, you can also create your own ad formats.

If you don’t use VAST but want to play ads that use a subset of the VAST feature set, you can build a custom IAdSource or IResolvableAdSource implementation and populate a VAST ad document model to be used by the VAST ad handler.

For even more control, you could create a custom IAdPayloadHandler plugin that can participate in playing ads and handle ad payloads of any type. The out of the box ad handlers support this same interface.

Ad types

Linear, nonlinear, and companion ads are all supported by VAST and the player framework. If you are playing a simple clip, the clip is always assumed to be a linear ad.

Linear ads: This can be any video type that is supported on Windows 8.

Non-linear ads: This can be any image type supported on Windows 8.

Companion ads: Static resource companions (vs. html or IFrames) are the only type supported at this time. Companion ads must be images.

VAST

The player framework supports the entire VAST 3.0 spec and additionally is downward compatible with the
VAST 2.0 feature set. Please refer to the spec for more information on what is supported. Here is a sampling of some of the more important features for your convenience:

Wrapper ads

Tracking beacons

Error handling

Ad pods

Linear, nonlinear and companion ads

Complex creative concepts composed of more than one creative type

Ability to switch from linear to nonlinear within an ad.

Icons

The player framework also tries to dynamically select the media file best suited for the current user and player. We use current bitrate (specified via AdHandlerPlugin.PreferredBitrate), player size, and preferred formats to help prioritize which media should
be used.

VPAID

VPAID is the interface defined and endorsed by
IAB to help create ad players. MMPPF supports VPAID 1.x as well as the newly released: VPAID 2.0.

By default, the player framework ships with two VPAID players (one for linear video ads and another for nonlinear image ads). It is also possible to build your own VPAID players and expose them by creating a custom IAdPlayerFactory plugin.

Under the hood

Ads are played by pausing the main video, creating a secondary MediaElement and using it to play the ad. Here is the typical order of events for playing a VAST pre, mid, and postroll.

The MediaPlayer is told to open a video (stream or URL)

MediaPlayer.MediaOpen fires

If AutoPlay is set to false, the player waits for the user to click play.

PREROLL

Before playback actually begins:

An indeterminate progress bar is displayed.

OPTIONAL: The VAST ad for a preroll is downloaded and parsed on a background thread. Note: this can be done ahead of time by using different ad source types.

A VPAID player is selected to play the ad.

The ad is loaded (by setting source on the new MediaElement).

The ad is played.

As soon as the ad is over (or turns into a nonlinear ad), playback of the main content begins.

Playback begins for the main video (possibly alongside a nonlinear ad within the preroll).

MIDROLL

The scheduled time to play the ad occurs.

The main video pauses.

An indeterminate progress bar is displayed.

OPTIONAL: The VAST ad for a preroll is downloaded and parsed on a background thread. Note: this can be done ahead of time by using different ad source types.

A VPAID player is selected to play the ad.

The ad is loaded but hidden (by setting source on the new MediaElement).

The ad is displayed and plays.

POSTROLL

The main content completes.

MediaElement.MediaEnded fires

An indeterminate progress bar is displayed.

OPTIONAL: The VAST ad for a preroll is downloaded and parsed on a background thread. Note: this can be done ahead of time by using different ad source types.

A VPAID player is selected to play the ad.

The ad is loaded (by setting source on the new MediaElement).

The ad is played.

OPTIONAL: The next playlist item is loaded and the process is repeated.