I need to share the URL of the video (not from YouTube) through a third-party application such as Youtube, Gmail, etc. I have a link to a .mp4 or .m3u8 file on my server and I display it on video ads successfully, but I also have a share button for the same activity that I would like to pass as a link through ACTION_SEND.
I tested:
Intent share = new Intent(Intent.ACTION_SEND); share.setType("text/plain"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse(mVideoUrl)); startActivity(Intent.createChooser(share, "Share Video"));
And it launches the general selection, but I can’t share it on Youtube, since they expect to get the type of video, not the link. Also, sharing a link is a bad option as it does not view it as the video that it ever was.
If I use this:
Intent share = new Intent(Intent.ACTION_SEND); share.setType("video/*"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse(filePath)); startActivity(Intent.createChooser(share, "Share Video"));
As long as FilePath is an absolute path for a video file stored in external storage, it really supports real video file on YouTube, Gmail, Facebook, etc.
But my problem is that I can have a video file size of more than 300 MB, so downloading a file to the device and then sharing can take up a lot of memory, and, of course, downloading the file takes some serious time.
So, is there a way to share the link and let the third-party application view it as a video and embed it in your application, or my only options are to upload the video, save it in memory and then share (which is worse) or share it as a text link?
Is there another option that I don’t know to stream video through YouTube, Gmail, etc., without downloading a real file to the device?