Example usage for android.media MediaMetadataRetriever METADATA_KEY_ALBUMARTIST

List of usage examples for android.media MediaMetadataRetriever METADATA_KEY_ALBUMARTIST

Introduction

In this page you can find the example usage for android.media MediaMetadataRetriever METADATA_KEY_ALBUMARTIST.

Prototype

int METADATA_KEY_ALBUMARTIST

To view the source code for android.media MediaMetadataRetriever METADATA_KEY_ALBUMARTIST.

Click Source Link

Document

The metadata key to retrieve the information about the performers or artist associated with the data source.

Usage

From source file:com.firefly.sample.castcompanionlibrary.cast.VideoCastManager.java

private void updateLockScreenMetadata() {
    if (null == mRemoteControlClientCompat || !isFeatureEnabled(FEATURE_LOCKSCREEN)) {
        return;//from   ww  w .j  a  va2  s  .  c om
    }

    try {
        // Update the remote controls
        MediaInfo info = getRemoteMediaInformation();
        if (null == info) {
            return;
        }
        final MediaMetadata mm = info.getMetadata();

        mRemoteControlClientCompat.editMetadata(false)
                .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, mm.getString(MediaMetadata.KEY_TITLE))
                .putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST,
                        mContext.getResources().getString(R.string.casting_to_device, getDeviceName()))
                .putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, info.getStreamDuration()).apply();
    } catch (NotFoundException e) {
        LOGE(TAG, "Failed to update RCC due to resource not found", e);
    } catch (TransientNetworkDisconnectionException e) {
        LOGE(TAG, "Failed to update RCC due to network issues", e);
    } catch (NoConnectionException e) {
        LOGE(TAG, "Failed to update RCC due to network issues", e);
    }
}

From source file:air.com.snagfilms.cast.chromecast.VideoChromeCastManager.java

private void updateLockScreenMetadata() {
    if (null == mRemoteControlClientCompat || !isFeatureEnabled(FEATURE_LOCKSCREEN)) {
        return;//from  w  ww . j  a  v a  2  s .co  m
    }

    try {
        // Update the remote controls
        MediaInfo info = getRemoteMediaInformation();
        if (null == info) {
            return;
        }
        final MediaMetadata mm = info.getMetadata();

        mRemoteControlClientCompat.editMetadata(false)
                .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, mm.getString(MediaMetadata.KEY_TITLE))
                .putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST,
                        mContext.getResources().getString(R.string.casting_to_device, getDeviceName()))
                .putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, info.getStreamDuration()).apply();
    } catch (NotFoundException e) {
        Log.e(TAG, "Failed to update RCC due to resource not found", e);
    } catch (TransientNetworkDisconnectionException e) {
        Log.e(TAG, "Failed to update RCC due to network issues", e);
    } catch (NoConnectionException e) {
        Log.e(TAG, "Failed to update RCC due to network issues", e);
    }
}

From source file:com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.java

private void updateLockScreenMetadata() {
    if ((mRemoteControlClientCompat == null) || !isFeatureEnabled(FEATURE_LOCKSCREEN)) {
        return;/*  w  w  w .j a v a  2 s. c  om*/
    }

    try {
        // Update the remote controls
        MediaInfo info = getRemoteMediaInformation();
        if (info == null) {
            return;
        }
        final MediaMetadata mm = info.getMetadata();

        mRemoteControlClientCompat.editMetadata(false)
                .putString(MediaMetadataRetriever.METADATA_KEY_TITLE, mm.getString(MediaMetadata.KEY_TITLE))
                .putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST,
                        mContext.getResources().getString(R.string.ccl_casting_to_device, getDeviceName()))
                .putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, info.getStreamDuration()).apply();
    } catch (NotFoundException e) {
        LOGE(TAG, "Failed to update RCC due to resource not found", e);
    } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
        LOGE(TAG, "Failed to update RCC due to network issues", e);
    }
}