RSS and data streaming

I need to make an app with corona that (A) downloads RSS feeds and interprets it, and (B) uses the url embedded in the RSS feed to stream a video.

So basically I need to make an RSS reader and a video streamer.

Anybody know how? Got any tips? [import]uid: 104852 topic_id: 18603 reply_id: 318603[/import]

Google is your friend:
http://developer.anscamobile.com/code/read-rss-feed-lua-table
http://developer.anscamobile.com/code/rss-parser
http://monkeybin.no/blog/archives/2011/04/26/creating-an-rss-and-json-driven-app-with-corona-sdk/

Those should get you started…
[import]uid: 19193 topic_id: 18603 reply_id: 71474[/import]

I ended up using php on a website to parse the rss data and output the required code to a url to embed in a webpopup. [import]uid: 10389 topic_id: 18603 reply_id: 71497[/import]

Hi

ScottPhillips, thanks for the links.
Now i’m trying to make this app from third link working (creating-an-rss-and-json-driven-app-with-corona-sdk) with Corona SDK version 377 (latest that supports Android ARMv6 Devices) and i can’t make it workt. It’s working good with newest versions of Corona, but with this old one, it’s not :frowning:

When i’m trying to run this app, terminal shows no error, only:

"Warning: display.setStatusBarMode() not supported in the simulator for current device"

And nothing happend, just blackscreen :slight_smile:

I know that Ansca doesn’t support ARMv6 anymore, but maybe someone will know why this code is not working and what should i do to fix it? [import]uid: 88574 topic_id: 18603 reply_id: 72166[/import]

Ignore this warning, it has absolutely no impact on your code in the simulator, but does work with the target device.

Can’t help with the ARM6 issue, as I’m not that old. ;7)

-David
[import]uid: 96411 topic_id: 18603 reply_id: 72172[/import]

Could do we some overview advice.

I need to create an app that the client can add content to via a CMS and this new content needs to be downloaded by the app so that it is available when the app is offline. The new content will essentially be blog post / article type content comprised of text and images.

I am thinking using some sort of RSS/XML feed would offer a good solution but wondered what is the general way of dealing with images.

Assuming the RSS feed included the image links/paths, do I need to do the following?

  1. Download the RSS feed
  2. Parse the RSS feed to get the image paths
  3. Download the image files
  4. Once all images have been displayed, display the new content

Or is this kind of thing normally done by downloading a zip file of all the images instead of parsing the individual file paths?

Any advice much appreciated. I have found lots of info about parsing text only data and displaying it in an app but can’t find anything that deals with downloading the associated images. [import]uid: 7863 topic_id: 18603 reply_id: 96945[/import]

My RSS project used to do just that. It was for podcasts, but its the same call for a video stream. However when I redid the project, I just put up enough to get the RSS parser working and demoed, and didn’t include all the bits that made my app, well my app.

Here is the code I used for my project (basically the onClick row handler). Its director based and I’m using popup’s. I’m not going to provide the graphics or anything else, but you should be able to go figure out what I did and adapt it to your own.

[code]

– Abstract: Tab Bar sample app, example content screen

– Version: 1.0

– Sample code is MIT licensed, see http://developer.anscamobile.com/code/license
– Copyright © 2010 ANSCA Inc. All Rights Reserved.

– This file is used to display the corresponding screen content when the user clicks the tab bar.

module(…, package.seeall)

local widget = require(“widget”)
widget.setTheme(“theme_ios”)

function new()
local localGroup = display.newGroup()
local enclosures = story.enclosuers

local story = _G.story
local bg = display.newImageRect(“images/background.png”,320,480)
bg:setReferencePoint(display.TopLeftReferencePoint)
bg.x = 0
bg.y = 64
localGroup:insert(bg)

titleText:setText(pageTitle)

local myButton
local onButtonEvent = function (event )
if event.phase == “release” or event.phase == “ended” then
native.cancelWebPopup()
director:closePopUp()
end
return true
end

local myButton = ui.newButton{default=“images/backbutton.png”, over=“images/backbutton_over.png”, onRelease=onButtonEvent}
myButton.x = 40
myButton.y = 42
localGroup:insert(myButton)

local closedGroup = display.newGroup()
local openGroup = display.newGroup()

local function onComplete(event)
return true
end
local function playPodcast(target)
print(“playPodcast”)
media.playVideo( story.enclosures[1].url, media.RemoteSource, true, onComplete )
return true
end

local headlineBox = native.newTextBox( 0, 108, display.contentWidth, 60 )
headlineBox.text = story.title
headlineBox.align = “left”
headlineBox.hasBackground = false
headlineBox.font = native.newFont( “Helvetica-Bold”, 18 )
headlineBox:setTextColor(0,0,0,255)
localGroup:insert(headlineBox)

local path = system.pathForFile( “story.html”, system.TemporaryDirectory )

– io.open opens a file at path. returns nil if no file found
local fh, errStr = io.open( path, “w” )

if fh then
storyBody = story.content_encoded:gsub("([%w%s%p]+)", “%1”)
– print(storyBody)
– print( “Created file” )
fh:write("\n[html]\n\n")
fh:write("\n")
fh:write("\n html { -webkit-text-size-adjust: none; font-family: Helvetica, san-serif; font-size: 1.1em; } “)
fh:write(”\n\n")
fh:write( storyBody)
fh:write( “\n\n[/html]\n” )
io.close( fh )
else
print( “Create file failed!” )
end

local function listener(event)
– print(“showWebPopup callback”)
if event.errorMessage == nil then
local url = event.url
if( string.find( url, “http:” ) ~= nil or string.find( url, “mailto:” ) ~= nil ) then
– print("url: "… url)
system.openURL(url)
end
else
print(event.errorMessage)
end

return true
end
native.setActivityIndicator( false )
local options = { hasBackground=false, baseUrl=system.TemporaryDirectory, urlRequest=listener }
–local options = { hasBackground=true, urlRequest=listener }
– native.showWebPopup( 0, 170, display.contentWidth, display.contentHeight - (170 + 60), “http://www.robmiracle.com”, options )
native.cancelWebPopup()
native.showWebPopup(0, 170, display.contentWidth, 230, “story.html”, options )
if #story.enclosures > 0 then
local play_button = display.newImageRect(“images/play_button.png”, 200, 48)
play_button.x = display.contentWidth / 2
play_button.y = 430
localGroup:insert(play_button)
play_button:addEventListener(“tap”, playPodcast)
end

local adX, adY = 0, 60
if _G.appID then
ads.show( “banner320x50”, { x=adX, y=adY, interval=15 } )
end

function localGroup:clean()
native.cancelWebPopup()
end

return localGroup
end
[/code] [import]uid: 19626 topic_id: 18603 reply_id: 96953[/import]