EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2017
05:30 PM
Re: Live feed error
"Blackhawk" wrote:
Like this?
That's fine. I would have gone even simpler. Should build from simpler to more complicated, never start with the complicated first - since troubleshooting won't be a beach. And the simplest way to do it is 3 calls:
RAF = Roku_Ads()
adPods = RAF.getAds()
is_finished_ok = RAF.showAds(adPods)
That's it and... - like Alton Brown said - "walk away - just walk away!"
That's good enough and should work, should be able to see an ad play (it will be a sample clip).
What it does is (a) get RAF library instance, (b) ask for an ad and (c) show the ad.
The rest of Nielsen gallimaufry are just "improvements" on the basics for better targeting by advertisers - mind you if using that you actually need to know what to set in these (i can't be of help). But like most things - first learn to walk, then to run.
Blackhawk
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2017
06:58 PM
Re: Live feed error
I changed the feed code this
Theres another error
Type Mismatch. (runtime error &h18) in roku_ads_lib:/Roku_Ads.brs(3608)
3608: ??
Backtrace:
#3 Function roku_ads_configurecontentid(id_ As String) As Void
file/line: roku_ads_lib:/Roku_Ads.brs(3609)
#2 Function playcontentwithfullrafintegration(videocontent As Object) As Void
file/line: pkg:/source/LiveFeed.brs(46)
#1 Function createlivefeed() As Integer
file/line: pkg:/source/LiveFeed.brs(19)
#0 Function main() As Void
file/line: pkg:/source/main.brs(20)
Library "Roku_Ads.brs"
Function CreateLiveFeed() as integer
'AA for base video, ad and Nielsen configuration.
'For additional information please see official RAF documentation.
videoContent = {
streamFormat : "hls",
'Lengthy (17 min.) TED talk to allow time for testing ad pods
stream: {
url: "https://livestream.com/accounts/16944724/DetroitAutoShow.hls",
bitrate: 800,
quality: false
}
}
PlayContentWithFullRAFIntegration(videoContent)
End Function
'A full RAF integration Example:
' - Include RAF.
' - setAdURL to set the ad URL.
' - Examples of RAF MACROS being passed in the ad call.
' - getAds() for VAST parsing.
' - showAds for rendering.
' - Enable Nielsen.
' - Pass all parameters to Nielsen beacons with examples of genre, program id and content.
'@param videoContent [AA] object that has valid data for playing video with roVideoScreen.
Sub PlayContentWithFullRAFIntegration(videoContent as Object)
'Main facade creation.
canvas = CreateObject("roImageCanvas")
canvas.SetLayer(1, {color: "#000000"})
canvas.SetLayer(2, {text: "Loading..."})
canvas.Show()
RAF = Roku_Ads()'RAF initialize
print "Roku_Ads library version: " + RAF.getLibVersion()
RAF.setDebugOutput(true) 'for debug pupropse
'RAF content params
RAF.setContentId(videoContent.contentId)
RAF.SetContentGenre(videoContent.contentGenre)
'Indicates whether the default Roku backfill ad service URL
'should be used in case the client-configured URL fails (2 retries)
'to return any renderable ads.
RAF.setAdPrefs(true, 2)
adPods = RAF.getAds()
is_finished_ok = RAF.showAds(adPods)
curPos = 0
if playContent
videoScreen = PlayVideoContent(videoContent)
end if
closingContentScreen = false
contentDone = false
while playContent
videoMsg = wait(0, videoScreen.GetMessagePort())
if type(videoMsg) = "roVideoScreenEvent"
if videoMsg.isStreamStarted()
canvas.ClearLayer(2)
end if
if videoMsg.isPlaybackPosition()
'cache current playback position for resume after midroll ads
curPos = videoMsg.GetIndex()
end if
if not closingContentScreen 'don't check for any more ads while waiting for screen close
if videoMsg.isScreenClosed() 'roVideoScreen sends this message last for all exit conditions
playContent = false
else if videoMsg.isFullResult()
contentDone = true 'don't want to resume playback after postroll ads
end if
'check for midroll/postroll ad pods
adPods = RAF.getAds(videoMsg)
if adPods <> invalid and adPods.Count() > 0
'must completely close content screen before showing ads
'for some Roku platforms (e.g., RokuTV), calling Close() will not synchronously
'close the media player and may prevent a new media player from being created
'until the screen is fully closed (app has received the isScreenClosed() event)
videoScreen.Close()
closingContentScreen = true
end if
else if videoMsg.isScreenClosed()
closingContentScreen = false 'now safe to render ads
end if 'closingContentScreen
if not closingContentScreen and adPods <> invalid and adPods.Count() > 0
'now safe to render midroll/postroll ads
playContent = RAF.showAds(adPods)
playContent = playContent and not contentDone
if playContent
'resume video playback after midroll ads
videoContent.PlayStart = curPos
videoScreen = PlayVideoContent(videoContent)
end if
end if '!closingContentScreen
end if 'roVideoScreenEvent
end while
if type(videoScreen) = "roVideoScreen" then videoScreen.Close()
End Sub
'Creation and configuration of video screen.
'@param content [AA] object that has valid data for playing video with roVideoScreen
'@returns [roVideoScreen] video screen object
Function PlayVideoContent(content as Object) as Object
' roVideoScreen just closes if you try to resume or seek after ad playback,
' so just create a new instance of the screen...
videoScreen = CreateObject("roVideoScreen")
videoScreen.SetContent(content)
' need a reasonable notification period set if midroll/postroll ads are to be
' rendered at an appropriate time
videoScreen.SetPositionNotificationPeriod(1)
videoScreen.SetMessagePort(CreateObject("roMessagePort"))
videoScreen.Show()
return videoScreen
End Function
Theres another error
Type Mismatch. (runtime error &h18) in roku_ads_lib:/Roku_Ads.brs(3608)
3608: ??
Backtrace:
#3 Function roku_ads_configurecontentid(id_ As String) As Void
file/line: roku_ads_lib:/Roku_Ads.brs(3609)
#2 Function playcontentwithfullrafintegration(videocontent As Object) As Void
file/line: pkg:/source/LiveFeed.brs(46)
#1 Function createlivefeed() As Integer
file/line: pkg:/source/LiveFeed.brs(19)
#0 Function main() As Void
file/line: pkg:/source/main.brs(20)
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2017
03:04 PM
Re: Live feed error
Get rid of all the RAF.setXXX lines. You have no contentId and no contentGenre defined anywhere and the other calls are equally unnecessary.
-JT
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Blackhawk
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2017
07:30 PM
Re: Live feed error
I had modified the code to play more than one video (not at the same time)
Yet there's an error
Current Function:
027: adPods = RAF.getAds()
028: is_finished_ok = RAF.showAds(adPods)
029:
030: curPos = 0
031: videoScreen = PlayVideoContent(videoContent)
032:
033: closingContentScreen = false
034: contentDone = false
035:* while playContent
036: videoMsg = wait(0, videoScreen.GetMessagePort())
037: if type(videoMsg) = "roVideoScreenEvent"
038: if videoMsg.isStreamStarted()
039: canvas.ClearLayer(2)
Use of uninitialized variable. (runtime error &he9) in pkg:/source/Functions.brs
(35)
035: while playContent
Backtrace:
#2 Function playcontentwithfullrafintegration(videocontent As Object) As Void
file/line: pkg:/source/Functions.brs(35)
#1 Function createlivefeed() As Integer
file/line: pkg:/source/LiveFeed.brs(26)
#0 Function main() As Void
file/line: pkg:/source/main.brs(21)
Library "Roku_Ads.brs"
Function CreateLiveFeed() as integer
'AA for base video, ad and Nielsen configuration.
'For additional information please see official RAF documentation.
videoContent = {
streamFormat : "mp4",
'Lengthy (17 min.) TED talk to allow time for testing ad pods
stream: {
url: "https://archive.org/download/MuhammadAliVsSonnyListon/MuhammadAliVsSonnyListon_512kb.mp4",
bitrate: 800,
quality: false
}
streamFormat : "hls",
'Lengthy (17 min.) TED talk to allow time for testing ad pods
stream: {
url: "https://livestream.com/accounts/16944724/events/6910212/videos/147348826",
bitrate: 800,
quality: false
}
}
PlayContentWithFullRAFIntegration(videoContent)
End Function
Yet there's an error
Current Function:
027: adPods = RAF.getAds()
028: is_finished_ok = RAF.showAds(adPods)
029:
030: curPos = 0
031: videoScreen = PlayVideoContent(videoContent)
032:
033: closingContentScreen = false
034: contentDone = false
035:* while playContent
036: videoMsg = wait(0, videoScreen.GetMessagePort())
037: if type(videoMsg) = "roVideoScreenEvent"
038: if videoMsg.isStreamStarted()
039: canvas.ClearLayer(2)
Use of uninitialized variable. (runtime error &he9) in pkg:/source/Functions.brs
(35)
035: while playContent
Backtrace:
#2 Function playcontentwithfullrafintegration(videocontent As Object) As Void
file/line: pkg:/source/Functions.brs(35)
#1 Function createlivefeed() As Integer
file/line: pkg:/source/LiveFeed.brs(26)
#0 Function main() As Void
file/line: pkg:/source/main.brs(21)
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2017
01:32 AM
Re: Live feed error
The error is telling you that the variable 'playContent' is never initialized.
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
- « Previous
-
- 1
- 2
- Next »