Код: Выделить всё
private fun shareMediaItem(uri: Uri) {
try {
val shareIntent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_STREAM, uri)
putExtra(Intent.EXTRA_TITLE, "Share screen recording")
type = "video/mp4"
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.clipData = ClipData(null, arrayOf("video/mp4"), ClipData.Item(uri))
}
startActivity(Intent.createChooser(shareIntent, null))
} catch (e: Exception) {
Log.e("ShareMediaActivity", "Error sharing media item", e)
}
}

Подробнее здесь: https://stackoverflow.com/questions/786 ... eo-preview