use of com.google.android.exoplayer2.MediaMetadata in project ExoPlayer by google.
the class IcyHeadersTest method populateMediaMetadata.
@Test
public void populateMediaMetadata() {
IcyHeaders headers = new IcyHeaders(/* bitrate= */
1234, /* genre= */
"pop", /* name= */
"radio station", /* url= */
"url", /* isPublic= */
true, /* metadataInterval= */
5678);
MediaMetadata.Builder builder = new MediaMetadata.Builder();
headers.populateMediaMetadata(builder);
MediaMetadata mediaMetadata = builder.build();
assertThat(mediaMetadata.station.toString()).isEqualTo("radio station");
assertThat(mediaMetadata.genre.toString()).isEqualTo("pop");
}
use of com.google.android.exoplayer2.MediaMetadata in project ExoPlayer by google.
the class DefaultMediaItemConverter method getMediaItem.
// Deserialization.
private static MediaItem getMediaItem(JSONObject customData, com.google.android.exoplayer2.MediaMetadata mediaMetadata) {
try {
JSONObject mediaItemJson = customData.getJSONObject(KEY_MEDIA_ITEM);
MediaItem.Builder builder = new MediaItem.Builder().setUri(Uri.parse(mediaItemJson.getString(KEY_URI))).setMediaId(mediaItemJson.getString(KEY_MEDIA_ID)).setMediaMetadata(mediaMetadata);
if (mediaItemJson.has(KEY_MIME_TYPE)) {
builder.setMimeType(mediaItemJson.getString(KEY_MIME_TYPE));
}
if (mediaItemJson.has(KEY_DRM_CONFIGURATION)) {
populateDrmConfiguration(mediaItemJson.getJSONObject(KEY_DRM_CONFIGURATION), builder);
}
return builder.build();
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
use of com.google.android.exoplayer2.MediaMetadata in project Douya by DreaminginCodeZH.
the class MediaPlayback method createMediaSource.
private MediaSource createMediaSource() {
if (mMediaMetadatas.size() == 1) {
return mCreateMediaSource.apply(mMediaMetadatas.get(0));
}
MediaSource[] mediaSources = new MediaSource[mMediaMetadatas.size()];
for (int i = 0; i < mMediaMetadatas.size(); ++i) {
MediaMetadataCompat mediaMetadata = mMediaMetadatas.get(i);
mediaSources[i] = mCreateMediaSource.apply(mediaMetadata);
}
return new ConcatenatingMediaSource(mediaSources);
}
Aggregations