• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MediaRouteDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: broadcastDescriptor

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
private void broadcastDescriptor() {
	// Create intents
	IntentFilter routeIntentFilter = new IntentFilter();
	routeIntentFilter.addCategory(CATEGORY_JUKEBOX_ROUTE);
	routeIntentFilter.addAction(MediaControlIntent.ACTION_START_SESSION);
	routeIntentFilter.addAction(MediaControlIntent.ACTION_GET_SESSION_STATUS);
	routeIntentFilter.addAction(MediaControlIntent.ACTION_END_SESSION);

	// Create route descriptor
	MediaRouteDescriptor.Builder routeBuilder = new MediaRouteDescriptor.Builder("Jukebox Route", "Subsonic Jukebox");
	routeBuilder.addControlFilter(routeIntentFilter)
			.setPlaybackStream(AudioManager.STREAM_MUSIC)
			.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
			.setDescription("Subsonic Jukebox")
			.setVolume(controller == null ? 5 : (int) (controller.getVolume() * 10))
			.setVolumeMax(MAX_VOLUME)
			.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE);

	// Create descriptor
	MediaRouteProviderDescriptor.Builder providerBuilder = new MediaRouteProviderDescriptor.Builder();
	providerBuilder.addRoute(routeBuilder.build());
	setDescriptor(providerBuilder.build());
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:24,代码来源:JukeboxRouteProvider.java


示例2: Provider

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
public Provider(Context context) {
	super(context);

	String routeName = context.getString(R.string.local_device);
	if (context.getPackageName().endsWith(".debug")) {
		routeName = routeName + " (" + context.getString(R.string.debug) + ")";
	}
	MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder(
			ROUTE_ID, routeName)
			.addControlFilters(CONTROL_FILTERS)
			.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
			.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
			.setVolume(mAudio.getStreamMaxVolume(AudioManager.STREAM_MUSIC))
			.build();


	MediaRouteProviderDescriptor providerDescriptor =
			new MediaRouteProviderDescriptor.Builder()
			.addRoute(routeDescriptor)
			.build();
	setDescriptor(providerDescriptor);
}
 
开发者ID:Nutomic,项目名称:controldlna,代码行数:23,代码来源:Provider.java


示例3: updateRoutes

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
private void updateRoutes() {
	Builder builder = new Builder();
	for (Entry<String, Device> d : mDevices.entrySet()) {
		MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder(
						d.getValue().id, d.getValue().name)
				.setDescription(d.getValue().description)
				.addControlFilters(CONTROL_FILTERS)
				.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
				.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
				.setVolumeMax(d.getValue().volumeMax)
				.setVolume(d.getValue().volume)
				.build();
		builder.addRoute(routeDescriptor);
	}
	setDescriptor(builder.build());
}
 
开发者ID:Nutomic,项目名称:controldlna,代码行数:17,代码来源:Provider.java


示例4: onDeviceAdded

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
@Override
public void onDeviceAdded(DialDevice dd) {
    Bundle bundledDevice = new Bundle();
    MediaRouteDevice device = new MediaRouteDevice(dd);
    bundledDevice.putParcelable(MediaRouteDevice.EXTRA_DEVICE,device);
    Uri uri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
            .authority(getContext().getPackageName())
            .build();
    MediaRouteDescriptor routeDescriptor = new MediaRouteDescriptor.Builder(
            dd.getUuid(),
            dd.getFriendlyName())
            .setDescription(dd.getModelName())
            .setIconUri(uri)
            .addControlFilters(mCategoryIntentFilterList)
            .setExtras(bundledDevice)
            .build();
    mRoutes.put(dd.getUuid(),routeDescriptor);
    publishRoutes();
}
 
开发者ID:Orange-OpenSource,项目名称:OCast-Java,代码行数:20,代码来源:OCastMediaRouteProvider.java


示例5: publishRoutes

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
private void publishRoutes() {
    final MediaRouteProviderDescriptor.Builder providerDescriptorBuilder = new MediaRouteProviderDescriptor.Builder();
    for(MediaRouteDescriptor d: mRoutes.values()) {
        providerDescriptorBuilder.addRoute(d);
    }
    final MediaRouteProviderDescriptor providerDescriptor = providerDescriptorBuilder.build();
    mHandler.post(new Runnable() {
        @Override
        public void run() {
            setDescriptor(providerDescriptor);
        }
    });
}
 
开发者ID:Orange-OpenSource,项目名称:OCast-Java,代码行数:14,代码来源:OCastMediaRouteProvider.java


示例6: type

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
public static SubjectFactory<MediaRouteDescriptorSubject, MediaRouteDescriptor> type() {
  return new SubjectFactory<MediaRouteDescriptorSubject, MediaRouteDescriptor>() {
    @Override
    public MediaRouteDescriptorSubject getSubject(FailureStrategy fs, MediaRouteDescriptor that) {
      return new MediaRouteDescriptorSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:MediaRouteDescriptorSubject.java


示例7: broadcastDescriptors

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
private void broadcastDescriptors() {
	// Create intents
	IntentFilter routeIntentFilter = new IntentFilter();
	routeIntentFilter.addCategory(CATEGORY_DLNA);
	routeIntentFilter.addAction(MediaControlIntent.ACTION_START_SESSION);
	routeIntentFilter.addAction(MediaControlIntent.ACTION_GET_SESSION_STATUS);
	routeIntentFilter.addAction(MediaControlIntent.ACTION_END_SESSION);

	// Create descriptor
	MediaRouteProviderDescriptor.Builder providerBuilder = new MediaRouteProviderDescriptor.Builder();

	// Create route descriptor
	for(Map.Entry<String, DLNADevice> deviceEntry: devices.entrySet()) {
		DLNADevice device = deviceEntry.getValue();

		int volume;
		if(device.volumeMax <= 0) {
			volume = 5;
		} else {
			int increments = (int) Math.ceil(device.volumeMax / 10.0);
			volume = controller == null ? device.volume : (int) controller.getVolume();
			volume = volume / increments;
		}

		MediaRouteDescriptor.Builder routeBuilder = new MediaRouteDescriptor.Builder(device.id, device.name);
		routeBuilder.addControlFilter(routeIntentFilter)
				.setPlaybackStream(AudioManager.STREAM_MUSIC)
				.setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
				.setDescription(device.description)
				.setVolume(volume)
				.setVolumeMax(10)
				.setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE);
		providerBuilder.addRoute(routeBuilder.build());
	}

	setDescriptor(providerBuilder.build());
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:38,代码来源:DLNARouteProvider.java


示例8: publishRoutes

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
private void publishRoutes() {
    Resources r = getContext().getResources();

    MediaRouteDescriptor routeDescriptor1 = new MediaRouteDescriptor.Builder(
            FIXED_VOLUME_ROUTE_ID,
            r.getString(R.string.fixed_volume_route_name))
            .setDescription(r.getString(R.string.sample_route_description))
            .addControlFilters(CONTROL_FILTERS)
            .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
            .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_FIXED)
            .setVolume(VOLUME_MAX)
            .build();

    MediaRouteDescriptor routeDescriptor2 = new MediaRouteDescriptor.Builder(
            VARIABLE_VOLUME_ROUTE_ID,
            r.getString(R.string.variable_volume_route_name))
            .setDescription(r.getString(R.string.sample_route_description))
            .addControlFilters(CONTROL_FILTERS)
            .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
            .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
            .setVolumeMax(VOLUME_MAX)
            .setVolume(mVolume)
            .build();

    MediaRouteProviderDescriptor providerDescriptor =
            new MediaRouteProviderDescriptor.Builder()
            .addRoute(routeDescriptor1)
            .addRoute(routeDescriptor2)
            .build();
    setDescriptor(providerDescriptor);
}
 
开发者ID:reknih,项目名称:informant-droid,代码行数:32,代码来源:SampleMediaRouteProvider.java


示例9: MediaRouteDescriptorSubject

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
protected MediaRouteDescriptorSubject(FailureStrategy failureStrategy, MediaRouteDescriptor subject) {
  super(failureStrategy, subject);
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:4,代码来源:MediaRouteDescriptorSubject.java


示例10: publishRoutes

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
private void publishRoutes() {
    Resources r = getContext().getResources();

    MediaRouteDescriptor routeDescriptor1 = new MediaRouteDescriptor.Builder(
            FIXED_VOLUME_ROUTE_ID,
            r.getString(R.string.fixed_volume_route_name))
            .setDescription(r.getString(R.string.sample_route_description))
            .addControlFilters(CONTROL_FILTERS_BASIC)
            .setPlaybackStream(AudioManager.STREAM_MUSIC)
            .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
            .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_FIXED)
            .setVolume(VOLUME_MAX)
            .build();

    MediaRouteDescriptor routeDescriptor2 = new MediaRouteDescriptor.Builder(
            VARIABLE_VOLUME_BASIC_ROUTE_ID,
            r.getString(R.string.variable_volume_basic_route_name))
            .setDescription(r.getString(R.string.sample_route_description))
            .addControlFilters(CONTROL_FILTERS_BASIC)
            .setPlaybackStream(AudioManager.STREAM_MUSIC)
            .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
            .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
            .setVolumeMax(VOLUME_MAX)
            .setVolume(mVolume)
            .build();

    MediaRouteDescriptor routeDescriptor3 = new MediaRouteDescriptor.Builder(
            VARIABLE_VOLUME_QUEUING_ROUTE_ID,
            r.getString(R.string.variable_volume_queuing_route_name))
            .setDescription(r.getString(R.string.sample_route_description))
            .addControlFilters(CONTROL_FILTERS_QUEUING)
            .setPlaybackStream(AudioManager.STREAM_MUSIC)
            .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
            .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
            .setVolumeMax(VOLUME_MAX)
            .setVolume(mVolume)
            .build();

    MediaRouteDescriptor routeDescriptor4 = new MediaRouteDescriptor.Builder(
            VARIABLE_VOLUME_SESSION_ROUTE_ID,
            r.getString(R.string.variable_volume_session_route_name))
            .setDescription(r.getString(R.string.sample_route_description))
            .addControlFilters(CONTROL_FILTERS_SESSION)
            .setPlaybackStream(AudioManager.STREAM_MUSIC)
            .setPlaybackType(MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE)
            .setVolumeHandling(MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE)
            .setVolumeMax(VOLUME_MAX)
            .setVolume(mVolume)
            .build();

    MediaRouteProviderDescriptor providerDescriptor =
            new MediaRouteProviderDescriptor.Builder()
            .addRoute(routeDescriptor1)
            .addRoute(routeDescriptor2)
            .addRoute(routeDescriptor3)
            .addRoute(routeDescriptor4)
            .build();
    setDescriptor(providerDescriptor);
}
 
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:60,代码来源:SampleMediaRouteProvider.java


示例11: MediaRouteDescriptorAssert

import android.support.v7.media.MediaRouteDescriptor; //导入依赖的package包/类
public MediaRouteDescriptorAssert(MediaRouteDescriptor actual) {
  super(actual, MediaRouteDescriptorAssert.class);
}
 
开发者ID:square,项目名称:assertj-android,代码行数:4,代码来源:MediaRouteDescriptorAssert.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StepDisplacement类代码示例发布时间:2022-05-23
下一篇:
Java ChromeSigninController类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap