Skip to content

Read embedded title tag instead of always using filename#734

Open
trustosas wants to merge 1 commit into
moneytoo:masterfrom
trustosas:master
Open

Read embedded title tag instead of always using filename#734
trustosas wants to merge 1 commit into
moneytoo:masterfrom
trustosas:master

Conversation

@trustosas

Copy link
Copy Markdown

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 the MediaItem, 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:

  • Stops forcing the filename into the MediaItem's title/displayTitle unless the title came from an external API caller (in which case that should still win).
  • Adds an onMediaMetadataChanged callback 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.

@trustosas

Copy link
Copy Markdown
Author

This makes this player the first mainstream player capable of scrobbling music videos properly too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant