I Am Trying To Play Video From Google Drive Using Shareable Link In Video View But Unable To Play What Is The Solution For This?
this is my code mVideoView = (VideoView) findViewById(R.id.videoview); VideoView videoView = findViewById(R.id.videoview); // videoPath='https://drive.google.com/open?id=1dXndP-Mj
Solution 1:
You have to edit the link. Use String functions to edit the text.
so videoPath=
like below:
https://drive.google.com/open?id=1dXndP-MjQL7USlP0EtaElx67mXujqCSX
becomes:
https://drive.google.com/uc?authuser=0&id=1dXndP-MjQL7USlP0EtaElx67mXujqCSX&export=download
Example code:
//# fix path
videoPath = videoPath.replace("open?", "uc?authuser=0&");
videoPath = videoPath + "&export=download";
//# try to playUriuri= Uri.parse(videoPath);
videoView.setVideoURI(uri);
MediaControllermediaController=newMediaController(this);
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
Post a Comment for "I Am Trying To Play Video From Google Drive Using Shareable Link In Video View But Unable To Play What Is The Solution For This?"