我試圖從瀏覽器模式下的Android上的IP攝像頭應用流獲取流一段時間,但沒有成功。 我試着用的WebView加載託管在我的筆記本電腦在我的應用程序不能正常工作HTML頁面,但在Android版Chrome瀏覽作品...這裏是我的代碼:從IP攝像頭獲取流
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>
接下來要做什麼?
這是它的外觀上的鍍鉻和我的應用程序
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
是一個白色的屏幕..我在camera.html中添加了一個按鈕,它只顯示按鈕...我遵循你的答案,但仍然相同 – marcelinho
還設置了你的webviewclient: 'wv.setWebViewClient(new MyWebViewClient ());' 也看到這個線程:http://stackoverflow.com/questions/17182860/webview-is-not-loading-html5-video-in-android –
仍然是空的..它變得非常令人沮喪! – marcelinho