See my last post here
The example basically does what you want.
I have also now added a slight better example to the Audio/Video wiki