Sunday, May 1, 2011

Airplay through Media Center

So I felt like doing some media center programming this morning. I thought about how cool it would be to get AirPlay working with media center. Unfortunately, my solution is not native to MCE but it seems to work ok. I read this TUAW article about AirMediaPlayer, which opened to the door. AirMediaPlayer was discontinued by the author without releasing the source code, which SUCKS. So I wrote an AutoIt script to bridge the gaps between MCE and AirMediaPlayer. Here's a video of it in action:



How it works:

The first time you run the Airplay app from media center, it launches AirMediaPlayer and also launches a daemon to wait for the airplay connection, then returns you to media center. Now all you have to do is start playing a video on your iDevice, and click the airplay icon to select the computer name of your MCE machine. Once AirMediaPlayer receives the connection, MCE's "Now Playing" title is stopped, then MCE is minimized, and AirMediaPlayer is maximized to full screen mode. When you stop the video from the iDevice, AirMediaPlayer is minimized and you are returned to MCE. It's pretty seamless, although not native.

Setup: AirPlay.zip

1. So first download the zip file an extract the contents to "C:\Airplay\"

2. Run AirMediaPlayer. If you get an error, it's probably because you need to install Bonjour and Quicktime. If you can't get AirMediaPlayer to get airplay videos from your iphone, there is no point in going to Step 3 until you get that working. Once you can airplay videos, move on to step 3.

3. Run the install.cmd This will put the airplay app into media center. I only tested on windows 7 x64, so others will have to find a workaround. you can find the icon in the "Extras menu" or get Advent Media center studio to put it wherever you want it.

4. Launch the addin from media center, and you should see the screen flicker as AirMediaPlayer starts and MCE restores back.

5. Now launch a vid from your iphone, hit the airplay icon and send to MCE. MCE should notice and start the stream.

Other stuff:

There's a config.ini that you can edit that will enable logging or set the timeout of the daemon. The default timeout is 900 seconds (5 minutes). So if you dont send an airplay stream to MCE within that time period, AirMediaPlayer will close and you will have to click the MCE airplay icon again to start it.

Launcher.exe does all the real work. The source code is at launcher.au3 ( an autoit script ) feel free to recompile it if needed. If someone get this going on 32bit let me know and I'll add your changes.

So, that was my sunday... I would love to see Airplay audio, and a native Airplay video solution in the future. I just won't be the dev to do it, I dont have that kind of time anymore.

Saturday, May 1, 2010

GeoVision iphone webbrowser alternative

I got a geo vision card to replace the standalone dvr for my security cameras. GV makes a decent application, but best of all, it's easy to hack your own stuff. I was not really happy with the GV-IView iphone app. It takes like a half hour to load and view a camera feed. And it's the same situation on the firefox jpeg viewer. So here's my workaround.


Go to your gv directory and find the web temp directory, mine was C:\GV-600\WebTemp\
Then rename your ChangePwd.htm to ChangePwd.BAK (for backup) then download my version, replacing the original. Download here.

So now when you browse to your GV web version http://:/ChangePwd.htm you get a nice iphone and firefox compatible version. The only downside is that you can't change your password from the web anymore, you would have to be at the DVR to change password. I had to do it this way, because GV would not let me serve a new html file, so I had to edit an existing webpage.

Once you log in, all of your settings are saved in a cookie, so that means a quick auto login. I'm not going to get into all the details of this mod, but it does lot's of stuff, and looks great on an iPad / iPhone too because you can pinch and spread to zoom in on your feeds. Also, if you add the webpage to the iphone homescreen, it makes a nice icon.

IPhone Screenshots:






IPad Screenshots:



Saturday, February 13, 2010

Upgrading MCE2005 to Windows 7

So I made the plunge on all my boxes to Win7 from MCE2005. A lot of things have improved in Win7 but it took me forever to get everything setup right. Especially since I was attempting to upgrade old MCE2005 hardware to Win7. My box was a 2005 HP Pavilion Slimline, 1 gb ram (max), on board video card, no more expansion slots. So hardware upgrading wasn't possible. After reinstalling Win7 four times and trying specialized codec packs, which all sucked, my biggest problem was my networked xvid videos were choppy. I tried hundreds of fixes, from codecs to drivers.

The codecs that worked best for me, was CoreAVC and the XviD codec. This got the choppyness to a minimal amount, and enabled mkv formats but it still wasn't perfect. It turns out I was sharing content via an administrative share //server/d$/content for example. This was the source of my problem all along so I am documenting it for any other losers out there. Windows 7 does not stream video smoothly via an admin share! Just share the folder normally and it's all gravy FFS.

Here's some other tweaks I made. First off install mediabrowser http://www.mediabrowser.tv/ because it's awesome, a bit slow but worth it. Also you want to modify the home strip to say something more blatent than mediabrowser, so tweak it via the registry like so:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Start Menu\Applications\{ce32c570-4bec-4aeb-ad1d-cf47b91de0b2}]
"OnStartMenu"="True"
"Title"="Movies or whatever"

And you can remove the other items from the Start menu like Extra's by running this app: http://mikinho.com/wmc/start-menu-plus/

Also, I tweaked Win7 for HTPC use only by right click, my computer, properties, Performance Information and tools (lower left) Adjust visual effects (best performance), indexing options (modify then remove all).

Lastly since my MCE is an old piece of shit box, I stuck in an old 2gb flash drive then set it up for ready boost, which is kinda like a ghetto ram expansion. But believe it or not, it did run faster with it.

After all that was done, I transformed an old POS MCE 2005 box to a usable Win7 MCE box.

Here's some other shit I changed but I don't know if it helped or not... Only try if you're desperate:
I installed the Preferred Filter Tweaker http://www.codecguide.com/windows7_preferred_filter_tweaker.htm
which basically lets you tell windows 7 mce which codec to decode with. And totally unrelated I upgraded DirectX. Both things probably weren't neccessary but I'm throwing it out there anyway.

Saturday, January 23, 2010

Grip Growl Notifications in Media Center

There was no Growl display addon for media center. So I decided to get my hands a lil dirty and create one. I found some a source code from MCE 2005 that seemed to do exactly what I wanted. The only problem is that the source code didn't work for MCE 2005 rollup 2, and the link to the fix was long gone. So after some scouring, I found/posted the fix, recompiled the application DLL's, and began testing. It works great on my MCE 2005 boxes, and I even got it working in Windows 7 MCE, didn't test in Vista because vista sucks.

Why did I write this? Because I am an idiot who has a million other paid projects I should be writing but MCE keeps pulling me back in. And also, Notify Pro was released in Cydia which allows your iPhone to push growl notifications from your phone to a growl client, this works with that so new SMS/Incoming Calls alerts etc, work with media center. The alerts vanish after 7 seconds, no remote control needed.



Download the installation files with source code here *fixed carriage return bug

To install the media center addon, exit media center, then copy all files from the MCE-Install directory into C:\Windows\ehome\ then double click the install.bat file. To uninstall run, uninstall.bat file. After this is done, MCE is ready to receive notifications. To send Growl notifications to the media center install growl http://www.growlforwindows.com and then install the scripty display: http://www.growlforwindows.com/displays/scripty

Now you need to configure scripty to launch our custom executable, so go to displays, set scripty as default, then hit browse and navigate to the MessageSender folder, and select the MessageSender.exe If scripty doesn't let you select the MessageSender.exe file then type *.* in the file name box and it should then allow it.

Now start a non maximized media center, and click preview and you should see this:














Now I guess you can install all kinds of growl apps and get your notifications in MCE.

Saturday, December 19, 2009

Security Cameras Media Center and iPhone Notifications

I brought some lorex security cameras from costco only to find out that there is no API for developers, so if you don't like the stock functionality you are out of luck. I wanted to be able to see the live camera feed from my MCE 2005 boxes and I wanted to see the live feed from my iPhone.

Here's how I made it happen.

Requirements:

4 camera lorex camera with video out, although I suppose any webcam will do.

A server with a tuner card (hauppauge PVR 150 in my case but anyone should work) The tuner card has to be dedicated for this purpose, so no live TV recording in MCE. If you are doing a USB webcam the tuner is not necessary.

YAWCam

Setup:

Plug the video out from the lorex monitor into the tuner card. I needed to purchase a BNC to Composite adapter from radio shack to make this happen.

Download and install YawCam

You should be able to have YawCam detect your tuner card as a webcam, once that's done, enable the streaming option. Now if you goto the stream's address on the web you should see a javascript feed of screen captures. This looks pretty close to live video, although it is simply static jpgs being feed at 30 frames per second.

Now here's the problem... the TV out from lorex displays all 4 cameras on one image which kinda sucks. I wanted to be able to zoom in on one camera at a time via the media center 10 foot experience. So I edited the streams html file to accept input from the Media Center remote. So if I click number 1 on the remote, it zooms and clips the image to the dimensions of the first camera. If I hit left, right, up or down it switches from camera 1 to 2 to 3 to 4.

I also edited the HTML file to be more iPhone compatible. I added a homescreen icon and made some other mods.

Here's the edited HTML file: http://www.box.net/shared/i1rjd8p8fe (replace this into C:\Program Files\Yawcam\stream\ )

So far so good... now to add this webpage to MCE I double clicked on the MCL file on my MCE 2005 box. Now If you go to more programs in Media Center you get a My Cameras option. But of course I had to take it a step further. I wanted to add My Cameras to the MCE start menu, so I am imcluding a reg file to enable that as well.

Remember to edit the reg file and the MCL file to match the IP address of your server. Open in notepad and do a find (192.168.1.101:8080) and replace (yourip:port). Double click reg to install to Start Menu, Double click mcl file to install to more programs.

Download: http://www.box.net/shared/98pabdm58a

















Now the icing on the cake. I thought wouldn't it be cool if I received notifications on my iPhone when a motion event occurred? I know it's a little overboard but that's how I roll. Yawcam offers a motion detection option. When motion is detected it can send an email (boring) or run an executable (w00t!). So I setup the motion detector to capture screenshots of the events and then run an VB Script.

The VB script first performs a system beep, since my server is headless and speakerless, I hear this beep before people can even ring the doorbell. Next the script pings my iPhone's IP address to see if I'm home and on the wifi. If the iphone reply's to ping it does nothing. If it doesn't reply to ping it sends a notification to my iphone that motion was captured. The notification is sent using the excellent Prowl app and API (on appstore). If my iPhone reply's to ping but it is between the hours of 11pm and 7am (when I'm in bed) it sends the notification. So if I'm watching a creepy show like dexter and it's late night, I get a motion detected notification on my phone, I click "My Cameras" in MCE and I have a live feed of my cameras. Best of all dexter continues to play uninterrupted while I view the feed. Pretty bad ass.

Download: http://www.box.net/shared/27hgh24an8

Remember to edit the variables in the vbs file to match your iphone IP address and prowl's API Key

More Screens:

































Known issues: yawCam doesn't work with a 64bit OS... sucks. I am running windows 7 32bit just to use yawcam. Also if the system beep.exe doesn't work, take ownership of C:\windows\system32\beep.sys and replace with a beep.sys from windows xp box.

Props to adam pash at lifehacker for giving me all these cool ideas. Using tomato to assign a static DHCP for my iphone. Yawcam and prowl.