Skip to content

Commit

Permalink
Framework seem wokr.
Browse files Browse the repository at this point in the history
  • Loading branch information
Teaonly committed Jul 28, 2012
1 parent 220782d commit 4c88ad1
Show file tree
Hide file tree
Showing 16 changed files with 320 additions and 17 deletions.
41 changes: 41 additions & 0 deletions assets/droideye.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var supportedSize = new Array();
var planeWidth = 0;
var planeHeight = 0;
var basicURL = "";

var onPlayClick = function () {

};

var onQueryDone = function (ret) {
$("#debug_msg").html(ret);
$("#btn_play").removeClass('ui-disabled');
}
var onQueryError = function () {
$("#debug_msg").html("连接视频错误,请刷新重试!");
}

$("#page_main").live("pageinit", function() {
basicURL = $(location).attr('href');

var screenHeight = $(window).height();
var screenWidth = $(window).width();
planeHeight = Math.round( screenHeight * 0.5);
planeWidth = Math.round( screenWidth * 0.80);

$("#video_plane").width(planeWidth);
$("#video_plane").height(planeHeight);

$("#btn_play").addClass('ui-disabled');
$("#btn_play").click(onPlayClick);

$("#debug_msg").html(basicURL);
$.ajax({
url: "http://192.168.0.102:8080/cgi/query",
cache: false,
error: onQueryError,
success: onQueryDone
});
});


21 changes: 21 additions & 0 deletions assets/extern.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
div.live_image_box {
display: block;
background-color: black;
text-align:center;
margin-left: auto;
margin-right: auto;
}

div.center {
text-align:center;
margin-left: auto;
margin-right: auto;
}

#bottom_div {
position: absolute;
bottom:0;
right:0;
margin:auto 0;
}

Binary file added assets/images/black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 51 additions & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
<h1>Hello World</h1>
<!DOCTYPE html>
<html>
<head>
<title>远程视讯监控王</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="res/jquery.mobile-1.1.1.min.css" />
<link rel="stylesheet" href="extern.css">
<script src="res/jquery-1.7.1.min.js"></script>
<script src="res/jquery.mobile-1.1.1.min.js"></script>
<script src="droideye.js"></script>
</head>
<body>

<!--
/*********************************************************
* Main page
*
*********************************************************/
-->
<div data-role="page" data-title="login" id="page_main" data-theme="c" >
<div data-role="header">
<h2>视频控制面板</h2>
</div>

<div data-role="content">
<ul data-role="listview" data-inset="true" >
<li>
<div class="live_image_box" id="video_plane">
<img id="live_image" src="images/black.png">
</div>
</li>
<li data-role="fieldcontain" class="center">
<div class="center">
<span>选择视频分辨率:</span>
<select name="resolution-choice" id="resolution-choice" data-native-menu="false">
</select>
</div>
<a href="#" data-role="button" id="btn_play">播放视频</a>
</li>
</ul>
<!-- for debug -->
<div id="bottom_div">
<span id="debug_msg">正在连接视频</span>
</div>
</div><!-- /content -->

</div><!-- page -->

</body>
</html>
Binary file added assets/res/images/ajax-loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/res/images/ajax-loader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/res/images/icons-18-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/res/images/icons-18-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/res/images/icons-36-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/res/images/icons-36-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/res/jquery-1.7.1.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/res/jquery.mobile-1.1.1.min.css

Large diffs are not rendered by default.

181 changes: 181 additions & 0 deletions assets/res/jquery.mobile-1.1.1.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/res/jquery.mobile.structure-1.1.1.min.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions assets/res/jquery.mobile.theme-1.1.1.min.css

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions src/teaonly/droideye/NanoHTTPD.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,12 @@ else if (!sbfound || size == 0x7FFFFFFFFFFFFFFFl)
// in data section, too, read it:
if ( method.equalsIgnoreCase( "POST" ))
{
String contentType = "";
String contentTypeHeader = header.getProperty("content-type");
StringTokenizer st = new StringTokenizer( contentTypeHeader , "; " );
if ( st.hasMoreTokens()) {
contentType = st.nextToken();
}
String contentType = "";
String contentTypeHeader = header.getProperty("content-type");
StringTokenizer st = new StringTokenizer( contentTypeHeader , "; " );
if ( st.hasMoreTokens()) {
contentType = st.nextToken();
}

if (contentType.equalsIgnoreCase("multipart/form-data"))
{
Expand Down Expand Up @@ -1106,12 +1106,15 @@ private Response serveAssets( String uri, Properties header) {
if ( uri.endsWith("/") || uri.equalsIgnoreCase("") ) {
uri = uri + "index.html";
}

Log.d("TEAONLY", ">>>> URI = " + uri);

AssetFileDescriptor assetFile = null;
InputStream assetFile = null;
try {
assetFile = myAssets.openFd(uri);
assetFile = myAssets.open(uri);
} catch ( IOException ex) {
assetFile = null;
Log.d("TEAONLY", ">>>> Open Error:" + ex);
}
if ( res == null && assetFile == null) {
res = new Response( HTTP_NOTFOUND, MIME_PLAINTEXT,
Expand All @@ -1129,7 +1132,7 @@ private Response serveAssets( String uri, Properties header) {
mime = MIME_DEFAULT_BINARY;

// Calculate etag
String etag = Integer.toHexString((uri + "" + assetFile.getLength()).hashCode());
String etag = Integer.toHexString((uri + "" + assetFile.available()).hashCode());

// Support (simple) skipping:
long startFrom = 0;
Expand All @@ -1153,7 +1156,7 @@ private Response serveAssets( String uri, Properties header) {
}

// Change return code and add Content-Range header when skipping is requested
long fileLen = assetFile.getLength();
long fileLen = assetFile.available();
if (range != null && startFrom >= 0)
{
if ( startFrom >= fileLen)
Expand All @@ -1170,20 +1173,17 @@ private Response serveAssets( String uri, Properties header) {
if ( newLen < 0 ) newLen = 0;

final long dataLen = newLen;
FileInputStream fis = new FileInputStream( assetFile.getFileDescriptor() ) {
public int available() throws IOException { return (int)dataLen; }
};
fis.skip( startFrom );
assetFile.skip( startFrom );

res = new Response( HTTP_PARTIALCONTENT, mime, fis );
res = new Response( HTTP_PARTIALCONTENT, mime, assetFile );
res.addHeader( "Content-Length", "" + dataLen);
res.addHeader( "Content-Range", "bytes " + startFrom + "-" + endAt + "/" + fileLen);
res.addHeader( "ETag", etag);
}
}
else
{
res = new Response( HTTP_OK, mime, assetFile.createInputStream() );
res = new Response( HTTP_OK, mime, assetFile );
res.addHeader( "Content-Length", "" + fileLen);
res.addHeader( "ETag", etag);
}
Expand Down

0 comments on commit 4c88ad1

Please sign in to comment.