🌈 ESP32-S3 Rainbow: ZX Spectrum Emulator Board! Get it on Crowd Supply →
View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

(UPDATE - there’s a new sample project available here).

Flew back from the US on Monday carrying a shiny new iPad. One of my thoughts when I bought it was that it would make the perfect device for watching BBC iPlayer in bed - so you can imagine my dissappointment when I found that the iPlayer website kept asking me to install flash to play anything!

The weird thing is, iPlayer works on iPhones - you can even run iPhone apps that contain embedded UIWebViews, surf to the iPlayer web site and it all works!

Seems like it should be possible to get it working on the iPad. First step is to convince the bbc iPlayer website that the iPad is actually an iPhone so that it will give us the mobile website along with mp4 videos instead of flash.

Turns out that this is actually a bit tricky. Changing the User-Agent header field on the device is not exposed from any settings. So we need to create an iPad app with an embedded UIWebView. This will let us change the user agent to whatever we want.

It turns out that this is also a bit tricky. Fortunately there's a comprehensive post on how to do this here: "Changing the headers for UIWebKit HTTP requests".

If you follow the instructions in that link and set the user agent to "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3" you can point your UIWebView to the bbc iplayer web site and get the iPhone compatible website.

Next problem is actually getting the video to play. The iPlayer website uses the "embed" tag for it's videos - this does not seem to play nicely on the iPad. To play a video we need to replace the embed tag with a proper html5 video tag.

Here's some simple code to do this - not the most elegant coding, but it's a quick hack to get something up and running:

```objc -(void) webViewDidFinishLoad:(UIWebView *)webView { NSString *js=@"document.getElementsByTagName(\"embed\").length;"; NSString *embedCountStr=[webView stringByEvaluatingJavaScriptFromString:js]; if(embedCountStr && embedCountStr.length>0) { int embedCountStr=[res intValue]; if(embedCountStr>0) { NSString *videoUrl=[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(\"embed\")[0].getAttribute(\"href\");"]; NSLog(@"%@", videoUrl); [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.write(\"\");", self.view.bounds.size.width, self.view.bounds.size.height, videoUrl]]; } } } ```

This code will find the embed tag on the page, pull out the video url from the href attribute and then write a video tag to UIWebView.

All in all it works pretty well. I've got pretty much full screen video working, device rotation all works. All it needs is a bit of tidying up and error checking.

Hopefully the bbc will update their iPlayer web code to support the iPad - but since it's not scheduled for release in the UK for some time I'd imagine they aren't in any hurry.

Obviously all this is only possible if you have access to the iPhone SDK and can build an application.

Related Posts

BBC iPlayer - updated sample code - Hey there, just a quick update to let you know I've whipped up a new demo using the RSS feeds from the iPlayer site. It locates URLs and takes advantage of the webview to play the movies out, pretty neat huh? Just a reminder, you'll need the iPhone SDK and tool chain to get this project up and running, and remember, it's a rough around the edges, so use with caution. Be sure to check out the original blog post for more insight. Just a heads up, don't expect to see this app on the iTunes store anytime soon, the BBC might not be too thrilled about it...
Augmented reality on the iPhone with iOS4.0 - Hey guys! Just updated my earlier blog post on creating Augmented Reality (AR) on iPhones using the new iOS4.0 features. I’ve also moved away from the 'UIGetScreenImage' function as it’s no longer supported. Now, we access the camera using the AV Foundation framework with the help of AVCaptureSession. As always, you're free to download and fiddle with my code available in this blog. Happy Programming!
Shoot3D for the iPad/iPhone - I'm thrilled to have introduced my first 3D game on the app store. The entire process served as a real learning curve, with some elements still appearing obscure, yet adding to the intrigue. The games section of the app store is known for its fierce competition, but challenging the status quo by doing something different from the regular utility apps is quite a welcome change. I'm generally proud of how the game has turned out and look forward to its reception. You can download the game on the app store.
Tablet+iPhones = Console+Controllers - Here's the concept: your iPhones turn into wireless controllers and your tablet is now your console, all thanks to gamekit. It's a whole new way of gaming, reminiscent of the Wii, or using your devices for interactive card games. Interesting eh?
Sorry for the long silence... - Haven't been around for a while, folks! Been keeping busy with a startup and working on a server-side project for www.vollow.me. Time to dust off those old Java and database abilities! Soon, I'll be getting my hands on building the app to go with the website. Keep your eyes peeled for some insightful iPhone-related posts coming your way!

Related Videos

Streaming Video From an SD Card on the ESP32. - In this video, we successfully navigated the convoluted process of setting up movie file playback from an ESP32 with an SD card. There were a few bumps along the way, such as confusing USB data pins and the intricacies of various video container formats, but our quirky PCBWay board came through. Discussed an ingenious method of creating a simple custom video container format with ffmpeg that can be effortlessly parsed by the ESP32. And yes, even though the tiny TV guys use AVI files, we pushed boundaries and learned a thing or two about list chunks, sub formats, and hex dumps. The result? We achieved smooth audio playback and video frame skipping for an optimal balance. Check out the streaming version on WiFi for more fun!
ESP32-S3 ZX Spectrum - Full Color Silk Screen is really cool! - Super stoked to share this creation – an ESP32 ZX Spectrum emulator! Although it's still very much a proof-of-concept, it's looking pretty rad. I've got the classic games like Manic Miner, and yes, you can program in basic too! In perfect Sinclair fashion, I'm planning on selling this key piece of nostalgia for just £99. Work still needs to be done before the production phase, but rest assured, I'm meticulously working out the kinks, including tweaking the keyboard to ensure even better user experience. And on the technical side - a single ESP32S3 runs the show and we’ve multiplexed the keys exactly like the OG Spectrum. It's been great fun designing this piece of kit with the new full color silk screen printing from PCB way. Stay tuned for further updates!
Forget the Arduino Serial Plotter - try this instead! - Hey everyone! So, you're probably familiar with the Arduino serial plotter, right? It's useful for basic stuff, but I wanted something better, more cross-platform, and runs right in the browser. Enter the web serial plotter, using the web serial API! It's super flexible with zoom, export options, and light/dark mode. You can even pan through history or switch to absolute time. Plus, it's all secure and runs locally. It's open source, and I'd love your contributions or bug reports on GitHub. It's still a work in progress, but I think you'll find it pretty handy!
ESP-IDF 6 Setup in VS Code: Blink & Debug an ESP32-S3 - Time to get with the program and jump to ESP-IDF v6.0.1 in VS Code. I show you how to install the prerequisites (I’m on a Mac with Homebrew), run the ESP-IDF Installation Manager, spin up a Blink example for an ESP32-S3, tweak menuconfig (GPIO21, 500 ms), then build and flash—switching from stubborn USB JTAG to trusty UART when things fail. We check the monitor, bump CPU to 240 MHz, fix flash to 16 MB, peek at PSRAM, and give PCBWay a quick shout-out.
M5Stack CORE2 - Can't remember why I got this, but it looks nice! - Hey guys! So today, I'm testing out this really cool app. It's pretty interesting - I think it could be really handy if you're into tech stuff. Let's dive in and see what it can do!
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening


Published

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts