VLC Android Intent URI Issue

VLC for Android and Chrome OS specific usage questions
stardomains
Blank Cone
Blank Cone
Posts: 22
Joined: 16 Jun 2020 19:33

VLC Android Intent URI Issue

Postby stardomains » 02 Sep 2020 04:13

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);

Aza
Developer
Developer
Posts: 2127
Joined: 14 Mar 2019 10:04

Re: VLC Android Intent URI Issue

Postby Aza » 02 Sep 2020 07:18

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


Return to “VLC for Android and Chrome OS”

Who is online

Users browsing this forum: No registered users and 21 guests