Networked Media Tank
Remote control via web - Printable Version

+- Networked Media Tank (http://www.networkedmediatank.com)
+-- Forum: Community Jukebox, Themes, & UserApps Section (/forumdisplay.php?fid=106)
+--- Forum: 200/300/400 Series - Development and User Apps (/forumdisplay.php?fid=121)
+---- Forum: 100 Series - Development and User Apps (/forumdisplay.php?fid=33)
+---- Thread: Remote control via web (/showthread.php?tid=3037)



Remote control via web - draio - 04-18-2008 02:22 PM

This is a just a test for a web based remote control.
Create a file called webcontrol.php in /mnt/syb8634/web and go to http://YourPCHaddress:8088/webremote.php

I hope this will be useful or just interesting for someone...

Note: I have some problem with the "enter" command... probably i didn't find the correct "key".

- - - - - - - - cut here - - - - - - - -

Code:
<html>
<head>
<title>Web Remote Control</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style>
.text1 { font-weight: bold; font-size: 14px; color: #B1D3F6; }
</style>
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" border="0" background="/sys/nmt_8634/PC1024/player/bg_pc.jpg"><table border="0" cellspacing="0" cellpadding="0">
<SCRIPT LANGUAGE="javascript">
function PgReload (BT)
{
document.wrform.irkey.value=BT.value;
document.wrform.submit();
}
</SCRIPT>

<font class="text1">

<?php

$IrFile = '/tmp/irkey';
$IrKey = $_POST['irkey'];

if ($IrKey)
{

if (!$handle = fopen($IrFile, 'a'))
  { echo "Cannot open file [$IrFile]";
   } else
     if (!fwrite($handle, $IrKey ))
     {
      echo "Cannot write to file [$IrFile]";
     } else
     { echo "Command $IrKey sent!";
       fclose($handle);
     }

}


?>

<form name="wrform" method="post" action=webremote.php>
<input type="hidden" name="irkey" value="0">
<table>
<tr>
<td></td>
<td><input type="button" value="168" onclick="PgReload(this)"></td>
<td></td>
</tr>

<tr>
<td><input type="button" value="170" onclick="PgReload(this)"></td>
<td align="center"><input type="button" value="13" onclick="PgReload(this)"></td>
<td><input type="button" value="171" onclick="PgReload(this)"></td>
</tr>

<tr>
<td></td>
<td><input type="button" value="169" onclick="PgReload(this)"></td>
<td></td>
</tr>

</table>
</form>

</font>
</body>
</html>

- - - - - - - - cut here - - - - - - - -

Some other useful codes...
    Play ..... 211
    Stop ..... 212
    Pause ..... 211 ?
    Prev ..... 219
    Next ..... 220
    Rev ..... 213
    Fwd ..... 214
    Power ..... 210



Re: Remote control via web - danjb - 05-11-2008 06:21 AM

draio Wrote:This is a just a test for a web based remote control.
Create a file called webcontrol.php in /mnt/syb8634/web and go to http://YourPCHaddress:8088/webremote.php

I hope this will be useful or just interesting for someone...
That's awesome, draio! How did you determine the keycodes that you determined (for the cursor keys, for example)? They don't seem to bear any relationship to the codes shown on the NMT Wiki (Where do I find the remote control codes for Popcorn hour?) for the remote.


Howto? - JaixBly - 05-16-2008 12:21 PM

How can I do this without mounting the HD in a computer?


- wesleyelder - 05-20-2008 09:00 PM

Wow-, amazing! thanks this has given me a few ideas to play around with
Wes Big Grin


- erlis - 05-22-2008 11:05 AM

Cool!

By using the information from this we can actually create a plugin like the "play on XBMC" where you click on a link and automatically send it to your PCH like:

"http://"+xboxIP+"/xbmcCmds/xbmcHttp?command=playfile&parameter="+theLink,true

Where we open up our own php page that redirect mono and sends play to mono.

Owl: Now you can create your ipod touch remote control!


- gintsgints - 05-22-2008 05:00 PM

I was thinking of replacing /tmp/irkey with /tmp/usbkbdpipe but no success. May be I do not know right codes.
Tracking write to this files could help discovering codes.


- sebestenyb - 05-24-2008 11:03 AM

"13" seems to be the "Return" key.


- gintsgints - 05-25-2008 07:26 AM

Here goes all codes in hex:
Quote:Power -> 0xD2

Upper block
xxxx 0x8C xxxx 0x9E

0xEF 0x8F 0xE1 0x9F


Number keys:

1 2 3
0xF2 0xF3 0xF4

4 5 6
0xF5 0xF6 0xF7

7 8 9
0xF8 0xF9 0xFA

Del 0 Caps
0x08 0xF1 0xFC

Ret Up Source
0x8D 0xA8 0xDD

Left Ent Right
0xAA 0x0D 0xAB

Left Ent Right
0x95 0xA9 0xD0


bottom keys block

0x09 0xDB 0xE9 0xDC

0x94 0xD5 0x1B 0xD6

0x90 0xEC 0xEA 0xD9

0x91 0xD8 0xEB 0xDA

0xDE 0xDF 0xE0 0xE2



how would you implement this in crestron - russters - 07-31-2008 09:17 PM

how would this be implemented in crestron???


RE: Remote control via web - stefkoch - 06-01-2009 07:35 PM

Hi all,
i got inspired by this thread, by the MediatankController
and also frustrated by the fact that there is no adobe air for windows mobile.
so i created a little webpage and implemented the basic functions.

Instruction:just copy both webremote.jpg and webremote.php into
/mnt/syb8634/web/
and point your browser to
http://your-popcorn-ip:8088/webremote.php
to get this image: (most buttons work already) Smile
[Image: webremote.jpg]
sorry Niels, i stole your image Smile
PHP Code:
<html>
<
head>
<
title>Web Remote Control</title>
</
head>
<
body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" border="0" bgcolor="#000000">
<
img src="webremote.jpg" width="420" height="500" border="0" usemap="#map" />
<
map name="map">
<!-- 
#$-:Image map file created by GIMP Image Map plug-in -->
<!-- #$-:GIMP Image Map plug-in by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.3 -->
<!-- #$AUTHOR:stefankoch -->
<area shape="circle" coords="120,127,25" href="webremote.php?do=OK" />
<
area shape="poly" coords="73,80,119,62,164,82,137,108,120,100,101,109,72,81" href="webremote.php?do=Up" />
<
area shape="poly" coords="71,83,100,109,93,127,100,144,72,172,53,128" href="webremote.php?do=Left" />
<
area shape="poly" coords="165,82,184,125,164,172,137,145,147,126,138,109" href="webremote.php?do=Right" />
<
area shape="poly" coords="100,145,119,154,137,146,164,173,118,191,74,174" href="webremote.php?do=Down" />
<
area shape="circle" coords="54,200,17" href="webremote.php?do=Home" />
<
area shape="circle" coords="182,202,17" href="webremote.php?do=Back" />
<
area shape="rect" coords="51,250,93,277" href="webremote.php?do=Subtitle" />
<
area shape="rect" coords="145,250,188,277" href="webremote.php?do=Info" />
<
area shape="rect" coords="97,250,141,277" href="webremote.php?do=Audio" />
<
area shape="rect" coords="226,104,262,128" href="webremote.php?do=1" />
<
area shape="rect" coords="271,104,311,128" href="webremote.php?do=2" />
<
area shape="rect" coords="321,105,358,128" href="webremote.php?do=3" />
<
area shape="rect" coords="225,141,262,162" href="webremote.php?do=4" />
<
area shape="rect" coords="271,141,311,162" href="webremote.php?do=5" />
<
area shape="rect" coords="321,141,358,162" href="webremote.php?do=6" />
<
area shape="rect" coords="224,175,262,196" href="webremote.php?do=7" />
<
area shape="rect" coords="272,174,310,196" href="webremote.php?do=8" />
<
area shape="rect" coords="321,174,357,196" href="webremote.php?do=9" />
<
area shape="rect" coords="272,209,310,231" href="webremote.php?do=0" />
<
area shape="circle" coords="302,364,17" href="webremote.php?do=VolumeDown" />
<
area shape="circle" coords="341,363,17" href="webremote.php?do=VolumeUp" />
<
area shape="circle" coords="120,423,30" href="webremote.php?do=Play" />
<
area shape="circle" coords="172,406,21" href="webremote.php?do=Pause" />
<
area shape="circle" coords="67,407,22" href="webremote.php?do=Stop" />
<
area shape="rect" coords="226,61,255,80" href="webremote.php?do=Red" />
<
area shape="rect" coords="260,60,288,80" href="webremote.php?do=Green" />
<
area shape="rect" coords="292,60,322,80" href="webremote.php?do=Yellow" />
<
area shape="rect" coords="327,60,356,80" href="webremote.php?do=Blue" />
<
area shape="rect" coords="291,305,321,330" href="webremote.php?do=TVMode" />
<
area shape="rect" coords="261,267,290,293" href="webremote.php?do=Zoom" />
<
area shape="rect" coords="261,305,291,330" href="webremote.php?do=Setup" />
<
area shape="rect" coords="321,305,356,330" href="webremote.php?do=Eject" />
<
area shape="rect" coords="162,356,199,379" href="webremote.php?do=Next" />
<
area shape="rect" coords="122,356,159,379" href="webremote.php?do=Forward" />
<
area shape="rect" coords="83,356,119,379" href="webremote.php?do=Rewind" />
<
area shape="rect" coords="43,356,80,379" href="webremote.php?do=Previous" />
<
area shape="rect" coords="228,305,259,330" href="webremote.php?do=Source" />
<
area shape="rect" coords="321,209,357,231" href="webremote.php?do=Caps" />
<
area shape="rect" coords="228,267,259,293" href="webremote.php?do=Timeseek" />
<
area shape="rect" coords="321,267,356,293" href="webremote.php?do=Angle" />
<
area shape="rect" coords="291,267,320,293" href="webremote.php?do=Repeat" />
<
area shape="rect" coords="225,209,262,231" href="webremote.php?do=Del" />
</
map>
<?
php
$hexkeys 
= array(
'Play'=>'E9'
'Pause'=>'EA',
'Stop'=>'1B',
'OK'=>'0D',
'Up'=>'A8',
'Down'=>'A9',
'Left'=>'AA',
'Right'=>'AB',
'Back'=>'8D',
'Menu'=>'09',
'Home'=>'D0',
'Rewind'=>'D5',
'Forward'=>'D6',
'Previous'=>'DB',
'Next'=>'DC',
'Subtitle'=>'EB',
'Audio'=>'D8',
'Info'=>'95',
'Setup'=>'8C',
'Source'=>'DD',
'Power'=>'D2',
'Red'=>'DE',
'Green'=>'DF',
'Yellow'=>'E0',
'Blue'=>'E2',
'Del'=>'08',
'Caps'=>'FC',
'Timeseek'=>'91',
'Zoom'=>'DA',
'Repeat'=>'90',
'Angle'=>'EC',
'TVMode'=>'8F',
'Eject'=>'EF',
'VolumeUp'=>'9E',
'VolumeDown'=>'9F',
'Mute'=>'E1',
'0'=>'F1',
'1'=>'F2',
'2'=>'F3',
'3'=>'F4',
'4'=>'F5',
'5'=>'F6',
'6'=>'F7',
'7'=>'F8',
'8'=>'F9',
'9'=>'FA'
);

$IrFile '/tmp/irkey';
$do $_GET['do'];
$IrKeyHex $hexkeys[$do];
$IrKeyDec hexdec($IrKeyHex);
if (
$IrKeyDec)
{
if (!
$handle fopen($IrFile'a'))
  { echo 
"Cannot open file [$IrFile]";
   } else
     if (!
fwrite($handle$IrKeyDec ))
     {
      echo 
"Cannot write to file [$IrFile]";
     } else
     { 
#echo "Command $do sent!";
       
fclose($handle);
     }
}
?>
</body>
</html> 

however there are still some bugs:
- i have a strange behavior with the OK-button while i am in a subfolder,
sometimes it works, sometimes it does not. (same problem as draio has i suppose)
using just the keycodes seems not to be enough, but i have not figured out yet where the problem is. ideas anyone?