I have bought Foscam Security Camera and I am able to see the JPEG streaming on my MacBook. But when I open the same link in my phone browser using chrome then it starts downloading something not sure what and in notification menu shows unsuccessful download.
此外,如果我打开了与我的安妮·布罗韦瑟的同样联系,我就能够看到录像。
我必须创建一种星体应用,显示视频流出,就像在手提电脑浏览器上看到的那样。
以下是我使用的法典:
package org.securitycamera;
import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.VideoView;
public class SecuritycameraActivity extends Activity {
WebView webView;
FrameLayout frameLayout;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutInflater inflator = getLayoutInflater();
View inflatedView = inflator.inflate(R.layout.main, null);
if (!(inflatedView instanceof FrameLayout))
{
throw new RuntimeException("inflated view not FrameLayout");
}
else
{
frameLayout = (FrameLayout)inflatedView;
}
setContentView(frameLayout);
webView = (WebView) findViewById(R.id.wv);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(android.webkit.WebSettings.PluginState.ON);
webView.setWebChromeClient(new MyWebChromeClient());
try
{
// webView.loadUrl("http://192.168.1.6/videostream.cgi?user=admin&pwd=");
webView.loadUrl("http://broken-links.com/tests/video/");
}
catch(Exception e)
{
throw new RuntimeException();
}
}
private class MyWebChromeClient extends WebChromeClient implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnPreparedListener {
VideoView videoView;
WebChromeClient.CustomViewCallback customViewCallback;
public void onProgressChanged(WebView view, int newProgress)
{
if (newProgress == 100)
{
view.loadUrl("javascript:playVideo()");
}
}
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback)
{
if (view instanceof FrameLayout){
FrameLayout frame = (FrameLayout) view;
if (frame.getFocusedChild() instanceof VideoView){
VideoView video = (VideoView) frame.getFocusedChild();
frame.removeView(video);
setContentView(video);
video.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
//Log.i(DVNGActivity.TAG, "LoadData_QRURL --> onCompletion...");
mp.stop();
setContentView(R.layout.main);
}
});
video.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
// Log.i(DVNGActivity.TAG, "LoadData_QRURL --> onError");
return false;
}
});
video.start();
}
}
}
public void onPrepared(MediaPlayer mp)
{
}
public void onCompletion(MediaPlayer mp)
{
// this is needed to release the MediaPlayer and its resources so it can
// be used again later
videoView.stopPlayback();
// now remove the video and tell the callback to hide the custom view
frameLayout.removeView(videoView);
customViewCallback.onCustomViewHidden();
finish();
}
public boolean onError(MediaPlayer mp, int what, int extra)
{
return false; // we did not handle the error - onCompletion will be called
}
}
}
接下来是。 如何在安德森网上播放超文本5视频和YouTube视频?,如果我不录制录像,就象我拍摄安全照相机的录像。
webView.loadUrl("http://192.168.1.6/videostream.cgi?user=admin&pwd=");
我有一个白丝网。