English 中文(简体)
无法在海底网目中播放html5的录像
原标题:Unable to play html5 streaming video in android web view

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=");

我有一个白丝网。

问题回答

https://gist.github.com/3718414“rel=“nofollow” 有一个信标包和超文本5视频——它不是简单地提及URL(如果你想要网上视频的话),而是在电离层和电离层上不难(确保你能够加速硬件,看来是关键)





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签