Search in sources :

Example 6 with MediaMetadata

use of com.sonos.services._1.MediaMetadata in project Signal-Android by signalapp.

the class VoiceNotePlaybackPreparer method indexAfter.

private int indexAfter(@NonNull MediaItem target) {
    int size = player.getMediaItemCount();
    long targetMessageId = target.mediaMetadata.extras.getLong(VoiceNoteMediaItemFactory.EXTRA_MESSAGE_ID);
    for (int i = 0; i < size; i++) {
        MediaMetadata mediaMetadata = player.getMediaItemAt(i).mediaMetadata;
        long messageId = mediaMetadata.extras.getLong(VoiceNoteMediaItemFactory.EXTRA_MESSAGE_ID);
        if (messageId > targetMessageId) {
            return i;
        }
    }
    return size;
}
Also used : MediaMetadata(com.google.android.exoplayer2.MediaMetadata)

Example 7 with MediaMetadata

use of com.sonos.services._1.MediaMetadata in project mollyim-android by mollyim.

the class VoiceNotePlaybackPreparer method indexAfter.

private int indexAfter(@NonNull MediaItem target) {
    int size = player.getMediaItemCount();
    long targetMessageId = target.mediaMetadata.extras.getLong(VoiceNoteMediaItemFactory.EXTRA_MESSAGE_ID);
    for (int i = 0; i < size; i++) {
        MediaMetadata mediaMetadata = player.getMediaItemAt(i).mediaMetadata;
        long messageId = mediaMetadata.extras.getLong(VoiceNoteMediaItemFactory.EXTRA_MESSAGE_ID);
        if (messageId > targetMessageId) {
            return i;
        }
    }
    return size;
}
Also used : MediaMetadata(com.google.android.exoplayer2.MediaMetadata)

Example 8 with MediaMetadata

use of com.sonos.services._1.MediaMetadata in project SonosOneDriveServer by bertique.

the class SonosService method buildMMD.

private static MediaMetadata buildMMD(Item m) {
    MediaMetadata mmd = new MediaMetadata();
    TrackMetadata tmd = new TrackMetadata();
    if (m == null)
        return null;
    mmd.setId(m.getId());
    if (m.getType().equals(Item.FileType.file) && m.getName().endsWith(".flac")) {
        mmd.setMimeType("audio/flac");
    } else if (m.getMimeType().endsWith("wma")) {
        mmd.setMimeType("audio/wma");
    } else {
        mmd.setMimeType(m.getMimeType());
    }
    mmd.setItemType(ItemType.TRACK);
    mmd.setDisplayType("audio");
    if (m.getTitle() != null && !m.getTitle().isEmpty()) {
        mmd.setTitle(m.getTitle());
    } else {
        mmd.setTitle(m.getName());
    }
    if (m.getArtist() != null) {
        tmd.setArtist(m.getArtist());
    }
    if (m.getAlbum() != null) {
        tmd.setAlbum(m.getAlbum());
    }
    if (m.getDuration() > 0) {
        tmd.setDuration(m.getDuration());
    }
    if (m.getThumbnail() != null) {
        AlbumArtUrl art = new AlbumArtUrl();
        art.setValue(m.getThumbnail());
        tmd.setAlbumArtURI(art);
    }
    tmd.setTrackNumber(m.getTrack());
    mmd.setTrackMetadata(tmd);
    return mmd;
}
Also used : TrackMetadata(com.sonos.services._1.TrackMetadata) MediaMetadata(com.sonos.services._1.MediaMetadata) GetMediaMetadata(com.sonos.services._1.GetMediaMetadata) AlbumArtUrl(com.sonos.services._1.AlbumArtUrl)

Example 9 with MediaMetadata

use of com.sonos.services._1.MediaMetadata in project ExoPlayer by google.

the class PictureFrameTest method populateMediaMetadata_setsBuilderValues.

@Test
public void populateMediaMetadata_setsBuilderValues() {
    byte[] pictureData = new byte[] { -12, 52, 33, 85, 34, 22, 1, -55 };
    Metadata.Entry entry = new PictureFrame(/* pictureType= */
    MediaMetadata.PICTURE_TYPE_FRONT_COVER, /* mimeType= */
    MimeTypes.IMAGE_JPEG, /* description= */
    "an image", /* width= */
    4, /* height= */
    2, /* depth= */
    1, /* colors= */
    1, pictureData);
    MediaMetadata.Builder builder = MediaMetadata.EMPTY.buildUpon();
    entry.populateMediaMetadata(builder);
    MediaMetadata mediaMetadata = builder.build();
    assertThat(mediaMetadata.artworkData).isEqualTo(pictureData);
    assertThat(mediaMetadata.artworkDataType).isEqualTo(MediaMetadata.PICTURE_TYPE_FRONT_COVER);
}
Also used : MediaMetadata(com.google.android.exoplayer2.MediaMetadata) Metadata(com.google.android.exoplayer2.metadata.Metadata) MediaMetadata(com.google.android.exoplayer2.MediaMetadata) Test(org.junit.Test)

Example 10 with MediaMetadata

use of com.sonos.services._1.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");
}
Also used : MediaMetadata(com.google.android.exoplayer2.MediaMetadata) Test(org.junit.Test)

Aggregations

MediaMetadata (com.google.android.exoplayer2.MediaMetadata)9 Test (org.junit.Test)6 Metadata (com.google.android.exoplayer2.metadata.Metadata)4 PendingIntent (android.app.PendingIntent)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Player (com.google.android.exoplayer2.Player)1 AlbumArtUrl (com.sonos.services._1.AlbumArtUrl)1 GetMediaMetadata (com.sonos.services._1.GetMediaMetadata)1 MediaMetadata (com.sonos.services._1.MediaMetadata)1 TrackMetadata (com.sonos.services._1.TrackMetadata)1