Page 1 of 1

VLC Android Intent URI Issue

Posted: 02 Sep 2020 04:13
by stardomains
Something is off with Intents.

if I do:

Code: Select all

Uri urit = Uri.parse("file:///storage/emulated/0/Music/somemusicfile.mp3"); Intent vlcIntent = new Intent(Intent.ACTION_VIEW); vlcIntent.setPackage("org.videolan.vlc.debug"); vlcIntent.setDataAndTypeAndNormalize(urit, "audio/*"); vlcIntent.putExtra("from_start", true); startActivity(vlcIntent);
it won't work at all.

But if "file:///storage/emulated/0/Music/somemusicfile.mp3" is in an EditText it will play:

Code: Select all

Uri urit = Uri.parse(uritext.getText().toString()); Intent vlcIntent = new Intent(Intent.ACTION_VIEW); vlcIntent.setPackage("org.videolan.vlc.debug"); vlcIntent.setDataAndTypeAndNormalize(urit, "audio/*"); vlcIntent.putExtra("from_start", true); startActivity(vlcIntent);

Re: VLC Android Intent URI Issue

Posted: 02 Sep 2020 07:18
by Aza
Not sure how you do that as sending a path starting with

Code: Select all

file:///
should throw a

Code: Select all

FileUriExposedException
and crash your app.

See: https://stackoverflow.com/questions/382 ... xt-exposed