Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Experimental ebook channel

I just put up my new experimental channel "Electric Sheep", a channel for reading books on your television. Here's the announcement post in the general forum:

http://forums.roku.com/viewtopic.php?f=28&t=54807

I won't repeat everything there, but here are some development notes.

The main idea is to render PNG files on the server from a source EPUB file. I couldn't find a way to do that directly, so right now I'm first rendering to from EPUB to PDF, then rasterizing from PDF to PNG. After fiddling around with the caching algorithm it seems to work pretty well on my home setup.

I started with roImageCanvas, but that turned out to be too slow. Turning pages took a large fraction of a second, which made the channel feel very annoying. Even with caching the PNG files into the tmp:/ local filesystem it was slow.

Then I switched to roScreen and drawing bitmaps. That was actually slow at first. The trick to make that faster was to pregenerate the bitmaps before they were needed. My first implementation was fast, but stopped working after 15 pages. There's a limit of how many giant bitmaps you can have in memory... After releasing older bitmaps it's fast and keeps working after 15 pages (at least on my setup). I call it "FastFlick(tm)" page turning technology 🙂
0 Kudos
2 REPLIES 2
TheEndless
Channel Surfer

Re: Experimental ebook channel

"NathanWhitehead" wrote:
Then I switched to roScreen and drawing bitmaps. That was actually slow at first. The trick to make that faster was to pregenerate the bitmaps before they were needed. My first implementation was fast, but stopped working after 15 pages. There's a limit of how many giant bitmaps you can have in memory... After releasing older bitmaps it's fast and keeps working after 15 pages (at least on my setup). I call it "FastFlick(tm)" page turning technology 🙂

Make sure you re-use your fonts. Initializing a font is a very expensive operation, so if you're creating a new font for every page, that could explain the slowness. It certainly shouldn't be slow to draw text to the screen after you've initialized a font, so you shouldn't need to pre-generate the bitmaps.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Experimental ebook channel

Interesting, I'll try reusing fonts and see how that affects the speed.
0 Kudos