java - Get stream from IP Webcam -


i trying stream ip webcam app on android in browser mode time unsuccessful. tried webview loading html page hosted on laptop not working in app works in chrome android ...here code :

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);          }    } 

and 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> 

what try next?

this how looks on chrome , on app

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

make sure have:

websettings websettings = wv.getsettings(); websettings.setjavascriptenabled(true); 

does show blank screen?

edit: in androidmanifest.xml activity tag add android:hardwareaccelerated="true"

my own ip camera code:

here ip camera controller

public class webviewactivity extends activity {  string url = "http://192.168.1.187:8080/camera.html";  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      //remove title bar     this.requestwindowfeature(window.feature_no_title);      //remove notification bar     this.getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen);      setcontentview(r.layout.activity_mini_bot_controller);      webview webview = (webview) findviewbyid(r.id.browser);     intent intent = getintent();     string myip = intent.getstringextra(mainactivity.extra_message);     webview.getsettings().setjavascriptenabled(true);     webview.setwebviewclient(new mywebviewclient ());     webview.loadurl(url);   }   } 

then activity:

public class mainactivity extends actionbaractivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         intent intent = new intent(this, minibotcontroller.class);         startactivity(intent);     }  } 

hope helped.

note: it's worth mentioning program starts in fragment input ip address , hit 'play' , runs webview.

hopefully last edit: modified code drag , drop, need 2 files. 1 named webviewactivity , 1 named mainactivity. main activity starts intent second activity handle everything. working example have use 1 on occasion.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -