Brief Background: I have been programming for well over a decade in a variety of languages. I bought my first Roku on Black Friday 2012 and now have one for every TV. About 2 months ago, I taught myself how to write PlayOn scripts using Lua. This was extremely trivial and when I ran into any problems that I couldn't handle, I augmented things with Perl. I took a short vacation from work and decided to teach myself how to bypass PlayOn all together and write a Roku channel directly.
Problem: I haven't found a tutorial that works for me (I realize I am probably the problem). They all seem to be a brief introduction to static video files. I also didn't really find the examples in the SDK all that helpful though I am sure I will once I understand more. Ultimately, I am looking for something along the lines of: "Here is how you fetch a web page and store the source in a variable. Here is how you parse the HTML looking for links to videos (along with the meta data such as title, description, length, etc). Here is how you present that video to the user. Here is how you stream that video along with caveats if the video is flash not mp4"
Project:
One of the first projects I did for PlayOn was WeatherNation which is one I attempted to duplicate as a Roku Channel. Since I didn't have a firm grasp of Lua at the time, I had to augment with Perl so the links point to my server (which dynamically embeds a flash video from WeatherNation) and I use URL parameters to determine which video to play (Live, NorthEast, MidWest, etc). I am providing the PlayOn code below to demonstrate how simple it was.
--[[Settings
name = "Weather Nation PlayOn Plugin";
id = "WNPlugin";
description = "Brings http://weathernationtv.com to PlayOn";
version = 2.0.0;
EndSettings]]--
--[[Update
return nil;
EndUpdate]]--
--[[Director
function director:GetPlayerViewingRectangle(playerSize)
return Rectangle(0, 0, playerSize.Width, playerSize.Height - 30);
end;
EndDirector]]--
function wn_resolve(url)
_SPECIAL_resolve_xml = '<media><url type="flash">'..str_html_encode(url)..'</url><options><AudioAbortInterval>30</AudioAbortInterval><VideoAbortInterval>30</VideoAbortInterval></options></media>';
end
function main_menu()
_vr(
"Live",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_dfl9c83f')",
"Live weather from across the country",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Top Of The Hour",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_ke7byih4')",
"Weather from across the country updated at the top of the hour",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Half Past The Hour",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_z3ubehea')",
"Weather from across the country updated half past the hour",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Northeast",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_bc372mi8')",
"Weather from the northeast region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Mid Atlantic",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_vb6g4lm8')",
"Weather from the mid-atlantic region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Southeast",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_9uudtw6g')",
"Weather from the southeast region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Midwest",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_2vq1g74u')",
"Weather from the midwest region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Central Plains",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_lz21fuon')",
"Weather from the central plains region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Southern",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_nxtsjh2i')",
"Weather from the southern region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Northwest",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_x2kxrpgt')",
"Weather from the northwest region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
_vr(
"Southwest",
"code:wn_resolve('http://216.224.180.204:5150/weather.html?id=1_tj6qkfic')",
"Weather from the southwest region",
"https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/c135.55.691.691/s160x160/427692_10150720904089874_1019916183_n.jpg",
0
);
end
main_menu();
Questions:
1. Can anyone point me to a tutorial more along the lines of what I am looking for?
2. If no such tutorial exists, can someone show me how to do the same thing as the code above as a channel?
I realize number 2 is a lot to ask. All I can do in return is promise that once I come up to speed, I will be a fruitful contributor to the community.
Cheers,
Joshua