ICM Week 6 – Using js to control Physical Devices
October 31, 2009The Challenge: Use the web to control a physical device or vice versa. I decided to combine the homework pieces of the serial lab and video objects to ultimately to control the volume of a Quicktime video with a potentiometer.
I struggled with the homework considerably. Quicktime video have a limited number of video controls, but I was sure that there would be audio levels. Quicktime itself provides a series of control options on their websites, plus I was able to find two different ways of controlling the audio. One used javascript and the other used rewriting the QT in javascript as opposed to an object embed. Javascript was already controlling the play, pause function in the demo, so I figured I could piggyback the volume control into the timerran code and finally came up with this:
document.bushfinger.SetVolume(inByte);
The real issue was “bushfinger.” That is the object id. The issue is the code being used for the video also includes a jpg as it’s intro image. I was unsure if the id tag on that correlates to just the jpg or the entire object and thusly assumed you needed to give the video it’s own id tag. Course, I couldn’t find an id tag, but I could find a videoname tag. Someone mentioned that videoname was the same thing as id. They were wrong, but understandably. Also, understandably, it didn’t work with the videoname reference in place of the id. Here is the finished page. It won’t really work for anyone who does not have the Arduino, the Arduino code and a potentiometer setup. Luckily, I have a youtube video that will do the work so you don’t have to. Cuz I’m a nice guy.
http://davidphillips.us/icmweb/w6-jsstearns.html
This video isn’t the best at proving the concept, but the talking that you hear is the video and then it diminishes with the turn of the potentiometer. Which is awesome.
This entry was posted in Comp Media for the Web. Bookmark the permalink. ← PComp – Week 8 – Transistor Lab Midterm! – Wear Where. An iPhone app. →