Permission to access webcam not asked by Silverlight 4 beta on load of page

I was playing around with the Silverlight 4 beta and was trying to get my webcam working by following this article. Although the code to achieve this is very simple, the webcam did not work in my *.aspx page which contains my Silverlight component. I googled and stackoverflowed around but didn’t find anyone with the same problem as I had. When the page loaded, I just saw an empty rectangle and Silverlight did not ask for permission to access my webcam like it should.

Picture 4

This is how the component looked in Firefox and this was the code, it’s the same as in the article:

Picture 5

Then I realized that all examples I saw on the web used a button before enabling the webcam. So I changed my component a little: added a ‘Turn on camera’ button and copied the code to start the camera to the click event of the button. If I now clicked the button, Silverlight asked for permission to use the webcam.

Picture 8

So the resulting code looked like:

Picture 7

And I was a happy coder, because I could now see myself in the webcam.

Picture 10

I documented this for everyone who might have the same problem. I don’t know if this is a known bug or not I didn’t find any documentation or ticket about it.


Visual Studio Redesign: lose the designers, add a command prompt?

There has been a clear shift in the way I use Visual Studio lately. Visual studio has a lot of built-in panels to help you develop the next killer application. There are a lot of panels I hardly ever use. Most of my time I spend, not quite surprising, in the text editor editing code. As for the other panels I may be using about 10% of all available options. Windows like the Server Explorer, Document Outline, Object Browser, I don’t think I ever opened them while developing. And I didn’t even mention the designers yet. I am a full-time web developer but I never open the HTML designer.

So I would like to propose a Visual Studio redesign, let’s just throw out all the designers and unnecessary windows (like when editing a css file lose the CSS properties, Manage Styles, CSS Outline windows) and go back to basics. Build a really good text editor. Once everything is stripped to the bare minimum add a panel which gives you direct access to the command prompt. I got this idea from a Ruby on Rails editor called RadRails. You can generate controllers, models, etc… from a panel within the IDE.

Why a command prompt? I have noticed that developing isn’t centralized in Visual Studio any longer. Next to Visual Studio I always have a command prompt open. By using tools like JavaScriptMVC and LESS, I now use the command prompt very frequently. By running small commands from the command prompt snippets of code are generated for you. And although code generation is considered evil by some, there is a big difference between Microsoft code generation and those tools. They generate code for you but give you the opportunity to change it without any effort. The Microsoft way of code generation, the part I can remember because I try to use it as less as possible, is saying: do not touch our generated piece of art, you are not worthy. And if you dare to change it, it will smack you in the face for doing so. With code generated by Microsoft I constantly have the feeling that I’m not in control.

So my proposal is, stop building a huge beast with gazillion panels which tackles it all. Create a light weight text editor, let’s call it Textmate for Windows, and give users the possibility to add the tools they want to use in addition to that text editor by accessing them through the command prompt directly in the IDE.

I’ve googled around for a solution but the only posts that came near were posts which let you launch a command prompt from within Visual Studio. Not really what I was looking for. Let’s hope the Visual Studio Team has implemented this option in Visual Studio 2010…