Read embedded title tag instead of always using filename#734
Open
trustosas wants to merge 1 commit into
Open
Conversation
Author
|
This makes this player the first mainstream player capable of scrobbling music videos properly too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now the player always shows the filename as the title, even when a file has an actual embedded title tag. Artist tags get read fine, so this seemed like it should work the same way for title.
Turns out the issue is in
PlayerActivity.java. The code was force-setting the title to the filename on theMediaItem, which overrides whatever ExoPlayer would've pulled from the file's embedded metadata. Artist wasn't touched anywhere, so it passed through untouched and worked as expected.This PR:
MediaItem's title/displayTitle unless the title came from an external API caller (in which case that should still win).onMediaMetadataChangedcallback so the title bar updates once the file's actual tags are parsed, falling back to the filename if there's no title tag.Tested on a compiled debug build with files that have title tags and files that don't. Both cases work as expected.
One note: I'm not a Java developer, I worked through the specifics of this fix with AI assistance since I don't read Java. The change is small and I tested it on device, but flagging that up front in case it affects how you want to review it.