requestSchedule
Collapse the table of content
Expand the table of content

AdScheduler.requestSchedule method

Requests an ad schedule from the Microsoft ad server and inserts it into the timeline of the MediaPlayer that was passed to the AdScheduler constructor.

Note  This method is intended to be used by partners who have received an application ID and ad unit ID from their Microsoft representative to receive ads from the Microsoft ad server. If you want to show video ads from a different ad service, use the requestScheduleByUri instead.
 

Syntax


var promise = adScheduler.requestSchedule(applicationId, adUnitID, adTags);

Parameters

applicationId [in]

Type: String

The application ID of the app. For more information, refer to your Microsoft representative.

adUnitID [in]

Type: String

The ad unit ID to use. For more information, refer to your Microsoft representative.

adTags [in, optional]

Type: String

An array of up name and value pairs that will be appended to the request URL. This parameter is optional. See the remarks for more information.

Return value

Type: Promise

A Promise object that completes when the schedule has been received.

Remarks

Applications should wait for requestSchedule to return before starting to play the primary video content in the MediaPlayer. Starting to play media before requestSchedule returns (in the case of a pre-roll advertisement) will result in the pre-roll interrupting the primary video content.

Use the then method of the Promise return value to specify the onComplete function to call when the promise completes successfully and the onError function to call if an error is encountered.

  • In your onComplete function, start playback of your video content. The ad will start playing at the scheduled time.
  • In your onError function, handle the error and then start playback of your video. Your video content will play without an ad. The argument of the onError function is an object that contains the following members.
    MemberDescription
    errorMessageA string that describes the error.
    errorCodeOne of the ErrorCode values.

     

Ad tags

The optional adTags parameter is a JSON collection of name/value pairs that can be used for apps that have advanced targeting. For example, an app that plays a variety of auto-related videos might supplement the ad unit ID with the make and model of the car being shown. This parameter is intended to be used only by partners who receive approval from Microsoft to use ad tags.

The following items should be noted when referring to adTags:

  • This parameter is a very rarely used option. The publisher must work closely with Microsoft before using adTags.
  • Both the names and the values must be predetermined on the ad service. Ad tags are not open ended search terms or keywords.
  • The maximum supported number of tags is 10.
  • Tag names are restricted to 16 characters.
  • Tag values have a maximum of 128 characters.

Requirements

Client

Windows 10

Namespace

MicrosoftNSJS.Advertising

Library

AdScheduler.js

See also

AdScheduler
Add advertisements to video content

 

 

Show:
© 2017 Microsoft