android.media.MediaMetadataEditor Java Examples

The following examples show how to use android.media.MediaMetadataEditor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MusicTile.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
@Override
public void onClientMetadataUpdate(RemoteController.MetadataEditor data) {
    mMetadata.trackTitle = data.getString(MediaMetadataRetriever.METADATA_KEY_TITLE,
            mMetadata.trackTitle);
    mMetadata.bitmap = data.getBitmap(MediaMetadataEditor.BITMAP_KEY_ARTWORK,
            mMetadata.bitmap);
    mClientIdLost = false;
    if ((mMetadata.trackTitle != null
            && !mMetadata.trackTitle.equals(mCurrentTrack))
        || (mMetadata.bitmap != null && !mMetadata.bitmap.sameAs(mCurrentBitmap))) {
        mCurrentTrack = mMetadata.trackTitle;
        mCurrentBitmap = mMetadata.bitmap;
        refreshState();
        if (DEBUG) log(getKey() + ": onClientMetadataUpdate");
    }
}
 
Example #2
Source File: MediaController2KitKat.java    From AcDisplay with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Updates {@link #mMetadata metadata} from given remote metadata class.
 * This also updates play state.
 *
 * @param data Object of metadata to update from, or {@code null} to clear local metadata.
 * @see #clearMetadata()
 */
private void updateMetadata(@Nullable RemoteController.MetadataEditor data) {
    if (data == null) {
        if (mMetadata.isEmpty()) return;
        mMetadata.clear();
    } else {
        mMetadata.title = data.getString(MediaMetadataRetriever.METADATA_KEY_TITLE, null);
        mMetadata.artist = data.getString(MediaMetadataRetriever.METADATA_KEY_ARTIST, null);
        mMetadata.album = data.getString(MediaMetadataRetriever.METADATA_KEY_ALBUM, null);
        mMetadata.duration = data.getLong(MediaMetadataRetriever.METADATA_KEY_DURATION, -1);
        mMetadata.bitmap = data.getBitmap(MediaMetadataEditor.BITMAP_KEY_ARTWORK, null);
        mMetadata.generateSubtitle();
    }

    notifyOnMetadataChanged();
}
 
Example #3
Source File: NotificationListenerService.java    From QuickLyric with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClientMetadataUpdate(RemoteController.MetadataEditor metadataEditor) {
    // isRemoteControllerPlaying = true;

    durationObject = metadataEditor.getObject(MediaMetadataRetriever.METADATA_KEY_DURATION, 1200); //allow it to pass if not present
    artist = metadataEditor.getString(MediaMetadataRetriever.METADATA_KEY_ARTIST,
            metadataEditor.getString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, ""));
    track = metadataEditor.getString(MediaMetadataRetriever.METADATA_KEY_TITLE, "");
    Bitmap artwork = metadataEditor.getBitmap(MediaMetadataEditor.BITMAP_KEY_ARTWORK, null);

    mediaControllerCallback.saveArtwork(this, artwork, artist, track);
}
 
Example #4
Source File: Metadata.java    From Noyze with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
public static int BITMAP_KEY_ARTWORK() {
    return ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) ?
        MediaMetadataEditor.BITMAP_KEY_ARTWORK : _BITMAP_KEY_ARTWORK);
}
 
Example #5
Source File: Metadata.java    From Noyze with Apache License 2.0 4 votes vote down vote up
public Metadata(MediaMetadataEditor editor) {
    bundle = new Bundle();
    bundle.putBoolean(TAG, true); // Leave our mark!
    initFromMetadata(editor);
}
 
Example #6
Source File: Metadata.java    From Noyze with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
public static int BITMAP_KEY_ARTWORK() {
    return ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) ?
        MediaMetadataEditor.BITMAP_KEY_ARTWORK : _BITMAP_KEY_ARTWORK);
}
 
Example #7
Source File: Metadata.java    From Noyze with Apache License 2.0 4 votes vote down vote up
public Metadata(MediaMetadataEditor editor) {
    bundle = new Bundle();
    bundle.putBoolean(TAG, true); // Leave our mark!
    initFromMetadata(editor);
}
 
Example #8
Source File: RemoteControlKitKat.java    From Noyze with Apache License 2.0 2 votes vote down vote up
/**
 * @return A {@link android.support.v4.media.MediaMetadataCompat} built from
 * a {@link android.media.MediaMetadataEditor} meant to bridge the two APIs.
 */
public static MediaMetadataCompat buildMediaMetadata(MediaMetadataEditor editor) {
    return mediaMetadata(editor).build();
}
 
Example #9
Source File: RemoteControlKitKat.java    From Noyze with Apache License 2.0 2 votes vote down vote up
/**
 * @return A {@link android.support.v4.media.MediaMetadataCompat} built from
 * a {@link android.media.MediaMetadataEditor} meant to bridge the two APIs.
 */
public static MediaMetadataCompat buildMediaMetadata(MediaMetadataEditor editor) {
    return mediaMetadata(editor).build();
}