当前位置: 首页>>代码示例>>Java>>正文


Java MediaDescription类代码示例

本文整理汇总了Java中android.media.MediaDescription的典型用法代码示例。如果您正苦于以下问题:Java MediaDescription类的具体用法?Java MediaDescription怎么用?Java MediaDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MediaDescription类属于android.media包,在下文中一共展示了MediaDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFromMediaDesc

import android.media.MediaDescription; //导入依赖的package包/类
public Video buildFromMediaDesc(MediaDescription desc) {
    return new Video(
            Long.parseLong(desc.getMediaId()),
            "",
            "",
            "",
            String.valueOf(desc.getTitle()),
            String.valueOf(desc.getDescription()),
            "", // Media URI - not provided by MediaDescription.
            "", // Background Image URI - not provided by MediaDescription.
            String.valueOf(desc.getIconUri()),
            "",
            String.valueOf(desc.getSubtitle()),
            "",
            0,
            "",
            "",
            null,
            0,
            0,
            "",
            false,
            ""
    );
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:26,代码来源:Video.java

示例2: a

import android.media.MediaDescription; //导入依赖的package包/类
public static he a(Object paramObject)
{
  if ((paramObject == null) || (Build.VERSION.SDK_INT < 21)) {
    return null;
  }
  hg localhg = new hg();
  localhg.a = ((MediaDescription)paramObject).getMediaId();
  localhg.b = ((MediaDescription)paramObject).getTitle();
  localhg.c = ((MediaDescription)paramObject).getSubtitle();
  localhg.d = ((MediaDescription)paramObject).getDescription();
  localhg.e = ((MediaDescription)paramObject).getIconBitmap();
  localhg.f = ((MediaDescription)paramObject).getIconUri();
  localhg.g = ((MediaDescription)paramObject).getExtras();
  if (Build.VERSION.SDK_INT >= 23) {
    localhg.h = ((MediaDescription)paramObject).getMediaUri();
  }
  he localhe = localhg.a();
  localhe.i = paramObject;
  return localhe;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:he.java

示例3: getAlbumLists

import android.media.MediaDescription; //导入依赖的package包/类
private void getAlbumLists(Result<List<MediaBrowser.MediaItem>> result) {
	List<Integer> albums = new ArrayList<>();
	albums.add(R.string.main_albums_newest);
	albums.add(R.string.main_albums_random);

	if(!Util.isTagBrowsing(downloadService)) {
		albums.add(R.string.main_albums_highest);
	}
	albums.add(R.string.main_albums_starred);
	albums.add(R.string.main_albums_recent);
	albums.add(R.string.main_albums_frequent);

	List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();

	for(Integer id: albums) {
		MediaDescription description = new MediaDescription.Builder()
				.setTitle(downloadService.getResources().getString(id))
				.setMediaId(ALBUM_TYPE_PREFIX + id)
				.build();

		mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE));
	}

	result.sendResult(mediaItems);
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:26,代码来源:AutoMediaBrowserService.java

示例4: getLibrary

import android.media.MediaDescription; //导入依赖的package包/类
private void getLibrary(final Result<List<MediaBrowser.MediaItem>> result) {
	new SilentServiceTask<List<MusicFolder>>(downloadService) {
		@Override
		protected List<MusicFolder> doInBackground(MusicService musicService) throws Throwable {
			return musicService.getMusicFolders(false, downloadService, null);
		}

		@Override
		protected void done(List<MusicFolder> folders) {
			List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();

			for(MusicFolder folder: folders) {
				MediaDescription description = new MediaDescription.Builder()
						.setTitle(folder.getName())
						.setMediaId(MUSIC_FOLDER_PREFIX + folder.getId())
						.build();

				mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE));
			}

			result.sendResult(mediaItems);
		}
	}.execute();

	result.detach();
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:27,代码来源:AutoMediaBrowserService.java

示例5: getPlaylists

import android.media.MediaDescription; //导入依赖的package包/类
private void getPlaylists(final Result<List<MediaBrowser.MediaItem>> result) {
	new SilentServiceTask<List<Playlist>>(downloadService) {
		@Override
		protected List<Playlist> doInBackground(MusicService musicService) throws Throwable {
			return musicService.getPlaylists(false, downloadService, null);
		}

		@Override
		protected void done(List<Playlist> playlists) {
			List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();

			for(Playlist playlist: playlists) {
				MediaDescription description = new MediaDescription.Builder()
						.setTitle(playlist.getName())
						.setMediaId(PLAYLIST_PREFIX + playlist.getId())
						.build();

				mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE));
			}

			result.sendResult(mediaItems);
		}
	}.execute();

	result.detach();
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:27,代码来源:AutoMediaBrowserService.java

示例6: getPodcasts

import android.media.MediaDescription; //导入依赖的package包/类
private void getPodcasts(final Result<List<MediaBrowser.MediaItem>> result) {
	new SilentServiceTask<List<PodcastChannel>>(downloadService) {
		@Override
		protected List<PodcastChannel> doInBackground(MusicService musicService) throws Throwable {
			return musicService.getPodcastChannels(false, downloadService, null);
		}

		@Override
		protected void done(List<PodcastChannel> podcasts) {
			List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();

			for(PodcastChannel podcast: podcasts) {
				MediaDescription description = new MediaDescription.Builder()
						.setTitle(podcast.getName())
						.setMediaId(PODCAST_PREFIX + podcast.getId())
						.build();

				mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE));
			}

			result.sendResult(mediaItems);
		}
	}.execute();

	result.detach();
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:27,代码来源:AutoMediaBrowserService.java

示例7: updatePlaylist

import android.media.MediaDescription; //导入依赖的package包/类
@Override
public void updatePlaylist(List<DownloadFile> playlist) {
	List<MediaSession.QueueItem> queue = new ArrayList<>();

	for(DownloadFile file: playlist) {
		Entry entry = file.getSong();

		MediaDescription description = new MediaDescription.Builder()
				.setMediaId(entry.getId())
				.setTitle(entry.getTitle())
				.setSubtitle(entry.getAlbumDisplay())
				.build();
		MediaSession.QueueItem item = new MediaSession.QueueItem(description, entry.getId().hashCode());
		queue.add(item);
	}

	mediaSession.setQueue(queue);
	currentQueue = playlist;
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:20,代码来源:RemoteControlClientLP.java

示例8: generatePlayableMediaItem

import android.media.MediaDescription; //导入依赖的package包/类
private MediaBrowser.MediaItem generatePlayableMediaItem( Song song ) {
    if( song == null )
        return null;

    MediaDescription.Builder mediaDescriptionBuilder = new MediaDescription.Builder();
    mediaDescriptionBuilder.setMediaId( song.getuId() );

    if( !TextUtils.isEmpty( song.getTitle() ) )
        mediaDescriptionBuilder.setTitle( song.getTitle() );

    if( !TextUtils.isEmpty( song.getArtist() ) )
        mediaDescriptionBuilder.setSubtitle( song.getArtist() );

    if( !TextUtils.isEmpty( song.getThumbnailUrl() ) )
        mediaDescriptionBuilder.setIconUri( Uri.parse( song.getThumbnailUrl() ) );

    return new MediaBrowser.MediaItem( mediaDescriptionBuilder.build(), MediaBrowser.MediaItem.FLAG_PLAYABLE );
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:19,代码来源:AutoMediaBrowserService.java

示例9: buildQueueList

import android.media.MediaDescription; //导入依赖的package包/类
@DebugLog @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static List<MediaSession.QueueItem> buildQueueList(Context context, long[] songs) {
    List<MediaSession.QueueItem> list = new ArrayList<>(15);
    if (songs.length == 0) return list;
    final OrderPreservingCursor c = new OrderPreservingCursor(context, songs,
            MusicProvider.RECENTS_URI, Projections.RECENT_SONGS, "", null);
    c.moveToFirst();
    int ii=0;
    do {
        list.add(new MediaSession.QueueItem(
                new MediaDescription.Builder()
                    .setTitle(c.getString(c.getColumnIndex(MusicStore.Cols.NAME)))
                    .setSubtitle(c.getString(c.getColumnIndex(MusicStore.Cols.ARTIST_NAME)))
                    .setMediaId(c.getString(c.getColumnIndex(MusicStore.Cols.IDENTITY)))
                    .build(),
                songs[ii]
        ));
    } while (c.moveToNext() && ++ii<15);
    c.close();
    return list;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:22,代码来源:MusicProviderUtil.java

示例10: fillMediaItems

import android.media.MediaDescription; //导入依赖的package包/类
private void fillMediaItems(List<MediaBrowser.MediaItem> mediaItems, String mediaId, String title, Uri icon, String subTitle, int playableOrBrowsable) {
    mediaItems.add(new MediaBrowser.MediaItem(
            new MediaDescription.Builder()
                    .setMediaId(mediaId)
                    .setTitle(title)
                    .setIconUri(icon)
                    .setSubtitle(subTitle)
                    .build(), playableOrBrowsable
    ));
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:11,代码来源:WearBrowserService.java

示例11: buildFromMediaDesc

import android.media.MediaDescription; //导入依赖的package包/类
public Video buildFromMediaDesc(MediaDescription desc) {
    return new Video(
            Long.parseLong(desc.getMediaId()),
            "", // Category - not provided by MediaDescription.
            String.valueOf(desc.getTitle()),
            String.valueOf(desc.getDescription()),
            "", // Media URI - not provided by MediaDescription.
            "", // Background Image URI - not provided by MediaDescription.
            String.valueOf(desc.getIconUri()),
            String.valueOf(desc.getSubtitle())
    );
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:13,代码来源:Video.java

示例12: updateFromParams

import android.media.MediaDescription; //导入依赖的package包/类
private void updateFromParams(Intent intent) {
    if (intent != null) {
        MediaDescription description = intent.getParcelableExtra(
            MusicPlayerActivity.EXTRA_CURRENT_MEDIA_DESCRIPTION);
        if (description != null) {
            updateMediaDescription(description);
        }
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:10,代码来源:FullScreenPlayerActivity.java

示例13: updateMediaDescription

import android.media.MediaDescription; //导入依赖的package包/类
private void updateMediaDescription(MediaDescription description) {
    if (description == null) {
        return;
    }
    LogHelper.d(TAG, "updateMediaDescription called ");
    mLine1.setText(description.getTitle());
    mLine2.setText(description.getSubtitle());
    fetchImageAsync(description);
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:10,代码来源:FullScreenPlayerActivity.java

示例14: createContentIntent

import android.media.MediaDescription; //导入依赖的package包/类
private PendingIntent createContentIntent(MediaDescription description) {
    Intent openUI = new Intent(mService, MusicPlayerActivity.class);
    openUI.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    openUI.putExtra(MusicPlayerActivity.EXTRA_START_FULLSCREEN, true);
    if (description != null) {
        openUI.putExtra(MusicPlayerActivity.EXTRA_CURRENT_MEDIA_DESCRIPTION, description);
    }
    return PendingIntent.getActivity(mService, REQUEST_CODE, openUI,
            PendingIntent.FLAG_CANCEL_CURRENT);
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:11,代码来源:MediaNotificationManager.java

示例15: getMusicDirectory

import android.media.MediaDescription; //导入依赖的package包/类
private void getMusicDirectory(final Result<List<MediaBrowser.MediaItem>> result, final String musicDirectoryId) {
	new SilentServiceTask<MusicDirectory>(downloadService) {
		@Override
		protected MusicDirectory doInBackground(MusicService musicService) throws Throwable {
			return musicService.getMusicDirectory(musicDirectoryId, "", false, downloadService, null);
		}

		@Override
		protected void done(MusicDirectory directory) {
			List<MediaBrowser.MediaItem> mediaItems = new ArrayList<>();

			addPlayOptions(mediaItems, musicDirectoryId, Constants.INTENT_EXTRA_NAME_ID);

			for(Entry entry : directory.getChildren()) {
				MediaDescription description;
				if (entry.isDirectory()) {
					// browse deeper
					description = new MediaDescription.Builder()
							.setTitle(entry.getTitle())
							.setMediaId(MUSIC_DIRECTORY_CONTENTS_PREFIX + entry.getId())
							.build();
				} else {
					// playback options for a single item
					description = new MediaDescription.Builder()
							.setTitle(entry.getTitle())
							.setMediaId(MUSIC_DIRECTORY_PREFIX + entry.getId())
							.build();
				}

				mediaItems.add(new MediaBrowser.MediaItem(description, MediaBrowser.MediaItem.FLAG_BROWSABLE));
			}
			result.sendResult(mediaItems);
		}
	}.execute();

	result.detach();
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:38,代码来源:AutoMediaBrowserService.java


注:本文中的android.media.MediaDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。