Commit d1703ad6 by ibaker Committed by Oliver Woodman

Ensure the demo app requests local-file permissions for subtitle files

Currently we only do this for the main sample URI, not for subtitles.
So pairing a web-based video file with a local subtitle file on a fresh
install just throws a 'permission denied' exception.

PiperOrigin-RevId: 290794091
parent b59a1b89
......@@ -432,6 +432,11 @@ public class PlayerActivity extends AppCompatActivity
mediaSources[i] = createLeafMediaSource(samples[i]);
Sample.SubtitleInfo subtitleInfo = samples[i].subtitleInfo;
if (subtitleInfo != null) {
if (Util.maybeRequestReadExternalStoragePermission(
/* activity= */ this, subtitleInfo.uri)) {
// The player will be reinitialized if the permission is granted.
return Collections.emptyList();
}
Format subtitleFormat =
Format.createTextSampleFormat(
/* id= */ null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment