ogv.js MediaWiki integration updates

Over the last few weekends I’ve continued to poke at ogv.js, both the core library and the experimental MediaWiki integration. It’s getting pretty close to merge-ready!

Recent improvements to ogv.js player (gerrit changeset):

  • Audio no longer super-choppy in background tabs
  • ‘ended’ is no longer unreasonably delayed
  • various code cleanup
  • ogvjs-version.js with build timestamp available for use as a cache-buster helper

Fixes to the MediaWiki TimedMediaHandler desktop player integration (gerrit changeset):

  • Post-playback behavior is now the same as when using native playback
  • Various code cleanup

Fixes to the MediaWiki MobileFrontend mobile player integration (gerrit changeset):

  • Autoplay now working with native playback in Chrome and Firefox
  • Updated to work with current MobileFrontend (internal API changes)
  • Mobile media overlay now directly inherits from the MobileFrontend photo overlay class instead of duplicating it
  • Slow-CPU check is now applied on mobile player — this gets ogv.js video at 160p working on an old iPhone 4S running iOS 7! Fast A7-based iPhones/iPads still get 360p.

While we’re at it, Microsoft is opening up a public ‘suggestion box’ for Internet Explorer — folks might want to put in their votes for native Ogg Vorbis/Theora and WebM playback.

Flame on! Trying out Firefox OS at 2.1…

Ever since I heard about Mozilla’s ‘Boot2Gecko‘ project a few years back I was very excited about the eventual possibility of Firefox-powered phones running a truly free operating system, with apps provided through the open web  instead of platform-lock-in walled gardens.

It’s been a long journey though, and often a painful one. Early versions of Firefox OS were pretty rough, it was hard to get phones that weren’t severely underpowered, and actually upgrading to the latest versions on a release phone was….. often not really possible.

So I finally gave in and picked up the Flame, which is the officially recommended Firefox OS reference device. Current builds are actually, like, published for it!

I immediately flashed the device to the current base image (v180, with a low-level ‘Gonk’ layer based on Android 4.4’s low-level Linux layers) and updated to the almost-ready-for-release Firefox OS 2.1.

Version 2.1 finally does away with the old crappy browser app and treats web site browsing on the same level as installed ‘apps’. Graphics are pretty smooth, using hardware compositing, and in general it’s a HUGE improvement over 1.x.

The Flame

Hardware notes

    • The Flame is meant to be representative of the next generation of Firefox OS release phones which are targeting developing markets, so it’s not as fancy as the latest Android or iOS devices.
      • The screen is only 1.5x density, versus 3x on my Nexus 5. But it’s still a big improvement over the older 1x 320×480 devices.
      • Decent 1GB RAM — can be configured lower to simulate lower-end devices, which I have not attempted. Eek!
      • There’s a limited amount of internal storage, and a micro-SD card slot where you’re expected to store additional files such as media. I only had a 4GB card handy from an old phone so I’m using that for now, but will replace it with a 32GB card later.
    • the Flame has 2 SIM slots, both full-size. This meant I needed a micro-SIM-to-fullsize-SIM adapter to get my main phone line running on the Flame. The micro-SIM kept popping out of the adapter while trying to insert it, but I eventually got it in intact and it’s working fine. (T-Mobile US, HSDPA speeds. No LTE support on the Flame.) Conveniently the adapter kit also included the necessary adapter to move my backup/testing phone line from my iPhone 5s (nano-SIM) to the Nexus 5. Why can’t we all just use the same damn size SIM?

The camera seems kinda awful; video framerate is bad. Not sure if this is a software bug or a hardware limitation but it’s a bit of a bummer.

Back to the web: de-appifying

The most common apps I use on my Nexus 5 are:

    • Gmail
    • Google Maps
    • Facebook
    • Twitter
    • Feedly
    • Kindle
    • Amazon Music

Wikipedia

These are all available on the web, but with some caveats and limitations:

  • Gmail shows in a really crappy old-school mobile web interface instead of the nice modern HTML5 one you get on an Android or iOS device. I can’t seem to use it for multiple accounts either, which makes it a non-starter since I have both personal (gmail) and work (gapps) accounts. I’ve been using the Firefox OS built-in Email app instead for now, which seems to work better than in old versions but isn’t really optimized for my ‘archive everything’ workflow.
  • Google Maps shows the web interface, which is kinda ugly but seems to work including geolocation and transit directions. YAYYY
  • Facebook web seems pretty decent at least for reading, but I don’t get notifications of replies and have to check manually.
  • Twitter web seems pretty good, though the pull-to-refresh is a little flaky and again no notifications.
  • Feedly’s web interface is designed for desktop screens and doesn’t scale down property to a smartphone screen. BOOO
  • Kindle Cloud Reader actually runs — it downloads and views books and everything. But again, it’s designed for desktop and tablet screens and the UI doesn’t scale down. You can only see the top-left corner of the page and can’t actually read anything. BOOOOO
  • Amazon Cloud Player for online-stored music….. amazingly this works, but the interface is desktop-oriented and distinctly NOT mobile friendly. (It also prompts for Adobe Flash, but doesn’t seem to require it for playback.) However since playback stops when you switch away from the app, it’s kind of a bummer to use. BOOOO
  • We have a Firefox OS Wikipedia reader app based on our old PhoneGap app — it works fine, but hasn’t been maintained much and needs an overhaul. Meanwhile our mobile web site also works pretty well on Firefox os, and now supports editing and all kinds of cute stuff. YAYYYY

Now, some things I can’t get at all:

  • Uber
  • Skype
  • Walgreens

:(

  • There’s really nothing in Uber that needs to be an app as a customer — they could just as easily have a web app with all the capabilities of looking up, calling a car, watching the map, etc. I can’t even successfully log in to their web interface for viewing my past rides, but if I could there’s no way to call a cab there.
  • I occasionally use Skype, mainly when XBox Live’s chat system breaks. *cough* Microsoft owns them both *cough*. That’s all native apps and has no web option.
  • The Walgreens app on iOS/Android lets you scan the barcode on your medication to schedule a refill, it’s pretty handy! Their web site has no equivalent that I can find… but I can work around it by renewing via email notification instead.

So I’ll be carrying the Flame around as my main phone line for at least a bit, but I’m gonna keep the Nexus 5 around for a few things.

We’ll see how long it takes before I switch the main line back to Android or if I stick with it. 😀

A British driving adventure in five parts (or, Google Maps Can Suck It)

So I’m doing a little post-Wikimania traveling with my wife and my parents. Yesterday we drove from London to Cardiff via Stonehenge. It was… Quite the experience for a first-time driving in the UK.

Part one: Escaping London

IMG_0146.JPG Our adventure begins in the London Docklands, where the 72nd World Science Fiction Convention was held at the Excel Centre (loncon3.org). I was able to hire a car at the Europcar branch in the convention center, made it over to our hotel, and we just managed to squeeze our luggage into the back of this Skoda something or other.

Google Maps wanted to route us through the London city center to get out to the M4 motorway, but everyone I asked assured me this was a terrible idea and I should get to the M25 “orbital” highway that circles the city. A13 runs east from the docklands to the M25 and was pretty easy to get to; after some initial confusion getting used to driving on the left and being on the right side of the car I more or less adjusted, and we stopped for a quick lunch at a rest stop (“services centre”) off M25.

Part two: reaching Stonehenge

From there the route to Stonehenge was very simple: go south and west on the M25 orbital until the M3 branches off, then take A303 out to Amesbury and follow the signs to Stonehenge. This route was great; mostly big modern highways, well labeled, in the middle of the day. My main difficulty was adjusting to properly centering the car in the lane when I’m sitting on the “wrong” side of the car.

image

Part three: English country back road hell

When I planned out the route I didn’t do enough research on how to get back to the main motorway; it looked clear enough on Google Maps and I just turned on navigation on my phone and followed the directions a while.

The phone losing gps signal at first was a bad sign, but in retrospect the route was bad to begin with. We ended up taking A360 sorta northwestward toward the M4 which leads straight to Cardiff. As it turns out, while A303 was mostly a pretty comfortable minor highway, A360 is actually a series of tiny country and village back roads.

Often it narrows to one lane, has no shoulder, squirrels around and makes weird turns, etc. this was a somewhat harrowing experience, especially as signage was nearly nonexistent and I had a poor idea of how far I was from the main highway.

Part four: finding M4

Eventually we reached the entrance to M4… And I missed the exit from the roundabout and ended up on the wrong road. Google Maps rerouted us… Down another country road which eventually took us back to M4, much much later than I had hoped to be on the main road.

Once on M4 we were back in a world of wide lanes, divided highways, good signage, etc. Life was good again. We kept going west, crossing the Severn bridge to Wales. Interestingly this is a toll bridge westbound, but the toll collection is a good few miles past the bridge instead of before it like San Francisco’s bridges.

Part five: diversion hell

Then, as we got to about 20 miles from Cardiff, the damn motorway closed down for “works” — possibly related to the upcoming NATO summit and security measures being put in place around town.

I tried to follow the diversion signs but ended up taking the wrong exit from the roundabout and got stuck going north on A449. Unlike our old friend A360 this was a very nice modern highway, but there’s no place to turn around for 10 miles… So it takes a while to get back and try again.

Following the diversion signs we ended up back on M4 but eastbound, back towards London. Argh! We stopped at the next services centre for another break and to regroup.

Google Maps just kept routing us to the closed section of M4 so was of limited help. I called the hotel in Cardiff to ask for a recommended alternate route, but they knew nothing about the closure. I called Europcar but they couldn’t give me anything useful either. Finally, a nice lady at the Costa coffee place overheard our dilemma and offered a route through Newport which would take us around the closure and pick up M4 again. Thanks Becky!

Unfortunately I made a wrong turn and picked up M4 too early, right back at the closure and diversion… And ended up going north on A449 again. We stopped at the first exit to recheck the maps and determined that if we headed back south to the barista’s recommended route and kept going through Newport correctly it would work… But we had to go the 10 miles to the turnaround first, which was very frustrating. Back on the alternate route, another A highway, we entered ROUNDABOUT HELL.

I’m still having nightmares of the Google Maps voice calling out “in 800 feet, at the roundabout, take the second exit to go straight ahead”. Every … fricking … intersection. The alternate route eventually turned out we think to be the recommended diversion route — there were yellow signs with a black circle and a narrow pointing which way to go which lined up with our route and we stuck with that until we returned to the blessed, blessed M4. Finally, we got into Cardiff and Google Maps was relatively sane again leading us to the hotel. We arrived before midnight, but not by much.

Afterword

Lesson learned: When using your satnav in Britain, research your route first. You can’t tell whether an A road will be comfortable or horrible unless you check it on Wikipedia or something. Gah!

A well deserved post-drive treat.
A well deserved post-drive treat.

Testing ogv.js in MediaWiki

After many weekends of development on the ogv.js JavaScript Ogg Vorbis/Theora player I’ve started work on embedding it as a player into MediaWiki’s TimedMediaHandler extension.

The JavaScript version is functional in Safari and IE 10/11, though there’s some work yet to be done… See a live wiki at ogvjs-testing.wmflabs.org or the in-progress patch set.

Screen Shot 2014-07-13 at 8.43.34 PM

 

Meanwhile, stay tuned during the week for some demos of the soon-to-be-majorly-updated Wikipedia iOS app!

OgvKit: native Ogg Vorbis/Theora playing on iOS

In addition to my in-browser ogv.js media player, I’ve got an OgvKit framework in progress for native iPhone and iPad apps, which I hope to integrate into Wikipedia’s new iOS app somewhere down the line. I took a little Independence Day holiday time and made a bunch of improvements from where I last left it a few months ago:

(If the video is sideways, sorry — it’s still “processing” as of this writing.)

  • Color conversion is OpenGL ES-accelerated, cutting CPU usage in half when playing video.
  • Audio output actually works, more or less in sync.
  • Framework now packaged as a Cocoa Touch Static Library project

Shiny new A7-based 64-bit devices play 480p and even 720p happily (iPhone 5S, iPad Air) but still struggle with some 1080p originals. My oldest devices like an iPhone 3Gs and iPod Touch 4th-gen can’t go higher than 160p or so at present — still significantly faster than the JavaScript ogv.js version which can’t handle video on those devices at all.

Future work for another weekend:

  • It turns out the xiph.org git mirrors of theora etc are not being maintained; will switch fetching of library source to SVN.
  • Improved controls, seeking, fullscreen
  • Cache downloaded data on disk instead of RAM!
  • Move more of the player code from the demo into the library so it can be reused…
  • Test standalone packaging of the library so it can be dropped in to other projects easily
  • Try to get assembly in libtheora to build, and/or replace the ARM assembly code with C SIMD intrinsics
  • Find and test on an armv7s device (iPhone 5, 5C or iPad 4th-generation)

LG G Watch first look

At the Google I/O conference this week they handed out Android Wear watches to attendees; I got the LG G Watch and have been gleefully wearing it for about a day.

The good:

  • There’s no annoying branding on the watch face, and no side buttons to get caught on things.
  • Actual pairing is pretty straightforward using the Android Wear app (once you get it installed…)
  • Showing notifications from my paired Android phone “just works”: texts, Facebook replies, “time for next meeting” pings, etc. It’s also easy to configure it to disable buzzing/pinging on the phone when the watch is active.
  • If you are brave enough to turn on Gmail notifications, you can easily archive a mail from your watch and never have to read it! Or you can swipe away the notification and read it later, if it’s like IMPORTANT or something.
  • Gestures for control are relatively simple.
  • The usual suspects in voice recognition like setting reminders and alarms work, as with Google Now or Glass.
  • If a voice command doesn’t match anything, it does a Google search. Some specific kinds of queries will give results from their knowledge graph, but you can easily end up with generic search results … which inevitably include Wikipedia. 😀 If you want to actually read a page, it doesn’t try to force it onto the tiny watch screen — it opens up the browser on your phone.
  • The always-on dim display mode looks pretty good indoors or in the shade.

The bad:

  • The screen is nearly illegible in direct sunlight, even pumped up to the max brightness.
  • The G Watch does feel a bit clunky — it’s just kinda big for a watch. But really, it doesn’t feel any worse than my Casio calculator watch did when I was 12. 😉
  • Had to read the directions to see how to turn it on (attach it to the charging cradle and it turns on automatically).
  • Setup currently requires opting in to some prerelease versions of a few Android packages. This presumably will be improved shortly!
  • Voice recognition is a bit spotty. I do wonder what the NSA thinks of my reminder to “resell my medications” (that was “refill”, silly Google!)
  • I wish there were more options for Gmail notifications, namely “mute” and “report spam”.

The ugly:

  • The 280×280 screen resolution looks rather blocky compared to today’s high-end circa-5″ 1080p phones. This is probably a tradeoff for battery life — the watch is already thicker than I’d like, and I wouldn’t want them to have to make the battery huger to last through a day!
  • I had some trouble with the device losing connectivity a couple of times; resetting BlueTooth off and on on the phone seemed to resolve it.

Still have to try:

  • Phone answering — I don’t make or receive a lot of voice calls so haven’t actually tried this yet. Not even sure if it just tells me to grab my phone or if it does some magic watch-speakerphone thing. Who knows? Time will tell.
  • App development — there seem to be two ways to go; either enhanced notifications, or native apps that run on the watch (like the little compass app or the pedometer). Haven’t tried yet, but downloaded the SDK…

iPhone size speculation

So there’s wide speculation out there that a larger-screened iPhone is coming to compete with the circa-5-inch generation of flagship Android phones.

But how would Apple actually engineer such a thing, and what would it mean for web and app developers?

There are a few possibilities to my mind, with various trade offs.

First, note that the iPhone 5 family has a 4″ 640×1136 screen, about 326dpi and using a 2x scale between UI points (aka “CSS pixels”). Software for iPhone had long assumed a 320×480 1x or 640×960 2x display, and when the new screen size was introduced, old apps were accommodated by showing them with black bars to simulate the older screen size.

The simplest solution would be to scale up the iPhone 5c/s design and screen by the same ratio as the iPad mini and iPad Air — this gives a 4.8 inch “iPhone 6″ that would have the same pixel density as the full-size Retina iPad. Developers would see the 4″ and 4.8″ devices as equivalent, with no changes needed to code or graphics. But, it might not provide the feeling of additional screen space because on screen elements would become larger to fit. The resolution, while still a respectable 263dpi or so would also fall noticeably short of the current crop of 1080p Android phones at 440+dpi.

Another possibility is to stick to the 326dpi density and change the screen’s pixel dimensions, say to 1280×720 at 4.5″ or maybe a little higher. This would give more onscreen space, requiring app developers to ensure they handle the different dimensions. Older apps without AutoLayout might be handled by a black screen border like iPhone apps running on an iPad, or they might scale up and be a little blurry.

Some might scoff at such a change, but iOS SDK updates have made it easier to handle varying screen sizes, from iOS 6’s introduction of AutoLayout to iOS 8’s storyboard unification and mysterious “variable sized iPhone simulator”… The idea that Apple might spring a new form factor at us in fall 2014 is not any crazier than when they sprung the 4″ iPhone 5 on us…

Still another question is whether Apple will follow the dpi race that they started with the iPhone 4’s “retina” screen… Would they make a 1080p phone in the 4.5-5″ range using a 3x display scale to match Android? There’s nothing in the iOS SDK that hints that way to me, but it’s plausible technically.

A 3x density scale might handle back-compatibility by rendering to a 2x frame buffer and transparently scaling up at some cost of blurriness, while newer apps use @3x artwork and render natively at proper scale.

This remains to be seen…

Safely embedded JavaScript modules for MediaWiki?

At the Zürich Hackathon I’ve been poking a number of things — more notes to come later — but one fun one is that I’ve continued work on one of my older experiments, getting a demo running on Wikimedia Labs and starting to enhance it for MediaWiki’s relatively new ContentHandler system to create custom structured ‘pages’.

Screen Shot 2014-05-11 at 1.20.04 PM

(TL;DR if you don’t want to click through to the docs on the extension: an isolated iframe is used to sandbox script code from the wiki’s own web environment.)

Currently the ‘JSApplet’ namespace content handler just takes straight JavaScript source, but I’m planning to make it a structured bundle which contains:

  • an HTML scaffold
  • a CSS chunk
  • a JavaScript chunk
  • references to other scripts to include
  • references to SVG or raster image files to include
  • print or non-JS fallback content

Then, a custom view/edit handler for the content type can provide an interface to edit those bits and run an immediate preview — kind of like an embedded JSFiddle.

ContentHandler also allows for a custom transclusion mode — so scripts could perhaps be invoked like ‘{{JSApplet:Mandelbrot}}” instead of having to use an XML-like tag extension manually. Not sure if that’s the best plan, but it’s a thought. 😀

I’m also thinking about how to make this work on mobile — in theory these things should be able to work with iframes in embedded web views, but it may require adding special support in the client.

For times when the script can’t be executed, some sort of static fallback content should be shown — still thinking about best ways to support that cleanly and make it something that people will do by default. Hmm, ideas ideas. :)