EmbeddedAd QML Type

Advertisement item designed for embedded applications. More...

Inherits:

Item

Properties

Signals

Methods

Detailed Description

The Qt Digital Advertising module offers easy to include advertisement content in your application. To use this module in your Qt Quick application, add the following import statement to your QML file

import QtDigitalAdvertising 1.1

The advertisement requested from a media server are based on the set up properties. Bare-minimum plugin properties set-up:

EmbeddedAd {
    anchors.centerIn:  parent

    width: 1920
    height: 1080
    playMode: QtDigitalAdvertising.AutoPlay
    displayMode: QtDigitalAdvertising.Loop
}

According to displayMode an advertisement could be diplayed in two modes: SingleShot or Loop .

Triggering play of the advertisement is based on playMode property. It could be AutoPlay, OnRequest or

Examples: Plugin playing advertisements in a loop automatically after item creation:

displayMode: QtDigitalAdvertising.Loop
playMode: QtDigitalAdvertising.AutoPlay

Plugin playing advertisements only once when user request it programmatically via play() method:

displayMode: QtDigitalAdvertising.SingleShot
playMode: QtDigitalAdvertising.OnRequest

Plugin playing advertisements in a loop when idle state is detected:

displayMode: QtDigitalAdvertising.Loop
playMode: QtDigitalAdvertising.OnIdle
inactivityTime: 2000

The size of the advertisement is based on the exact width and height of the the plugin:

width: 1920
height: 1080

It can be requested with the different size than the plugin size by setting mediaWidth and mediaHeight parameters.

mediaWidth: 1920
mediaHeight: 1080

In this case the advertisement content will be adjusted to the width and height of the placeholder.

Note: If your placeholder dimensions are different than advertisement size then you are obligated to specify mediaWidth and mediaHeight. In this case, the advertisement will be scaled to fit your placeholder. Otherwise, it could lead to not receiving the media from the media server.

Error handling

In case incorrect of missing advertisement request onAdvRequestFailed signal will be emitted. In case when there is no qualifying ad to be returned based on your campaign targeting parameters, no ad will be displayed and AdvNoAvailable signal will be emitted. This allows user to i.e. hide the advertisement placeholder.

Property Documentation

adPropertiesId : string

This property indicates which ad properties to load from the file. For more information please visit the Configure Advertisements section.


allowAudio : bool

This property holds information indicates whether the audio is allowed. By default, it is set to false. Set up property is OPTIONAL.


currentMediaType : string

This property holds the current handled media type information. By default it is set to Invalid.

ValueDescription
ImageThe advertisement content is an image.
VideoThe advertisement content is a video.
HTMLThe advertisement is an HTML page or flash application.

deviceId : string

This property holds any string, including an empty string, as long as it is unique for each network_id. Set up property is REQUIRED to properly display the advertisements.


displayAreaId : string

This property holds the id, it is important in the context of a request with multiple display areas, as each returned advertisement will have a display_area_id corresponding to the display area ID you requested. Set up property is REQUIRED to properly display the advertisements.


displayMode : enumeration

This property holds the display mode of the advertisement. By default, it is set to SingleShot.

The following are the possible values:

ValueDescription
SingleShotDisplays the advertisement once and stops.
LoopReplays the advertisement infinetly.

inactivityTime : int

This property indicates how much time, in milliseconds, has to pass from last mouse, touch or keyboard usage, in order to request an advertisement.

By default, it is set to 5000 ms.

This value is used only when playMode is set up to OnIdle.


lastImpressions : double

This property holds the last impression value reached from server


lastMediaCost : double

This property holds the last media cost value reached from server. The unit is nano dollar.


latitude : double

This property holds degrees north. Set up property is OPTIONAL.


longitude : double

This property holds degrees east. Set up property is OPTIONAL.


maxDuration : int

This property holds maximum acceptable asset duration, in seconds. Set up property is OPTIONAL but it is RECOMMENDED to properly display the advertisements.


maxFileSizeBytes : int

This property holds maximum file size (in bytes) that is supported by the device. Set up property is OPTIONAL.


mediaHeight : int

This property holds exact requested media height. This media height will be requested from media server. If not set up or 0, QtDigitalAdvertising::height will be requested.


mediaWidth : int

This property holds exact requested media width. This media width will be requested from media server. If not set up or 0, QtDigitalAdvertising::width will be requested.


minDuration : int

This property holds minimum acceptable asset duration, in seconds. Set up property is OPTIONAL but it is RECOMMENDED to properly display the advertisements.


orderId : string

This property holds specifying the contract number of an order in this field will only return advertisements for that order. Set up property is OPTIONAL.


playMode : enumeration

This property indicates if advertisements will be displayed immediately, later on by user, or when idle mode is detected By default, it is set to AutoPlay.

ValueDescription
AutoPlayThe advertisements will be displayed immediately
OnRequestThe advertisements will be displayed when requested by user using play() function.
OnIdleThe advertisements will be displayed when no mouse, touch or keyboard inactivity after inactivityTime timer expire

staticDuration : int

This property holds supported duration (in seconds) for static creatives. All static assets will be returned with the duration set to this value. Set up property is OPTIONAL but it is RECOMMENDED to properly display the advertisements.


supportedImageFormats : string

This property holds audio formats that are requested from media server. Media formates need to be coma separated. By default, it is set to "".

The following are the possible values:

Value
jpeg
png

supportedVideoFormats : string

This property holds video formats that are requested from media server. Media formates need to be coma separated. By default, it is set to "".

The following are the possible values:

Value
mp4
mpeg
mpg
quicktime
webm
x_flvx_flv
x_ms_wmv
x_msvideo

Signal Documentation

adClicked()

This signal is emitted when the advertisement was clicked.

Note: The corresponding handler is onAdClicked.


adEnded()

This signal is emitted when the advertisement ends.

Note: The corresponding handler is onAdEnded.


adError(string = error)

This signal is emitted when ad request parameters are missing or incorrect.

Note: The corresponding handler is onAdError.


adRequested()

This signal is emitted when the advertisement was requested.

Note: The corresponding handler is onAdRequested.


adStarted()

This signal is emitted when the advertisement started to play.

Note: The corresponding handler is onAdStarted.


idleState(bool = isActive)

This signal is emitted when ad request parameters are missing or incorrect.

Note: The corresponding handler is onIdleState.


Method Documentation

play()

Triggers playing advertisements if plugin not displaying advs currently.


stop()

Stops displaying advertisements and all jobs in related. Also triggers expiration procedure for all requested advertisements


© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.