List of usage examples for android.media MediaDescription getMediaId
public @Nullable String getMediaId()
From source file:org.opensilk.video.data.DataService.java
/** * This observable never completes//from w w w. jav a 2s . c o m */ public Observable<MediaBrowser.MediaItem> getMediaItem(final MediaDescription description) { final Uri mediaUri = MediaDescriptionUtil.getMediaUri(description); final MediaMetaExtras metaExtras = MediaMetaExtras.from(description); Observable<MediaBrowser.MediaItem> observable; if (mediaUri == null) { if (metaExtras.isTvSeries()) { observable = getTvSeriesInternal(description.getMediaId()); } else { observable = Observable .error(new Exception("Unimplemented mediaType=" + metaExtras.getMediaType())); } } else { //TODO the lookup causes a notify which results in a second (redundant) emission observable = getMediaInternal(mediaUri).flatMap(item -> { MediaMetaExtras extas = MediaMetaExtras.from(item); if (!item.isPlayable() || extas.isIndexed()) { return Observable.just(item); } return Observable.<MediaBrowser.MediaItem, ScannerService.Connection>using(() -> { try { return ScannerService.bindService(mAppContext); } catch (InterruptedException e) { throw Exceptions.propagate(e); } }, connection -> { return connection.getClient().scan(item); }, connection -> { connection.close(); }); }); } return observable.subscribeOn(sSubscribeOn).observeOn(sObserveOn); }
From source file:org.opensilk.video.data.MediaDescriptionUtil.java
public static MediaDescription.Builder newBuilder(MediaDescription description) { MediaDescription.Builder bob = new MediaDescription.Builder().setIconUri(description.getIconUri()) .setMediaId(description.getMediaId()).setExtras(description.getExtras()) .setSubtitle(description.getSubtitle()).setTitle(description.getTitle()) .setDescription(description.getDescription()); if (VersionUtils.hasApi23()) { bob.setMediaUri(description.getMediaUri()); }/* www.java 2 s . c o m*/ return bob; }
From source file:org.opensilk.video.data.MediaDescriptionUtil.java
public static String toString(MediaDescription description) { return new ToStringBuilder(description).append("title", description.getTitle()) .append("mediaId", description.getMediaId()).append("mediaUri", getMediaUri(description)) .append("mediaTitle", getMediaTitle(description)).build(); }