We have moved at community.getvera.com

Author Topic: Novel use for new webview feature: Switching Mac audio output.  (Read 2618 times)

Offline kd5ftn

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
I'm sure this is a bit of a special case, but I thought I'd like to share what I came up with just in case anyone else is interested in trying this.

I use a hackintosh as my home office computer as well as my home theater machine. In the past, I had to use a mouse&keyboard to switch the mac's audio outputs between two rooms. (I can't just split the signal, since one is stereo/analog, and the other is optical/digital)

I did some googling and found a command-line tool that someone wrote to switch audio outputs. I took that command-line tool, wrapped it in a shell script to switch back and forth between my two inputs, then made a PHP script to call it. I then setup apache on the hackintosh and now when I point to that php page from inside my network, it switches audio inputs.

Originally, I planned to simply use it with a button on the homescreen that launches safari and hits the bookmark, but then I started to explore webview and found it works perfectly. I pop open the web-view side tab, and it loads the page thus switching the input. I even did a little CSS styling on the page so it really looks like part of SQ Remote.

I've attached a screenshot of what it looks like, plus the code involved. I'm not a programmer by any means, so it was a lot of copy-pasta and trial and error to make this work.






Offline fall-line

  • Full Member
  • ***
  • Posts: 247
  • Karma: +1/-0
Re: Novel use for new webview feature: Switching Mac audio output.
« Reply #1 on: April 01, 2011, 01:41:10 pm »
Very nice - good use of the new feature.

For others that may come accross this, you can also call a script like this on your machine via a luup wget call as a part of a vera scene (which can be triggered by a button press, macro, etc)

There are a few examples of this out there, but since you are using a mac already, here is a link to my iTunes audio control method which uses a similar method to control the mac:
http://forum.micasaverde.com/index.php?topic=3895.0

Offline kd5ftn

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
Re: Novel use for new webview feature: Switching Mac audio output.
« Reply #2 on: April 01, 2011, 02:12:08 pm »
Oh, very cool. Thanks! I wasn't even considering using a wget luup call, but that makes sense as well. I was in the mindset of controlling this from the ipad, but didn't even bring sq remote into the equation until the end.

Regarding the itunes remote, I use a mix of the Apple remote app and Rowmote. I've also enabled the multi-touch app switching gestures, so it's now relatively easy to switch between. I'll check out your solution though.

What would be really cool is an interface to control Pandora on my mac via the ipad. I can do it now via LogMeIn and I'm sure AirDisplay would work as well, but I'd like something more native.

Offline SquareConnectMat

  • Moderator
  • Full Member
  • *****
  • Posts: 248
  • Karma: +0/-0
Re: Novel use for new webview feature: Switching Mac audio output.
« Reply #3 on: April 01, 2011, 02:57:09 pm »
This is an awesome use of the web-view...

We saw this as the first iteration of this feature, and are now looking for feedback on how to make it even more useful...

Note that the iPhone has html5 so there are really neat opportunities to create these types of specialzed 'mini' web sites...

For future iterations of this feature, some ideas I have had ...
 
1) Allow web pages to use javascript to make 'calls' into sqremote - all the IR device and mios controls and status  would be available to your web page

2) Allow the web page/site to be 'down loaded' to tSQ Remote, meaning that it can run without going to an external server to load...

We havn't prioritized anymore features for web-views yet, so ideas of how it is used and how you would like to use it would be great...

Mat