Rename MediaMetadata trackTitle and trackArtist to title and artist.

#minor-release

PiperOrigin-RevId: 372537414
This commit is contained in:
samrobinson 2021-05-07 13:30:39 +01:00 committed by bachinger
parent 09a8993b56
commit 2914e574e6
13 changed files with 59 additions and 71 deletions

View File

@ -42,21 +42,19 @@ import java.util.List;
samples.add( samples.add(
new MediaItem.Builder() new MediaItem.Builder()
.setUri("https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd") .setUri("https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd")
.setMediaMetadata( .setMediaMetadata(new MediaMetadata.Builder().setTitle("Clear DASH: Tears").build())
new MediaMetadata.Builder().setTrackTitle("Clear DASH: Tears").build())
.setMimeType(MIME_TYPE_DASH) .setMimeType(MIME_TYPE_DASH)
.build()); .build());
samples.add( samples.add(
new MediaItem.Builder() new MediaItem.Builder()
.setUri("https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8") .setUri("https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8")
.setMediaMetadata( .setMediaMetadata(new MediaMetadata.Builder().setTitle("Clear HLS: Angel one").build())
new MediaMetadata.Builder().setTrackTitle("Clear HLS: Angel one").build())
.setMimeType(MIME_TYPE_HLS) .setMimeType(MIME_TYPE_HLS)
.build()); .build());
samples.add( samples.add(
new MediaItem.Builder() new MediaItem.Builder()
.setUri("https://html5demos.com/assets/dizzy.mp4") .setUri("https://html5demos.com/assets/dizzy.mp4")
.setMediaMetadata(new MediaMetadata.Builder().setTrackTitle("Clear MP4: Dizzy").build()) .setMediaMetadata(new MediaMetadata.Builder().setTitle("Clear MP4: Dizzy").build())
.setMimeType(MIME_TYPE_VIDEO_MP4) .setMimeType(MIME_TYPE_VIDEO_MP4)
.build()); .build());
@ -65,7 +63,7 @@ import java.util.List;
new MediaItem.Builder() new MediaItem.Builder()
.setUri(Uri.parse("https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd")) .setUri(Uri.parse("https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd"))
.setMediaMetadata( .setMediaMetadata(
new MediaMetadata.Builder().setTrackTitle("Widevine DASH cenc: Tears").build()) new MediaMetadata.Builder().setTitle("Widevine DASH cenc: Tears").build())
.setMimeType(MIME_TYPE_DASH) .setMimeType(MIME_TYPE_DASH)
.setDrmUuid(C.WIDEVINE_UUID) .setDrmUuid(C.WIDEVINE_UUID)
.setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test") .setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test")
@ -74,7 +72,7 @@ import java.util.List;
new MediaItem.Builder() new MediaItem.Builder()
.setUri("https://storage.googleapis.com/wvmedia/cbc1/h264/tears/tears_aes_cbc1.mpd") .setUri("https://storage.googleapis.com/wvmedia/cbc1/h264/tears/tears_aes_cbc1.mpd")
.setMediaMetadata( .setMediaMetadata(
new MediaMetadata.Builder().setTrackTitle("Widevine DASH cbc1: Tears").build()) new MediaMetadata.Builder().setTitle("Widevine DASH cbc1: Tears").build())
.setMimeType(MIME_TYPE_DASH) .setMimeType(MIME_TYPE_DASH)
.setDrmUuid(C.WIDEVINE_UUID) .setDrmUuid(C.WIDEVINE_UUID)
.setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test") .setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test")
@ -83,7 +81,7 @@ import java.util.List;
new MediaItem.Builder() new MediaItem.Builder()
.setUri("https://storage.googleapis.com/wvmedia/cbcs/h264/tears/tears_aes_cbcs.mpd") .setUri("https://storage.googleapis.com/wvmedia/cbcs/h264/tears/tears_aes_cbcs.mpd")
.setMediaMetadata( .setMediaMetadata(
new MediaMetadata.Builder().setTrackTitle("Widevine DASH cbcs: Tears").build()) new MediaMetadata.Builder().setTitle("Widevine DASH cbcs: Tears").build())
.setMimeType(MIME_TYPE_DASH) .setMimeType(MIME_TYPE_DASH)
.setDrmUuid(C.WIDEVINE_UUID) .setDrmUuid(C.WIDEVINE_UUID)
.setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test") .setDrmLicenseUri("https://proxy.uat.widevine.com/proxy?provider=widevine_test")

View File

@ -213,7 +213,7 @@ public class MainActivity extends AppCompatActivity
holder.item = Assertions.checkNotNull(playerManager.getItem(position)); holder.item = Assertions.checkNotNull(playerManager.getItem(position));
TextView view = holder.textView; TextView view = holder.textView;
view.setText(holder.item.mediaMetadata.trackTitle); view.setText(holder.item.mediaMetadata.title);
// TODO: Solve coloring using the theme's ColorStateList. // TODO: Solve coloring using the theme's ColorStateList.
view.setTextColor( view.setTextColor(
ColorUtils.setAlphaComponent( ColorUtils.setAlphaComponent(
@ -309,7 +309,7 @@ public class MainActivity extends AppCompatActivity
@NonNull @NonNull
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View view = super.getView(position, convertView, parent); View view = super.getView(position, convertView, parent);
((TextView) view).setText(Util.castNonNull(getItem(position)).mediaMetadata.trackTitle); ((TextView) view).setText(Util.castNonNull(getItem(position)).mediaMetadata.title);
return view; return view;
} }
} }

View File

@ -364,7 +364,7 @@ public class DownloadTracker {
private DownloadRequest buildDownloadRequest() { private DownloadRequest buildDownloadRequest() {
return downloadHelper return downloadHelper
.getDownloadRequest( .getDownloadRequest(
Util.getUtf8Bytes(checkNotNull(mediaItem.mediaMetadata.trackTitle.toString()))) Util.getUtf8Bytes(checkNotNull(mediaItem.mediaMetadata.title.toString())))
.copyWithKeySetId(keySetId); .copyWithKeySetId(keySetId);
} }
} }

View File

@ -90,8 +90,8 @@ public class IntentUtil {
MediaItem mediaItem = mediaItems.get(0); MediaItem mediaItem = mediaItems.get(0);
MediaItem.PlaybackProperties playbackProperties = checkNotNull(mediaItem.playbackProperties); MediaItem.PlaybackProperties playbackProperties = checkNotNull(mediaItem.playbackProperties);
intent.setAction(ACTION_VIEW).setData(mediaItem.playbackProperties.uri); intent.setAction(ACTION_VIEW).setData(mediaItem.playbackProperties.uri);
if (mediaItem.mediaMetadata.trackTitle != null) { if (mediaItem.mediaMetadata.title != null) {
intent.putExtra(TITLE_EXTRA, mediaItem.mediaMetadata.trackTitle); intent.putExtra(TITLE_EXTRA, mediaItem.mediaMetadata.title);
} }
addPlaybackPropertiesToIntent(playbackProperties, intent, /* extrasKeySuffix= */ ""); addPlaybackPropertiesToIntent(playbackProperties, intent, /* extrasKeySuffix= */ "");
addClippingPropertiesToIntent( addClippingPropertiesToIntent(
@ -106,8 +106,8 @@ public class IntentUtil {
addPlaybackPropertiesToIntent(playbackProperties, intent, /* extrasKeySuffix= */ "_" + i); addPlaybackPropertiesToIntent(playbackProperties, intent, /* extrasKeySuffix= */ "_" + i);
addClippingPropertiesToIntent( addClippingPropertiesToIntent(
mediaItem.clippingProperties, intent, /* extrasKeySuffix= */ "_" + i); mediaItem.clippingProperties, intent, /* extrasKeySuffix= */ "_" + i);
if (mediaItem.mediaMetadata.trackTitle != null) { if (mediaItem.mediaMetadata.title != null) {
intent.putExtra(TITLE_EXTRA + ("_" + i), mediaItem.mediaMetadata.trackTitle); intent.putExtra(TITLE_EXTRA + ("_" + i), mediaItem.mediaMetadata.title);
} }
} }
} }
@ -121,7 +121,7 @@ public class IntentUtil {
new MediaItem.Builder() new MediaItem.Builder()
.setUri(uri) .setUri(uri)
.setMimeType(mimeType) .setMimeType(mimeType)
.setMediaMetadata(new MediaMetadata.Builder().setTrackTitle(title).build()) .setMediaMetadata(new MediaMetadata.Builder().setTitle(title).build())
.setAdTagUri(intent.getStringExtra(AD_TAG_URI_EXTRA + extrasKeySuffix)) .setAdTagUri(intent.getStringExtra(AD_TAG_URI_EXTRA + extrasKeySuffix))
.setSubtitles(createSubtitlesFromIntent(intent, extrasKeySuffix)) .setSubtitles(createSubtitlesFromIntent(intent, extrasKeySuffix))
.setClipStartPositionMs( .setClipStartPositionMs(

View File

@ -433,7 +433,7 @@ public class SampleChooserActivity extends AppCompatActivity
Util.getAdaptiveMimeTypeForContentType(Util.inferContentType(uri, extension)); Util.getAdaptiveMimeTypeForContentType(Util.inferContentType(uri, extension));
mediaItem mediaItem
.setUri(uri) .setUri(uri)
.setMediaMetadata(new MediaMetadata.Builder().setTrackTitle(title).build()) .setMediaMetadata(new MediaMetadata.Builder().setTitle(title).build())
.setMimeType(adaptiveMimeType); .setMimeType(adaptiveMimeType);
if (subtitleUri != null) { if (subtitleUri != null) {
MediaItem.Subtitle subtitle = MediaItem.Subtitle subtitle =

View File

@ -7,14 +7,14 @@ title: Retrieving metadata
The metadata of the media can be retrieved during playback in multiple ways. The The metadata of the media can be retrieved during playback in multiple ways. The
most straightforward is to listen for the most straightforward is to listen for the
`Player.EventListener#onMediaMetadataChanged` event; this will provide a `Player.EventListener#onMediaMetadataChanged` event; this will provide a
[`MediaMetadata`][] object for use, which has fields such as `trackTitle` and [`MediaMetadata`][] object for use, which has fields such as `title` and
`albumArtist`. Alternatively, calling `Player#getMediaMetadata` returns the same `albumArtist`. Alternatively, calling `Player#getMediaMetadata` returns the same
object. object.
~~~ ~~~
public void onMediaMetadataChanged(MediaMetadata mediaMetadata) { public void onMediaMetadataChanged(MediaMetadata mediaMetadata) {
if (mediaMetadata.trackTitle != null) { if (mediaMetadata.title != null) {
handleTrackTitle(mediaMetadata.trackTitle); handleTitle(mediaMetadata.title);
} }
} }

View File

@ -58,7 +58,7 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
} }
MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE); MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MOVIE);
if (item.mediaMetadata.title != null) { if (item.mediaMetadata.title != null) {
metadata.putString(MediaMetadata.KEY_TITLE, item.mediaMetadata.title); metadata.putString(MediaMetadata.KEY_TITLE, item.mediaMetadata.title.toString());
} }
MediaInfo mediaInfo = MediaInfo mediaInfo =
new MediaInfo.Builder(item.playbackProperties.uri.toString()) new MediaInfo.Builder(item.playbackProperties.uri.toString())

View File

@ -123,14 +123,14 @@ public class DefaultMediaItemConverter implements MediaItemConverter {
* MediaItem ExoPlayer MediaItem}. * MediaItem ExoPlayer MediaItem}.
*/ */
protected androidx.media2.common.MediaMetadata getMetadata(MediaItem exoPlayerMediaItem) { protected androidx.media2.common.MediaMetadata getMetadata(MediaItem exoPlayerMediaItem) {
@Nullable String title = exoPlayerMediaItem.mediaMetadata.title; @Nullable CharSequence title = exoPlayerMediaItem.mediaMetadata.title;
androidx.media2.common.MediaMetadata.Builder metadataBuilder = androidx.media2.common.MediaMetadata.Builder metadataBuilder =
new androidx.media2.common.MediaMetadata.Builder() new androidx.media2.common.MediaMetadata.Builder()
.putString(METADATA_KEY_MEDIA_ID, exoPlayerMediaItem.mediaId); .putString(METADATA_KEY_MEDIA_ID, exoPlayerMediaItem.mediaId);
if (title != null) { if (title != null) {
metadataBuilder.putString(METADATA_KEY_TITLE, title); metadataBuilder.putString(METADATA_KEY_TITLE, title.toString());
metadataBuilder.putString(METADATA_KEY_DISPLAY_TITLE, title); metadataBuilder.putString(METADATA_KEY_DISPLAY_TITLE, title.toString());
} }
return metadataBuilder.build(); return metadataBuilder.build();
} }

View File

@ -36,8 +36,8 @@ public final class MediaMetadata implements Bundleable {
/** A builder for {@link MediaMetadata} instances. */ /** A builder for {@link MediaMetadata} instances. */
public static final class Builder { public static final class Builder {
@Nullable private CharSequence trackTitle; @Nullable private CharSequence title;
@Nullable private CharSequence trackArtist; @Nullable private CharSequence artist;
@Nullable private CharSequence albumTitle; @Nullable private CharSequence albumTitle;
@Nullable private CharSequence albumArtist; @Nullable private CharSequence albumArtist;
@Nullable private CharSequence displayTitle; @Nullable private CharSequence displayTitle;
@ -50,32 +50,26 @@ public final class MediaMetadata implements Bundleable {
public Builder() {} public Builder() {}
private Builder(MediaMetadata mediaMetadata) { private Builder(MediaMetadata mediaMetadata) {
this.trackTitle = mediaMetadata.trackTitle; this.title = mediaMetadata.title;
this.trackArtist = mediaMetadata.trackArtist; this.artist = mediaMetadata.artist;
this.albumTitle = mediaMetadata.albumTitle; this.albumTitle = mediaMetadata.albumTitle;
this.albumArtist = mediaMetadata.albumArtist; this.albumArtist = mediaMetadata.albumArtist;
this.displayTitle = mediaMetadata.displayTitle; this.displayTitle = mediaMetadata.displayTitle;
this.subtitle = mediaMetadata.subtitle; this.subtitle = mediaMetadata.subtitle;
this.description = mediaMetadata.description;
this.mediaUri = mediaMetadata.mediaUri; this.mediaUri = mediaMetadata.mediaUri;
this.userRating = mediaMetadata.userRating; this.userRating = mediaMetadata.userRating;
this.overallRating = mediaMetadata.overallRating; this.overallRating = mediaMetadata.overallRating;
} }
/** @deprecated Use {@link #setTrackTitle(CharSequence)} instead. */
@Deprecated
public Builder setTitle(@Nullable String title) {
this.trackTitle = title;
return this;
}
/** Sets the optional track title. */ /** Sets the optional track title. */
public Builder setTrackTitle(@Nullable CharSequence trackTitle) { public Builder setTitle(@Nullable CharSequence title) {
this.trackTitle = trackTitle; this.title = title;
return this; return this;
} }
public Builder setTrackArtist(@Nullable CharSequence trackArtist) { public Builder setArtist(@Nullable CharSequence artist) {
this.trackArtist = trackArtist; this.artist = artist;
return this; return this;
} }
@ -166,11 +160,8 @@ public final class MediaMetadata implements Bundleable {
/** Empty {@link MediaMetadata}. */ /** Empty {@link MediaMetadata}. */
public static final MediaMetadata EMPTY = new MediaMetadata.Builder().build(); public static final MediaMetadata EMPTY = new MediaMetadata.Builder().build();
/** @deprecated Use {@link #trackTitle} instead. */ @Nullable public final CharSequence title;
@Deprecated @Nullable public final String title; @Nullable public final CharSequence artist;
@Nullable public final CharSequence trackTitle;
@Nullable public final CharSequence trackArtist;
@Nullable public final CharSequence albumTitle; @Nullable public final CharSequence albumTitle;
@Nullable public final CharSequence albumArtist; @Nullable public final CharSequence albumArtist;
@Nullable public final CharSequence displayTitle; @Nullable public final CharSequence displayTitle;
@ -181,9 +172,8 @@ public final class MediaMetadata implements Bundleable {
@Nullable public final Rating overallRating; @Nullable public final Rating overallRating;
private MediaMetadata(Builder builder) { private MediaMetadata(Builder builder) {
this.title = builder.trackTitle != null ? builder.trackTitle.toString() : null; this.title = builder.title;
this.trackTitle = builder.trackTitle; this.artist = builder.artist;
this.trackArtist = builder.trackArtist;
this.albumTitle = builder.albumTitle; this.albumTitle = builder.albumTitle;
this.albumArtist = builder.albumArtist; this.albumArtist = builder.albumArtist;
this.displayTitle = builder.displayTitle; this.displayTitle = builder.displayTitle;
@ -208,8 +198,8 @@ public final class MediaMetadata implements Bundleable {
return false; return false;
} }
MediaMetadata that = (MediaMetadata) obj; MediaMetadata that = (MediaMetadata) obj;
return Util.areEqual(trackTitle, that.trackTitle) return Util.areEqual(title, that.title)
&& Util.areEqual(trackArtist, that.trackArtist) && Util.areEqual(artist, that.artist)
&& Util.areEqual(albumTitle, that.albumTitle) && Util.areEqual(albumTitle, that.albumTitle)
&& Util.areEqual(albumArtist, that.albumArtist) && Util.areEqual(albumArtist, that.albumArtist)
&& Util.areEqual(displayTitle, that.displayTitle) && Util.areEqual(displayTitle, that.displayTitle)
@ -223,8 +213,8 @@ public final class MediaMetadata implements Bundleable {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode( return Objects.hashCode(
trackTitle, title,
trackArtist, artist,
albumTitle, albumTitle,
albumArtist, albumArtist,
displayTitle, displayTitle,
@ -240,8 +230,8 @@ public final class MediaMetadata implements Bundleable {
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({ @IntDef({
FIELD_TRACK_TITLE, FIELD_TITLE,
FIELD_TRACK_ARTIST, FIELD_ARTIST,
FIELD_ALBUM_TITLE, FIELD_ALBUM_TITLE,
FIELD_ALBUM_ARTIST, FIELD_ALBUM_ARTIST,
FIELD_DISPLAY_TITLE, FIELD_DISPLAY_TITLE,
@ -253,8 +243,8 @@ public final class MediaMetadata implements Bundleable {
}) })
private @interface FieldNumber {} private @interface FieldNumber {}
private static final int FIELD_TRACK_TITLE = 0; private static final int FIELD_TITLE = 0;
private static final int FIELD_TRACK_ARTIST = 1; private static final int FIELD_ARTIST = 1;
private static final int FIELD_ALBUM_TITLE = 2; private static final int FIELD_ALBUM_TITLE = 2;
private static final int FIELD_ALBUM_ARTIST = 3; private static final int FIELD_ALBUM_ARTIST = 3;
private static final int FIELD_DISPLAY_TITLE = 4; private static final int FIELD_DISPLAY_TITLE = 4;
@ -267,8 +257,8 @@ public final class MediaMetadata implements Bundleable {
@Override @Override
public Bundle toBundle() { public Bundle toBundle() {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putCharSequence(keyForField(FIELD_TRACK_TITLE), trackTitle); bundle.putCharSequence(keyForField(FIELD_TITLE), title);
bundle.putCharSequence(keyForField(FIELD_TRACK_ARTIST), trackArtist); bundle.putCharSequence(keyForField(FIELD_ARTIST), artist);
bundle.putCharSequence(keyForField(FIELD_ALBUM_TITLE), albumTitle); bundle.putCharSequence(keyForField(FIELD_ALBUM_TITLE), albumTitle);
bundle.putCharSequence(keyForField(FIELD_ALBUM_ARTIST), albumArtist); bundle.putCharSequence(keyForField(FIELD_ALBUM_ARTIST), albumArtist);
bundle.putCharSequence(keyForField(FIELD_DISPLAY_TITLE), displayTitle); bundle.putCharSequence(keyForField(FIELD_DISPLAY_TITLE), displayTitle);
@ -292,8 +282,8 @@ public final class MediaMetadata implements Bundleable {
private static MediaMetadata fromBundle(Bundle bundle) { private static MediaMetadata fromBundle(Bundle bundle) {
Builder builder = new Builder(); Builder builder = new Builder();
builder builder
.setTrackTitle(bundle.getCharSequence(keyForField(FIELD_TRACK_TITLE))) .setTitle(bundle.getCharSequence(keyForField(FIELD_TITLE)))
.setTrackArtist(bundle.getCharSequence(keyForField(FIELD_TRACK_ARTIST))) .setArtist(bundle.getCharSequence(keyForField(FIELD_ARTIST)))
.setAlbumTitle(bundle.getCharSequence(keyForField(FIELD_ALBUM_TITLE))) .setAlbumTitle(bundle.getCharSequence(keyForField(FIELD_ALBUM_TITLE)))
.setAlbumArtist(bundle.getCharSequence(keyForField(FIELD_ALBUM_ARTIST))) .setAlbumArtist(bundle.getCharSequence(keyForField(FIELD_ALBUM_ARTIST)))
.setDisplayTitle(bundle.getCharSequence(keyForField(FIELD_DISPLAY_TITLE))) .setDisplayTitle(bundle.getCharSequence(keyForField(FIELD_DISPLAY_TITLE)))

View File

@ -46,11 +46,11 @@ public final class TextInformationFrame extends Id3Frame {
switch (id) { switch (id) {
case "TT2": case "TT2":
case "TIT2": case "TIT2":
builder.setTrackTitle(value); builder.setTitle(value);
break; break;
case "TP1": case "TP1":
case "TPE1": case "TPE1":
builder.setTrackArtist(value); builder.setArtist(value);
break; break;
case "TP2": case "TP2":
case "TPE2": case "TPE2":

View File

@ -299,7 +299,7 @@ public class MediaItemTest {
@Test @Test
public void builderSetMediaMetadata_setsMetadata() { public void builderSetMediaMetadata_setsMetadata() {
MediaMetadata mediaMetadata = new MediaMetadata.Builder().setTrackTitle("title").build(); MediaMetadata mediaMetadata = new MediaMetadata.Builder().setTitle("title").build();
MediaItem mediaItem = MediaItem mediaItem =
new MediaItem.Builder().setUri(URI_STRING).setMediaMetadata(mediaMetadata).build(); new MediaItem.Builder().setUri(URI_STRING).setMediaMetadata(mediaMetadata).build();
@ -368,7 +368,7 @@ public class MediaItemTest {
.setDrmSessionForClearTypes(Collections.singletonList(C.TRACK_TYPE_AUDIO)) .setDrmSessionForClearTypes(Collections.singletonList(C.TRACK_TYPE_AUDIO))
.setDrmKeySetId(new byte[] {1, 2, 3}) .setDrmKeySetId(new byte[] {1, 2, 3})
.setMediaId("mediaId") .setMediaId("mediaId")
.setMediaMetadata(new MediaMetadata.Builder().setTrackTitle("title").build()) .setMediaMetadata(new MediaMetadata.Builder().setTitle("title").build())
.setMimeType(MimeTypes.APPLICATION_MP4) .setMimeType(MimeTypes.APPLICATION_MP4)
.setUri(URI_STRING) .setUri(URI_STRING)
.setStreamKeys(Collections.singletonList(new StreamKey(1, 0, 0))) .setStreamKeys(Collections.singletonList(new StreamKey(1, 0, 0)))
@ -404,7 +404,7 @@ public class MediaItemTest {
.setLiveMaxOffsetMs(4_444) .setLiveMaxOffsetMs(4_444)
.setLiveMinPlaybackSpeed(.9f) .setLiveMinPlaybackSpeed(.9f)
.setLiveMaxPlaybackSpeed(1.1f) .setLiveMaxPlaybackSpeed(1.1f)
.setMediaMetadata(new MediaMetadata.Builder().setTrackTitle("title").build()) .setMediaMetadata(new MediaMetadata.Builder().setTitle("title").build())
.setClipStartPositionMs(100) .setClipStartPositionMs(100)
.setClipEndPositionMs(1_000) .setClipEndPositionMs(1_000)
.setClipRelativeToDefaultPosition(true) .setClipRelativeToDefaultPosition(true)

View File

@ -31,21 +31,21 @@ public class MediaMetadataTest {
public void builder_minimal_correctDefaults() { public void builder_minimal_correctDefaults() {
MediaMetadata mediaMetadata = new MediaMetadata.Builder().build(); MediaMetadata mediaMetadata = new MediaMetadata.Builder().build();
assertThat(mediaMetadata.trackTitle).isNull(); assertThat(mediaMetadata.title).isNull();
} }
@Test @Test
public void builderSetsTrackTitle_setsTrackTitle() { public void builderSetTitle_setsTitle() {
String title = "title"; String title = "title";
MediaMetadata mediaMetadata = new MediaMetadata.Builder().setTrackTitle(title).build(); MediaMetadata mediaMetadata = new MediaMetadata.Builder().setTitle(title).build();
assertThat(mediaMetadata.trackTitle.toString()).isEqualTo(title); assertThat(mediaMetadata.title.toString()).isEqualTo(title);
} }
@Test @Test
public void roundTripViaBundle_yieldsEqualInstance() { public void roundTripViaBundle_yieldsEqualInstance() {
MediaMetadata mediaMetadata = new MediaMetadata.Builder().setTrackTitle("title").build(); MediaMetadata mediaMetadata = new MediaMetadata.Builder().setTitle("title").build();
assertThat(MediaMetadata.CREATOR.fromBundle(mediaMetadata.toBundle())).isEqualTo(mediaMetadata); assertThat(MediaMetadata.CREATOR.fromBundle(mediaMetadata.toBundle())).isEqualTo(mediaMetadata);
} }
@ -58,6 +58,6 @@ public class MediaMetadataTest {
MediaMetadata.Builder builder = MediaMetadata.EMPTY.buildUpon(); MediaMetadata.Builder builder = MediaMetadata.EMPTY.buildUpon();
entry.populateMediaMetadata(builder); entry.populateMediaMetadata(builder);
assertThat(builder.build().trackTitle.toString()).isEqualTo(title); assertThat(builder.build().title.toString()).isEqualTo(title);
} }
} }

View File

@ -56,7 +56,7 @@ public final class IcyInfo implements Metadata.Entry {
@Override @Override
public void populateMediaMetadata(MediaMetadata.Builder builder) { public void populateMediaMetadata(MediaMetadata.Builder builder) {
if (title != null) { if (title != null) {
builder.setTrackTitle(title); builder.setTitle(title);
} }
} }