WebView open Videos in VideoView

0

I have two activity.xml, one of the webview and the other of the videoview, and two Activity.java, MainAcitivty and VideoActivity, Main, the default webview code to open a url, and in VideoAcitivty I made a scheme for when a url contains "FullScreen" open the video link in the videoview, but the code is not complete, I still have the command to get the webview url and go to the VideoActivity, to the command I created check the url if it contains the element 'FullScreen'.

My VideoActivity code:

        if (url.contains("FullScreen")) {

        try {
            url = url.replaceAll("", "");
        } catch (PatternSyntaxException ex) {
        } catch (IllegalArgumentException ex) {
        } catch (IndexOutOfBoundsException ex) {
        }

        setContentView(R.layout.activity_video);
        Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        intent2.setDataAndType(Uri.parse(url), "video/mp4");

        VideoView mVideoView = (VideoView) findViewById(R.id.videoView);
        mVideoView.setVideoURI(Uri.parse(url));
        mVideoView.setMediaController(new 
        MediaController(VideoActivity.this));
        mVideoView.requestFocus();
        mVideoView.start();

My code may contain unnecessary things, because it was a bump I made to try to see fullscreen video!

    
asked by anonymous 28.07.2018 / 19:15

0 answers