使用 RAF 时如何删除默认文本,例如(广告 1,共 1)
How to remove defalult text when using RAF eg(Ad 1 of 1)
我正在使用 bright 脚本开发 RAF(Roku 广告框架)。
在上图中,我们在播放广告时看到 (Ad 1 of 1)。
请给我解决这个问题的建议,非常感谢任何帮助。
Nas在一定限度内是正确的。如果您正在观看广告,Roku 清单将希望启用 "Feedback UI"(这是 "Ad 1 of 1")
现在,可以创建自己的 roVideoPlayer 来播放广告。它需要做更多的工作...
'handle this else where (like the construct):
function main
'm._raf = Roku_Ads()
'm._raf.setDebugOutput(true)
'm._raf.setAdPrefs(false, 2)
'm._raf.setAdUrl(url)
'playAds()
end function
function playAds()
' sleep for half a second
sleep(500)
' setup some variables we'll be using
canvas = createObject("roImageCanvas")
' get the ads from the url
adPods = m._raf.getAds()
if adPods <> invalid and adPods.Count() > 0 then
' quick display for us to know how many ads we're playing
print "playing " adPods.Count() " ads"
' loop through each ad pod
for each adPod in adPods
' handle any top level logic here
' loop through each ad within the adPod now
for each ad in adPod.ads
' default ad rendering by raf: m._raf.showAds(adPods)
' start playing the ad
adVideoPlayer = playVideoContent(ad.streams)
playingAd = true
' custom event loop for the ad video player
while playingAd
videoMsg = wait(500, adVideoPlayer.getMessagePort())
if type(videoMsg) = "roVideoPlayerEvent" then
if videoMsg.isStreamStarted() then
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else if videoMsg.isPlaybackPosition() then
' loop through all trackers to see if we need to trigger any of them
for each tracker in ad.tracking
' make sure its not triggered first and that the tracker has a "time" property
if not tracker.triggered and tracker.time <> invalid then
print "* ad position: " videoMsg.getIndex() " / " adVideoPlayer.getPlaybackDuration()
if (int(videoMsg.getIndex()) + 1) >= int(tracker.time) then
print "triggering ad event " tracker.event ", triggered at position " tracker.time
m._raf.fireTrackingEvents(ad, {type: tracker.event})
tracker.triggered = true
end if
end if
end for
end if
if videoMsg.isStatusMessage() then
status = videoMsg.getMessage()
if status = "startup progress" then
' handle loading bar or anything else here
else if status = "start of play" then
' we should be playing the video, nuke the buffering layer and set layer 1 to a black background
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else
print "ad status: " status
end if
' roVideoPlayer sends "end of stream" last for all exit conditions
if status = "playback stopped" or status = "end of playlist" or status = "end of stream" then
print "done playing ads"
playingAd = false
end if ' end status check
end if ' end isStatusMessage
end if ' end type(videoMsg)
end while
if type(adVideoPlayer) = "roVideoPlayer" then
print "stop the ad video player"
adVideoPlayer.stop()
end if
end for
end for
else
print "no ads to play"
end if
end function
在当前版本的 RAF (1.9.6) 中没有办法这样做。
我正在使用 bright 脚本开发 RAF(Roku 广告框架)。
Nas在一定限度内是正确的。如果您正在观看广告,Roku 清单将希望启用 "Feedback UI"(这是 "Ad 1 of 1")
现在,可以创建自己的 roVideoPlayer 来播放广告。它需要做更多的工作...
'handle this else where (like the construct):
function main
'm._raf = Roku_Ads()
'm._raf.setDebugOutput(true)
'm._raf.setAdPrefs(false, 2)
'm._raf.setAdUrl(url)
'playAds()
end function
function playAds()
' sleep for half a second
sleep(500)
' setup some variables we'll be using
canvas = createObject("roImageCanvas")
' get the ads from the url
adPods = m._raf.getAds()
if adPods <> invalid and adPods.Count() > 0 then
' quick display for us to know how many ads we're playing
print "playing " adPods.Count() " ads"
' loop through each ad pod
for each adPod in adPods
' handle any top level logic here
' loop through each ad within the adPod now
for each ad in adPod.ads
' default ad rendering by raf: m._raf.showAds(adPods)
' start playing the ad
adVideoPlayer = playVideoContent(ad.streams)
playingAd = true
' custom event loop for the ad video player
while playingAd
videoMsg = wait(500, adVideoPlayer.getMessagePort())
if type(videoMsg) = "roVideoPlayerEvent" then
if videoMsg.isStreamStarted() then
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else if videoMsg.isPlaybackPosition() then
' loop through all trackers to see if we need to trigger any of them
for each tracker in ad.tracking
' make sure its not triggered first and that the tracker has a "time" property
if not tracker.triggered and tracker.time <> invalid then
print "* ad position: " videoMsg.getIndex() " / " adVideoPlayer.getPlaybackDuration()
if (int(videoMsg.getIndex()) + 1) >= int(tracker.time) then
print "triggering ad event " tracker.event ", triggered at position " tracker.time
m._raf.fireTrackingEvents(ad, {type: tracker.event})
tracker.triggered = true
end if
end if
end for
end if
if videoMsg.isStatusMessage() then
status = videoMsg.getMessage()
if status = "startup progress" then
' handle loading bar or anything else here
else if status = "start of play" then
' we should be playing the video, nuke the buffering layer and set layer 1 to a black background
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else
print "ad status: " status
end if
' roVideoPlayer sends "end of stream" last for all exit conditions
if status = "playback stopped" or status = "end of playlist" or status = "end of stream" then
print "done playing ads"
playingAd = false
end if ' end status check
end if ' end isStatusMessage
end if ' end type(videoMsg)
end while
if type(adVideoPlayer) = "roVideoPlayer" then
print "stop the ad video player"
adVideoPlayer.stop()
end if
end for
end for
else
print "no ads to play"
end if
end function
在当前版本的 RAF (1.9.6) 中没有办法这样做。