I am trying to get the duration of the ad to count down on the screen. Below is the code that I have working so far. The number of seconds is currently static and should be dymanic. Thanks in advance.
function ShowPreRoll(canvas, ad)
result = true
player = CreateObject("roVideoPlayer")
' be sure to use the same message port for both the canvas and the player
player.SetMessagePort(canvas.GetMessagePort())
player.SetDestinationRect(canvas.GetCanvasRect())
player.SetPositionNotificationPeriod(1)
timer = CreateObject("roTimespan")
timer.mark()
--> Problem area ad_duration = ad.length - timer
' set up some messaging to display while the pre-roll buffers
deviceInfo = CreateObject( "roDeviceInfo" )
displaySize = deviceInfo.GetDisplaySize()
overlay = {
TargetRect: {
x: Int( displaySize.w / 2 ) - Int( 336 / 2 ),
y: Int( displaySize.h / 2 ) - Int( 375 / 2 ),
w: 336,
h: 210
}
}
loadingText = {
--> Problem area Text: "Your video will begin after this message" + ad_duration.ToStr() + " seconds",
TextAttrs: {
Font: "Medium",
VAlign: "Bottom",
Color: "#FFFFFF",
},
TargetRect: {
x: Int( displaySize.w / 2 ) - Int( 1180 / 2 ),
y: Int( displaySize.h / 2 ) - Int( -600 / 2 ),
w: 575,
h: 30
}
}
canvas.Show()
Type Mismatch. (runtime error &h18) in ...:/source/VAST_VideoScreen.brs(52)
052: ad_duration = ad.length - timer
Backtrace: