android - Now Playing Card -
i need displaying playing card in recommendations row. read post in android developers site, did not me much.
i have service streams mp3 data without problems. added following code, there's no playing card...
@override public void oncreate() { log.i(tag, "oncreate called"); msession = new mediasession(this, "musicservice"); msession.setcallback(new mediasessioncallback()); msession.setflags(mediasession.flag_handles_media_buttons | mediasession.flag_handles_transport_controls); msession.setactive(true); } private class mediasessioncallback extends mediasession.callback { }
edit: added code meta-data:
@override public void oncreate() { log.i(tag, "oncreate called"); msession = new mediasession(this, "musicservice"); msession.setcallback(new mediasessioncallback()); msession.setflags(mediasession.flag_handles_media_buttons | mediasession.flag_handles_transport_controls); final mediametadata.builder metadatabuilder = new mediametadata.builder(); string title = "burak"; metadatabuilder.putstring(mediametadata.metadata_key_display_title, title); metadatabuilder.putstring(mediametadata.metadata_key_display_subtitle, "burak müzik"); metadatabuilder.putstring(mediametadata.metadata_key_display_icon_uri, "http://commondatastorage.googleapis.com/android-tv/sample%20videos/zeitgeist/zeitgeist%202010_%20year%20in%20review/card.jpg"); // , @ minimum title , artist legacy support metadatabuilder.putstring(mediametadata.metadata_key_title, title); metadatabuilder.putstring(mediametadata.metadata_key_artist, "bkd mobile"); msession.setmetadata(metadatabuilder.build()); msession.setactive(true); }
i need specify metadata current playing mp3 file via metadata.builder
class:
mediametadata.builder metadatabuilder = new mediametadata.builder(); metadatabuilder.putstring(mediametadata.metadata_key_display_title, "title"); metadatabuilder.putstring(mediametadata.metadata_key_display_subtitle, "subtitle"); metadatabuilder.putstring(mediametadata.metadata_key_display_icon_uri, "artwork"); msession.setmetadata(metadatabuilder.build());
Comments
Post a Comment