'' **
'' MainScreen.brs
'' **
function getPlaylistsContent()
? "loading playlists"
m.playlistsContentRequest = createObject("roSGNode", "playlistsContentRequest")
m.playlistsContentRequest.uri = m.top.playlistsContentUri
m.playlistsContentRequest.observeField("content", "showPlaylists")
m.playlistsContentRequest.control = "RUN"
end function
sub showPlaylists()
? "showing playlists"
m.playlists = m.playlistsContentRequest.content
end sub
function playlistItemSelected()
print "this is how the playlist is passed to the video screen"
m.videoScreen.playlist = m.playlists.getChild(m.rowItemSelected[0])
end function
'' **
'' PlaylistContentRequest.brs
'' **
sub getContent()
util = Utils()
content = createObject("RoSGNode", "ContentNode")
request = ParseJson(util.getStringFromURL(m.top.uri))
response = request.response
for each playlist in response.data.playlists
playlistItem = content.createChild("ContentNode")
playlistItem.title = playlist.name
for each item in playlist.items
videoData = item.video
video = playlistItem.CreateChild("VideoItemData")
video.title = videoData.title
video.hdPosterURL = videoData.thumbnailList[1].url
video.sdPosterURL = videoData.thumbnailList[2].url
end for
end for
m.top.content = content
end sub
'' **
'' VideoScreen.brs
'' **
function playlistChanged()
print "Playlist loaded to video screen"
data = CreateObject("roSGNode", "ContentNode")
''This is where I want to clone or shallow copy m.top.playlist
data.appendChild(m.top.playlist)
m.playlistRow.content = data
end function
I was recently looking for similar functionality and found it couldn't be done in 7.0. My understanding is that there will be some new reflection methods in 7.1 that will make it possible to clone nodes like this, but for now you may need to either hard-code the fields, or, if it's a custom content node, parse the component XML with roXMLElement to get the fields via the <interface> node.
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
Thanks for your patience — we’re excited to share what’s next!