【发布时间】:2014-07-01 14:41:15
【问题描述】:
我试图在浏览器模式下从 Android 上的 IP 网络摄像头应用程序获取流一段时间,但没有成功。 我尝试使用 webview 加载托管在我的笔记本电脑上的 html 页面,但无法在我的应用程序中运行,但适用于 chrome for android ...这是我的代码:
Camera.html
<img id="browser_video" class="video-image" alt="video" src="http://192.168.1.101:8080/video">
MainActivity
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.webkit.WebView;
public class MainActivity extends Activity{
WebView wv;
String URL = "http://192.168.1.187:8080/camera.html";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wv = (WebView) findViewById(R.id.wvImage);
wv.loadUrl(URL);
}
}
还有 activity_main:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/wvImage"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
接下来要尝试什么?
这是它在 chrome 和我的应用程序上的外观
http://i1258.photobucket.com/albums/ii532/csanonymus/Screenshot_2014-07-01-17-57-28_zps22e1e220.png
http://i1258.photobucket.com/albums/ii532/csanonymus/Screenshot_2014-07-01-17-57-07_zpsad9244d3.png
【问题讨论】: