0

I make app android to interact with USB OTG, I can read info all file in USB OTG, but i can not play video in USB OTG, but i can play video in SD. help me. Thanks All my code:

 fun openVideo(path: String){
    val viewIntent = Intent(Intent.ACTION_VIEW)
    val file = File(path)

    viewIntent.setDataAndType(
        FileProvider.getUriForFile(
            context,
            BuildConfig.APPLICATION_ID + ".provider",
            file
        ), "video/*"
    )
    viewIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
    context?.startActivity(Intent.createChooser(viewIntent, null))
}

0 Answers0