diff --git a/assets/www/index.htm b/assets/www/index.htm index 33e2f32..13ebedb 100644 --- a/assets/www/index.htm +++ b/assets/www/index.htm @@ -67,6 +67,11 @@ style="visibility:hidden;" id="vlcv"> +
+
+
+
?
+
-
+
Fullscreen
Battery: 100%
@@ -227,7 +232,6 @@ Hide those tips - diff --git a/assets/www/js/translations.js b/assets/www/js/translations.js index 26907cf..1d7ffed 100644 --- a/assets/www/js/translations.js +++ b/assets/www/js/translations.js @@ -25,7 +25,7 @@ 21:"If the stream is choppy, try reducing the bitrate or increasing the cache size.", 22:"Try it instead of H.263 if video streaming is not working at all !", 23:"The H.264 compression algorithm is more efficient but may not work on your phone...", - 24:"You need to install VLC first !", + 24:"You need to install or update VLC and the VLC mozilla plugin !", 25:"During the installation make sure to check the firefox plugin !", 26:"Close", 27:"You must leave the screen of your smartphone on !", @@ -72,7 +72,7 @@ 21:"Si le stream est saccadé essaye de réduire le bitrate ou d'augmenter la taille du cache.", 22:"Essaye le à la place du H.263 si le streaming de la vidéo ne marche pas du tout !", 23:"Le H.264 est un algo plus efficace pour compresser la vidéo mais il a moins de chance de marcher sur ton smartphone...", - 24:"Tu dois d'abord installer VLC !!", + 24:"Tu dois d'abord installer ou mettre à jour VLC et le mozilla plugin !", 25:"Pendant l'installation laisse cochée l'option plugin mozilla !", 26:"Fermer", 27:"Tu dois laisser l'écran de ton smartphone allumé", @@ -119,7 +119,7 @@ 21:"Если поток прерывается, попробуйте уменьшить битрейт или увеличив размер кэша.", 22:"Если топоковое видео не работает совсем, попробуйте сжатие Н.263", 23:"Алгоритм сжатия H.264, является более эффективным, но может не работать на вашем телефоне ...", - 24:"Вначале Вам необходимо установить VLC !", + 24:"You need to install or update VLC and the VLC mozilla plugin !", 25:"При установке убедитесь в наличии плагина для firefox !", 26:"Закрыть", 27:"Вам надо отойти от вашего смартфона.", @@ -164,7 +164,7 @@ 21:"Wenn das Stream ruckartig ist, versuch mal die Bitrate zu reduzieren oder die Größe vom Cache zu steigern.", 22:"Probier es ansatt H.263, wenn das Videostream überhaupt nicht funktionert !", 23:"Der H.264 Kompressionalgorithmus ist effizienter aber er wird auf deinem Handy vielleicht nicht funktionieren...", - 24:"Du musst zuerst VLC installieren !!", + 24:"You need to install or update VLC and the VLC mozilla plugin !", 25:"Während der Installation, prüfe dass das Firefox plugin abgecheckt ist!", 26:"Zumachen", 27:"Du musst den Bildschirm deines Smartphones eingeschaltet lassen !", diff --git a/assets/www/js/ui.js b/assets/www/js/ui.js index a6412f8..80c42b4 100644 --- a/assets/www/js/ui.js +++ b/assets/www/js/ui.js @@ -7,6 +7,7 @@ var audioPlugin; var audioStream; var error; + var volume; function stream(object,type,done) { @@ -92,16 +93,22 @@ $.ajax({type: 'POST', url: 'request.json', data: JSON.stringify(data), success:success, error:error}); } - function updateBatteryLevel(level) { - $('#battery>#level').text(level); + function updatePhoneStatus(data) { + + if (data.volume !== undefined) { + volume = data.volume; + $('#sound>#volume').text(volume.current); + } + $('#battery>#level').text(data.battery); + setTimeout(function () { sendRequest( - "battery", + [{"action":"battery"},{"action":"volume"}], function (e) { - updateBatteryLevel(e.battery); + updatePhoneStatus(e); }, function () { - updateBatteryLevel('??'); + updatePhoneStatus({battery:'??'}); } ); },100000); @@ -159,6 +166,13 @@ } } + function testVlcPlugin() { + if (videoPlugin[0].VersionInfo === undefined || videoPlugin[0].VersionInfo.indexOf('2.0') === -1) { + $('#error-noplugin').fadeIn(); + $('#glass').fadeIn(); + } + } + function generateUriParams(type) { var audioEncoder, videoEncoder, cache, rotation, flash, camera, res; @@ -384,6 +398,20 @@ $('#need-help').hide(); }); + $('#sound #plus').click(function () { + volume.current += 1; + if (volume.current > volume.max) volume.current = volume.max; + else sendRequest([{'action':'volume','set':volume.current}]); + $('#sound>#volume').text(volume.current); + }); + + $('#sound #minus').click(function () { + volume.current -= 1; + if (volume.current < 0) volume.current = 0; + else sendRequest([{'action':'volume','set':volume.current}]); + $('#sound>#volume').text(volume.current); + }); + window.onbeforeunload = function (e) { videoStream.stop(); audioStream.stop(); @@ -399,19 +427,21 @@ audioPlugin = $('#vlca'); audioStream = stream(audioPlugin[0],'audio',updateStatus); - sendRequest([{'action':'sounds'},{'action':'screen'},{'action':'get'},{'action':'battery'}], function (data) { + testVlcPlugin(); + + sendRequest([{'action':'sounds'},{'action':'screen'},{'action':'get'},{'action':'battery'},{'action':'volume'}], function (data) { - // Verify that the screen is not turned off + // Verifies that the screen is not turned off testScreenState(data.screen); - // Fetch the list of sounds available on the phone + // Fetches the list of sounds available on the phone loadSoundsList(data.sounds); - // Retrieve the configuration of Spydroid on the phone + // Retrieves the configuration of Spydroid on the phone loadSettings(data.get); - // Retrieve the battery level - updateBatteryLevel(data.battery); + // Retrieves volume and battery level + updatePhoneStatus(data); }); diff --git a/assets/www/less/base.less b/assets/www/less/base.less index eb90274..f98bc92 100644 --- a/assets/www/less/base.less +++ b/assets/www/less/base.less @@ -112,6 +112,7 @@ a { } a:hover { color: lighten(red,20%); + cursor: pointer; } @@ -331,7 +332,7 @@ section { #error-noplugin { width: 600px; - height: 420px; + height: 460px; h3 { margin-top: 15px; } @@ -455,6 +456,20 @@ footer { } +#sound { + #plus,#minus {font-size: 24px;} + #volume {font-size: 14px;} + >div { + text-align: center; + width: 28px; + } + position: absolute; + z-index: -1; + bottom: 25px; + left: -28px; + background: rgba(7, 63, 131, 0.2); +} + #battery { position: absolute; diff --git a/assets/www/less/styles.css b/assets/www/less/styles.css index 5dca1dd..f3cef81 100644 --- a/assets/www/less/styles.css +++ b/assets/www/less/styles.css @@ -13,7 +13,7 @@ body:lang(ru) em{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-si h1,h2,h3,h4{font-weight:normal;display:block;padding:0;margin:0;} em{font-style:normal;} a{color:white;-moz-transition:color 0.4s;-ms-transition:color 0.4s;-o-transition:color 0.4s;-webkit-transition:color 0.4s;transition:color 0.4s;} -a:hover{color:#ff6666;} +a:hover{color:#ff6666;cursor:pointer;} select{display:inline-block;border:1px solid #CCC;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;font-weight:normal;color:#555;background-color:white;font-size:100%;} header{padding-top:30px;width:100%;height:150px;text-align:center;}header img{display:block;clear:both;margin:auto;} #about{background:rgba(255, 255, 255, 0.2);position:fixed;right:0px;top:0px;width:100px;height:30px;line-height:30px;text-align:center;} @@ -40,7 +40,7 @@ section #cameras img{display:block;margin:30px auto;filter:alpha(opacity=20);opa .popup #close{position:absolute;bottom:10px;left:0px;width:100%;} .popup img{-webkit-box-shadow:3px 3px 15px rgba(0, 0, 0, 0.75);-moz-box-shadow:3px 3px 15px rgba(0, 0, 0, 0.75);box-shadow:3px 3px 15px rgba(0, 0, 0, 0.75);} #error-screenoff{width:600px;height:120px;} -#error-noplugin{width:600px;height:420px;}#error-noplugin h3{margin-top:15px;} +#error-noplugin{width:600px;height:460px;}#error-noplugin h3{margin-top:15px;} #error-noplugin img{float:right;margin:60px 15px 10px 10px;} footer{margin-top:30px;}footer #connect{clear:both;width:344px;height:56px;margin:auto;}footer #connect>div{cursor:pointer;position:absolute;background:url('../images/red-button.png');width:344px;height:56px;z-index:1;} footer #status-container{background:rgba(7, 63, 131, 0.2);width:280px;height:40px;margin:-10px auto;text-align:center;line-height:49px;} @@ -56,13 +56,15 @@ footer #status-container{background:rgba(7, 63, 131, 0.2);width:280px;height:40p #tooltip #title{text-align:center;margin:20px;} #tooltip #content{padding:0 20px 20px 20px;text-align:justify;} #tooltip #hide-tooltip{display:block;text-align:center;margin-bottom:15px;text-decoration:underline;cursor:pointer;} +#sound{position:absolute;z-index:-1;bottom:25px;left:-28px;background:rgba(7, 63, 131, 0.2);}#sound #plus,#sound #minus{font-size:24px;} +#sound #volume{font-size:14px;} +#sound>div{text-align:center;width:28px;} #battery{position:absolute;z-index:-1;bottom:-25px;left:130px;padding:5px 20px 4px 20px;background:rgba(7, 63, 131, 0.2);} @-moz-keyframes move{0%{margin-left:0px;} 100%{margin-left:190px;}}@-o-keyframes move{0%{margin-left:0px;} 100%{margin-left:190px;}}@-ms-keyframes move{0%{margin-left:0px;} 100%{margin-left:190px;}}@-webkit-keyframes move{0%{margin-left:0px;} 100%{margin-left:190px;}}#vlc-container{background:black;width:640px;height:480px;float:left;margin-bottom:20px;-webkit-box-shadow:2px 2px 5px rgba(0, 0, 0, 0.7);-moz-box-shadow:2px 2px 5px rgba(0, 0, 0, 0.7);box-shadow:2px 2px 5px rgba(0, 0, 0, 0.7);position:relative;}#vlc-container #upper-layer{display:table;position:absolute;background:url("../images/eye.png") center no-repeat;top:0px;left:0px;width:640px;height:480px;z-index:10;overflow:hidden;}#vlc-container #upper-layer h1{font-size:20px;letter-spacing:8px;} #vlc-container #upper-layer #wrapper{display:table-cell;vertical-align:middle;}#vlc-container #upper-layer #wrapper p{padding:0px 90px 0px 90px;text-align:center;} #vlc-container #upper-layer #mask{opacity:0.9;-webkit-animation:move 2s infinite alternate ease-in-out;-moz-animation:move 2s infinite alternate ease-in-out;-o-animation:move 2s infinite alternate ease-in-out;-ms-animation:move 2s infinite alternate ease-in-out;animation:move 2s infinite alternate ease-in-out;position:absolute;z-index:100;width:460px;height:55px;top:0;bottom:0;left:0;right:0;margin:auto;background:-moz-linear-gradient(left, #000000 0%, #000000 35%, rgba(0, 0, 0, 0) 50%, #000000 65%, #000000 100%);background:-webkit-gradient(linear, left top, right top, color-stop(0%, #000000), color-stop(35%, #000000), color-stop(50%, rgba(0, 0, 0, 0)), color-stop(65%, #000000), color-stop(100%, #000000));background:-webkit-linear-gradient(left, #000000 0%, #000000 35%, rgba(0, 0, 0, 0) 50%, #000000 65%, #000000 100%);background:-o-linear-gradient(left, #000000 0%, #000000 35%, rgba(0, 0, 0, 0) 50%, #000000 65%, #000000 100%);background:-ms-linear-gradient(left, #000000 0%, #000000 35%, rgba(0, 0, 0, 0) 50%, #000000 65%, #000000 100%);background:linear-gradient(to right, #000000 0%, #000000 35%, rgba(0, 0, 0, 0) 50%, #000000 65%, #000000 100%);} #vlc-container #vlc{visibility:hidden;} #vlc-container #fullscreen{position:absolute;z-index:0;bottom:-25px;left:20px;padding:5px 20px 4px 20px;background:rgba(7, 63, 131, 0.2);} -#vlc-container #fullscreen:hover{cursor:pointer;color:#ff6666;} .accordion .section{overflow:hidden;-moz-transition:height 1s;-ms-transition:height 1s;-o-transition:height 1s;-webkit-transition:height 1s;transition:height 1s;height:45px;cursor:pointer;position:relative;z-index:0;}.accordion .section .title{position:absolute;z-index:2;top:0;left:0;width:257px;background:url('../images/blue-button.png');height:45px;clear:both;}.accordion .section .title h1{line-height:41px;} .accordion .section .section-content{position:absolute;z-index:1;top:40px;left:17px;width:220px;height:340px;margin:auto;padding-top:1px;background:rgba(255, 255, 255, 0.1);} .accordion .selected{height:340px;} diff --git a/assets/www/less/vlc.less b/assets/www/less/vlc.less index 658d2e6..fb97663 100644 --- a/assets/www/less/vlc.less +++ b/assets/www/less/vlc.less @@ -110,9 +110,5 @@ padding: 5px 20px 4px 20px; background: rgba(7, 63, 131, 0.2); } - #fullscreen:hover { - cursor: pointer; - color: lighten(red,20%); - } - + } diff --git a/src/net/majorkernelpanic/spydroid/api/RequestHandler.java b/src/net/majorkernelpanic/spydroid/api/RequestHandler.java index 48eec5e..6f07b19 100644 --- a/src/net/majorkernelpanic/spydroid/api/RequestHandler.java +++ b/src/net/majorkernelpanic/spydroid/api/RequestHandler.java @@ -116,6 +116,7 @@ static public String handle(String request) { * -> "state": returns a JSON containing information about the state of the application * -> "battery": returns an approximation of the battery level on the phone * -> "buzz": makes the phone buuz + * -> "volume": sets or gets the volume * @throws JSONException * @throws IllegalAccessException * @throws IllegalArgumentException @@ -230,6 +231,19 @@ else if (action.equals("buzz")) { vibrator.vibrate(300); response.append("[]"); } + + // Sets or gets the system's volume + else if (action.equals("volume")) { + AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + if (object.has("set")) { + audio.setStreamVolume(AudioManager.STREAM_MUSIC, object.getInt("set"), AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + response.append("[]"); + } else { + int max = audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC); + int current = audio.getStreamVolume(AudioManager.STREAM_MUSIC); + response.append("{\"max\":"+max+",\"current\":"+current+"}"); + } + } } diff --git a/src/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java b/src/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java index 4e1962c..4c90dc8 100644 --- a/src/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java +++ b/src/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java @@ -118,7 +118,7 @@ protected static String printBuffer(byte[] buffer, int start,int end) { protected static class Statistics { - public final static int COUNT=50; + public final static int COUNT=500000; private float m = 0, q = 0; public void init(long value) {