Skip to content

Commit

Permalink
able to set headers received from the api
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish Rawat committed Aug 23, 2020
1 parent 073ebb8 commit 9f867a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ sub loadmediaitems()
ContentNode_object = createObject("RoSGNode", "ContentNode")
if resultAsJson <> invalid
m.lstMediaSources.content = ContentNode_object
for each categoryKey in resultAsJson.items
for each mediaItem in resultAsJson.items
ContentNode_child_object = ContentNode_object.createChild("ContentNode")
ContentNode_child_object.title = categoryKey.title
ContentNode_child_object.url = categoryKey.streamUrl
ContentNode_child_object.ShortDescriptionLine1 = categoryKey.mimeType
if categoryKey.referer <> invalid
ContentNode_child_object.ShortDescriptionLine2 = categoryKey.referer
ContentNode_child_object.title = mediaItem.title
ContentNode_child_object.url = mediaItem.streamUrl
ContentNode_child_object.ShortDescriptionLine1 = mediaItem.mimeType

ContentNode_child_object.addFields({ hostname: mediaItem.hostName })

if mediaItem.headers <> invalid
ContentNode_child_object.addFields({ headers: mediaItem.headers })
end if
' ContentNode_child_object.ShortDescriptionLine2 = categoryKey.title
print categoryKey.title

end for
else
m.lstMediaSources.content = ContentNode_object
Expand All @@ -96,20 +98,19 @@ sub preloadmedia()
if previousvideocontenturl <> selectedmediaitem.url
videoContent = createObject("RoSGNode", "ContentNode")
videoContent.url = selectedmediaitem.url
m.mediaFileName.text = selectedmediaitem.title
' videoContent.streamformat = getMediaStreamFormat(selectedmediaitem.ShortDescriptionLine1) ''should be passed from top
' videoContent.HttpHeaders = getMediaStreamHeaders(selectedmediaitem.ShortDescriptionLine2)

'need to relook , try to pass collection from top or from api
m.mediaFileName.text = selectedmediaitem.hostname + " | " + selectedmediaitem.title
httpAgent = CreateObject("roHttpAgent")
httpAgent.AddHeader("Referer", selectedmediaitem.ShortDescriptionLine2)

if selectedmediaitem.headers <> invalid
for each entry in selectedmediaitem.headers
httpAgent.AddHeader(entry, selectedmediaitem.headers[entry])
end for
end if

if left(selectedmediaitem.url, 6) = "https:"
httpAgent.SetCertificatesFile("common:/certs/ca-bundle.crt")
' httpAgent.AddHeader("X-Roku-Reserved-Dev-Id", "")
end if
m.global.videoNode.setHttpAgent(httpAgent)

m.global.videoNode.content = videoContent
m.global.videoNode.control = "prebuffer"
end if
Expand Down
4 changes: 2 additions & 2 deletions manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title=Simple Roku Media Player
major_version=2
minor_version=0
build_version=2
minor_version=1
build_version=0
mm_icon_focus_hd=pkg:/images/new-new-logo-336x210.png
mm_icon_focus_sd=pkg:/images/new-new-logo-248x140.png
subtitle=A Simple Roku Media Player
Expand Down

0 comments on commit 9f867a6

Please sign in to comment.