本文介绍了Android电视-正在播放纸牌图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用android电视应用程序,但无法弄清楚如何更改正在播放视频时离开该应用程序时出现的正在播放的纸牌的图标.

I am currently working on a android tv app but cant figure out how to change the icon for the now playing card that appears when i navigate away from the app whilst playing a video.

链接显示我需要设置MediaMetadata. METADATA_KEY_DISPLAY_ICON_URI具有uri格式的字符串,但我不能正确设置该字符串的格式,或者由于某些其他原因而无法使用.

This link show that i need to set MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI with a uri formatted string but i either cant get the string formatted correctly or it does not work for some other reason.

当前我有这个字符串-

"android.resource://"+ getPackageName() + "/drawable/app_icon_new"

完整摘录

 final MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder();

    String title = video.getArtist().replace("_", " -");

    metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE, title);
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE,
            video.getTrack());
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_TITLE, title);
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_ARTIST, video.getArtist());

    String uri = "android.resource://"+ getPackageName() + "/drawable/app_icon_new";
    metadataBuilder.putString(MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI, uri);



    Glide.with(this)
        .load(Uri.parse(video.getThumbnailUrl()))
        .asBitmap()
        .into(new SimpleTarget<Bitmap>(500, 500) {
            @Override
            public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
                metadataBuilder.putBitmap(MediaMetadata.METADATA_KEY_ART, bitmap);
                mSession.setMetadata(metadataBuilder.build());
            }
        });

任何帮助将不胜感激.

推荐答案

实际上没有办法更改正在播放"图标,因为您可以在推荐卡中对其进行更改.我希望他们会在进一步的更新中解决此问题.

There is actually no way to change the Now Playing Icon as you can change it in the Recommendation Card.I hope that they'll fix this in a further update.

这篇关于Android电视-正在播放纸牌图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 10:13