Skip to content

Commit

Permalink
PlayUtils: revert to passing subs via http proxy to 3rd party externa…
Browse files Browse the repository at this point in the history
…l players

See nova-video-player/aos-AVP#1177 (comment)

note that it may cause some encoding interpretation issues (not in french though)
  • Loading branch information
courville committed May 9, 2024
1 parent 3f9415b commit f7b659f
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/main/java/com/archos/mediacenter/video/utils/PlayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
public class PlayUtils implements IndexHelper.Listener {
private static final Logger log = LoggerFactory.getLogger(PlayUtils.class);

// pass subs with http proxy to 3rd party players
private static final boolean EXTERNAL_PLAYER_HTTP_SUBS = true;

private IndexHelper mIndexHelper;
private VideoDbInfo mVideoDbInfo;
private int mResume;
Expand Down Expand Up @@ -335,12 +338,29 @@ private void onResumeReady(Context context, Video video, final String mimeType,
// find first external subtitle file and pass it to vlc
while (n < listOfSubtitles.size()) {
subPath = listOfSubtitles.get(n);
subFile = new File(subPath);
subUri = FileProvider.getUriForFile(context, "org.courville.nova.provider", subFile);
MxSubFileList.add(subPath);
subLanguage = SubtitleManager.getSubLanguageFromSubPath(context, subPath);
MxSubPaths.add(subUri);
MxSubNameList.add(subLanguage);
MxSubFileList.add(subPath);
if (EXTERNAL_PLAYER_HTTP_SUBS) {
subUri = Uri.parse(subPath); // these files are in local nova cache not accessible from 3rd party players
try {
StreamOverHttp stream = new StreamOverHttp(subUri, mimeType);
dataUri = stream.getUri(subUri.getLastPathSegment());
// vlc
if (!subFound) intent.putExtra("subtitles_location", dataUri);
subFound = true;
// mxplayer/justplayer
MxSubPaths.add(dataUri);
log.debug("onResumeReady: adding external subtitle " + dataUri);
} catch (IOException e) {
log.error("onResumeReady: failed to start " + subUri + e);
}
} else {
// TODO FIXME passing file to 3rd party player is not working
subFile = new File(subPath);
subUri = FileProvider.getUriForFile(context, "org.courville.nova.provider", subFile);
MxSubPaths.add(subUri);
}
log.debug("onResumeReady: subPath " + subPath + " -> subUri " + subUri + "-> subLanguage " + subLanguage);
n++;
}
Expand Down

0 comments on commit f7b659f

Please sign in to comment.