Class: IQ

IQ


new IQ()

IQ class.

It provides the API to report events for Ooyala IQ backend

Methods


handleEvent(message)

HandleEvent should be called every time an event arises on the roVideoScreen/ roVideoPlayer message port (usually as a part of the main event loop). The IQ SDK will then process and report the appropriate events to the IQ backend.

Parameters:
Name Type Description
message

Roku event obtained in the main loop with msg = wait(1000, messagePort)


init(pcode)

Init the IQ library, starts the session

Parameters:
Name Type Description
pcode

The API key found in Ooyala Backlot, which identifies your account to Ooyala


reportCustomEvent(name, metadata)

Report a custom event.

Parameters:
Name Type Description
name String

Event name

metadata

Event metadata

Example
m.iq.reportCustomEvent("myEvent", {val1 : 42, myString : "my custom string"})

reportEventLoopExit()

This method should be called when the content event loop is exited (content end, user action, and so on).


reportPlayRequested(isAutoPlay)

This method should be called when the user has requested the video to start playing.

Parameters:
Name Type Description
isAutoPlay Boolean

Boolean indicating whether the video was automatically played or started by the user


reportReplay()

This method should be called when a user replays a video.


setContentMetadata(metadata)

Sets the metadata from a video about to be played.

Parameters:
Name Type Description
metadata IQ.ContentMetadata

metadata object


setGeoInfo(geoInfo)

Sets the geo info to be reported to the IQ backend (optional)

Parameters:
Name Type Description
geoInfo IQ.GeoInfo

geo info


setUserInfo(userInfo)

Sets the user info to be reported to the IQ backend (optional)

Parameters:
Name Type Description
userInfo IQ.UserInfo

user info

Type Definitions


AgeGroup

Type:
  • Object
Properties:
Name Type Description
min number

user age group minimum age

max number

user age group maximum age


ContentMetadata

Type:
  • Object
Properties:
Name Type Description
duration number

Duration of the content in seconds

assetId String

Video's embed code

assetType String

asset type : "ooyala" or "external"


GeoInfo

Type:
  • Object
Properties:
Name Type Description
countryCode String

ISO 2-alpha code of the country of the user

region String

Region of the user

state String

State of the user

city String

City of the user

latitude Number

Latitude of the user

longitude Number

Longitude of the user

geoVendor String

Name of the vendor which provided these details. If available.


UserInfo

Type:
  • Object
Properties:
Name Type Description
emailHashMD5 String

MD5 hash of the user email

userId String

User Id

gender String

User gender ("M" or "F")

ageGroup IQ.AgeGroup

user age group