UPDATE 2: YouCube 3 (based on Google Chromium) available here!
UPDATE: Source code now available! See this post.
My YouCube demo is now interactive!
Based on code and ideas from Jeremiah Morrill’s excellent Win32Renderer – the main difference is [techie bit coming; skip if bored] this demo acts as an IAdviseSink for the IViewObject exposed by the HTMLDocument… The upshot of this is it only refreshes the page when something changes, rather than regularly updating with a timer.
To obtain the actual page snapshot, IViewObject.Draw is used. The image is copied to a WriteableBitmap and rendered as a Viewport2DVisual3D (both new in .NET 3.5).
For the interactivity, things become a little hairy… Like Jeremiah’s Win32Renderer, moving the mouse over the page also moves a hidden WebBrowser control, ensuring the relevant part of the page is under the mouse. This is nasty, but mostly grants us full browser functionality; you can hover, click links, type and select text. Dragging scrollbars doesn’t currently have the desired effect, but you can still click them or use the keyboard (if you’re willing to take a crack at fixing this, let me know)
You’ll find some pages behave better than others. For example Google Maps is pretty heavy on refreshes (you might get the browser pausing occasionally and the ‘hidden’ window appearing for a time) while Live Search Maps is actually pretty manageable (even dragging round Birds Eye View). YouTube and Next2Friends work surprisingly well (as they’re using Flash video, not all updates make it through IViewObject / IAdviseSink… the videos will stop after a while, unless you move the mouse).
The "loading" (progress) indicator has temporarily gone. Previously it was using the DownloadProgress event exposed by the System.Windows.Forms.WebBrowser. It’s now using the .NET 3.5 WebBrowser, but unfortunately that doesn’t seem to offer a progress event. I’ll post an update here if / when I look for an alternative
To take it for a spin (!) you can click the image above or right here for the ClickOnce application. If you’re still running pre-RTM 3.5 SP1 be sure to upgrade first. Also note it can potentially run very slowly on older machines..

9 responses so far ↓
Anthony Nystrom // September 16, 2008 at 1:04 am |
Hey Chris! Really really nice…
Very creative and skillful….
Sean McDirmid // September 17, 2008 at 1:49 am |
Hi Chris, this is an awesome hack! Is there any chance you can release the code? I found code for the non-interactive version, but I’d like to see how the interactive extensions were added.
Interactive YouCube Source Code « Chris Cavanagh’s Blog // September 17, 2008 at 6:32 am |
[...] Downloads ← YouCube 2.0 - Interactive! [...]
DaveP // September 17, 2008 at 2:50 pm |
I ounfd it will not let plugins run, so any flash or silverlight enabled sites either prompt to install the plugin or say the plugin is unavailable
Chris Cavanagh // September 17, 2008 at 3:06 pm |
DaveP – Interesting that happens… Plugins all seem to run fine for me (http://www.silverlight.net, YouTube etc work great). Which browser/version do you use? (I’m on IE8, but I’d expect IE7 to work ok… )
Jeremiah Morrill // September 17, 2008 at 6:44 pm |
The plugins not loading on my machine were because I run Vista x64. I changed the project to compile as x86 and all plugins work just fine, though videos like youtube do not play smoothly, but web browsing works extremely well and CPU efficient. I am very impressed! Great work!! I can’t wait to see what you do next!
Chris Cavanagh // September 17, 2008 at 7:26 pm |
Jeremiah – Which changes did you need to make? (was it the Win32 structures?). It’d be nice if we could get one version working on all architectures… Thanks for the feedback!
Jeremiah Morrill // September 18, 2008 at 5:08 am |
No changes to the code. Just right click and pick properties of the project and change “Any CPU” to x86 and it will work on all platforms fine.
The issue was the web browser was running as x64 on 64bit versions of Windows…and theres no 64bit version of most browser plugins.
Silverlight Cream for September 17, 2008 -2 -- #371 // September 25, 2008 at 12:05 am |
[...] YouCube 2.0 – Interactive! [...]