Click here to Skip to main content
15,560,045 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have some videos in google drive and I want to stream them in videoview.
I have set everything, but when I debug the app, I get an error saying can't play this video.
Can someone please help me fix this issue?
Thanks.

What I have tried:

import android.app.ProgressDialog;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;

import androidx.appcompat.widget.Toolbar;

public class video extends base  {
    private Toolbar mtoolbar;
    private String[] videoArray;
    private VideoView video;
    private String video_url="https://drive.google.com/open?id=1ThYBj7gG3cwSxYvpbcq-Bu44ezXrn6CK";
    private ProgressDialog pd;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);
        setTitle("Videos");
        mtoolbar = (androidx.appcompat.widget.Toolbar) findViewById(R.id.toolbar);
        //video = findViewById(R.id.video);
        video=findViewById(R.id.video);
        pd=new ProgressDialog(video.this);
        pd.setMessage("Cargando video, por favor espere");
        pd.show();
        Uri uri= Uri.parse(video_url);
        video.setVideoURI(uri);
        video.start();
        video.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                pd.dismiss();
            }
        });
    }
}
Posted
Updated 12-Mar-21 1:35am
Comments
David Crow 18-Mar-20 12:32pm    
I think you'll find that a FileNotFoundException is being thrown. Can you confirm?

1 solution

this demo it not working i try to same code but not open in drive video url so help me
 
Share this answer
 
Comments
Richard Deeming 12-Mar-21 7:08am    
Your problem is not a "solution" to someone else's question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900