I am trying to share a video that is being created and stored on external sdcard whose path has been obtained by.
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()
I am using SEND_INTENT as follows:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
shareIntent.setType("video/mp4");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My Subject");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"My Text");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(video_path));
startActivityForResult(Intent.createChooser(shareIntent, "Share Your Video"),SHARE_INTENT);
Problem: While I share through gmail, it shows me compose window with video attached. But no size being shown of the video and when you either send or cancel the window, gmail will crash with inputstream NPE on contentresolver.
In case of youtube, it says you cannot upload videos from cloud service, my video clearly resides on the device.
In case of facebook, it is silently discarded. This works fine with wassup. :-)
Any ideas how to get this to work?
EDIT:
Video Path:
/storage/emulated/0/Movies/MyFolder/my-video_1378253389208.mp4
UPDATE
By adding file:///
suffix, gmail and facebook works fine.
Youtube is still cribbing about "Videos cannot be uploaded from cloud services".