从我的应用程序在 whatsapp 上分享视频

share video on whatsapp from my app

我想分享视频,我有 link 个视频,当用户想要分享该视频时,它已下载到应用程序中,
现在视频不在 whatsapp 上共享我现在不知道如何,这是我的代码
我试过但没有用。

 Intent videoshare = new Intent(Intent.ACTION_SEND);
    videoshare.setType("*/*");


    videoshare.putExtra(Intent.EXTRA_STREAM, Uri.parse(Environment.DIRECTORY_DOWNLOADS+"/"+title));

        videoshare.setPackage("com.whatsapp");
        startActivity(Intent.createChooser(videoshare, "Share video")); 
public void shareVideo(String pkgname, String appname) {
  String path = null;
  try {
    path = MediaStore.Images.Media.insertImage(getContentResolver(),
    arrImagePath.get(slidePager.getCurrentItem()), "Title", null);
  } catch (FileNotFoundException e1) {
    e1.printStackTrace();
  }
  Uri uri = Uri.parse(path);
  Intent share = new Intent(Intent.ACTION_SEND);
  share.setPackage(pkgname);
  share.putExtra(Intent.EXTRA_STREAM, uri);
  share.setType("Video/*");
  share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  startActivity(Intent.createChooser(share, "Share image File");
}

shareVideo("com.whatsapp", "Whatsapp");

我终于找到解决办法了

public void shareVideoWhatsApp() {


        Uri uri = Uri.fromFile(v);
        Intent videoshare = new Intent(Intent.ACTION_SEND);
        videoshare.setType("*/*");
        videoshare.setPackage("com.whatsapp");
        videoshare.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        videoshare.putExtra(Intent.EXTRA_STREAM,uri);

        startActivity(videoshare);

    }