本文整理汇总了Java中android.media.MediaRouter类的典型用法代码示例。如果您正苦于以下问题:Java MediaRouter类的具体用法?Java MediaRouter怎么用?Java MediaRouter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaRouter类属于android.media包,在下文中一共展示了MediaRouter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.media.MediaRouter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "StandaloneDisplayActivity.onCreate()");
super.onCreate(savedInstanceState);
int layout = getLayout();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(layout);
displayLayout = (DisplayLayout) findViewById(R.id.display);
ActionBar ab = getActionBar();
if (ab != null) {
ab.hide();
}
if (!getIntent().getBooleanExtra(EXTRA_MIRROR_DISPLAY, false)) {
mediaRouter = (MediaRouter) getSystemService(MEDIA_ROUTER_SERVICE);
mediaRouter
.addCallback(MediaRouter.ROUTE_TYPE_LIVE_VIDEO, callback);
updatePresentation();
}
displayLayout.go(0, false);
View view = findViewById(R.id.display_attributes);
DisplayInfoHelper.populate(this, view, getWindowManager().getDefaultDisplay());
DisplayInfoHelper.show(view, DURATION);
}
示例2: e
import android.media.MediaRouter; //导入依赖的package包/类
private final void e()
{
MediaRouter localMediaRouter = (MediaRouter)this.i;
int i1 = localMediaRouter.getRouteCount();
ArrayList localArrayList = new ArrayList(i1);
for (int i2 = 0; i2 < i1; i2++) {
localArrayList.add(localMediaRouter.getRouteAt(i2));
}
Iterator localIterator = localArrayList.iterator();
boolean bool = false;
while (localIterator.hasNext()) {
bool |= f(localIterator.next());
}
if (bool) {
a();
}
}
示例3: a
import android.media.MediaRouter; //导入依赖的package包/类
public final void a(aay paramaay)
{
aax localaax = paramaay.a;
aao.a();
if (localaax.a != this)
{
Object localObject1 = this.i;
Object localObject2 = this.s;
MediaRouter.UserRouteInfo localUserRouteInfo = ((MediaRouter)localObject1).createUserRoute((MediaRouter.RouteCategory)localObject2);
abz localabz = new abz(paramaay, localUserRouteInfo);
((MediaRouter.RouteInfo)localUserRouteInfo).setTag(localabz);
Object localObject3 = this.r;
((MediaRouter.UserRouteInfo)localUserRouteInfo).setVolumeCallback((MediaRouter.VolumeCallback)localObject3);
a(localabz);
this.t.add(localabz);
((MediaRouter)this.i).addUserRoute((MediaRouter.UserRouteInfo)localUserRouteInfo);
}
int i1;
do
{
return;
i1 = g(((MediaRouter)this.i).getSelectedRoute(8388611));
} while ((i1 < 0) || (!((aby)this.n.get(i1)).b.equals(paramaay.b)));
aao.a();
aao.b.a(paramaay, 3);
}
示例4: b
import android.media.MediaRouter; //导入依赖的package包/类
protected void b()
{
if (this.m)
{
this.m = false;
Object localObject3 = this.i;
Object localObject4 = this.j;
((MediaRouter)localObject3).removeCallback((MediaRouter.Callback)localObject4);
}
if (this.k != 0)
{
this.m = true;
Object localObject1 = this.i;
int i1 = this.k;
Object localObject2 = this.j;
((MediaRouter)localObject1).addCallback(i1, (MediaRouter.Callback)localObject2);
}
}
示例5: a
import android.media.MediaRouter; //导入依赖的package包/类
public final Object a(Object paramObject)
{
MediaRouter localMediaRouter = (MediaRouter)paramObject;
if (this.a != null) {}
try
{
Object localObject = this.a.invoke(localMediaRouter, new Object[0]);
return localObject;
}
catch (InvocationTargetException localInvocationTargetException)
{
return localMediaRouter.getRouteAt(0);
}
catch (IllegalAccessException localIllegalAccessException)
{
label31:
break label31;
}
}
示例6: onCreate
import android.media.MediaRouter; //导入依赖的package包/类
/**
* Initialization of the Activity after it is first created. Must at least
* call {@link android.app.Activity#setContentView setContentView()} to
* describe what is to be displayed in the screen.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
// Be sure to call the super class.
super.onCreate(savedInstanceState);
// Get the media router service.
mMediaRouter = (MediaRouter)getSystemService(Context.MEDIA_ROUTER_SERVICE);
// See assets/res/any/layout/presentation_with_media_router_activity.xml for this
// view layout definition, which is being set here as
// the content of our screen.
setContentView(R.layout.presentation_with_media_router_activity);
// Set up the surface view for visual interest.
mSurfaceView = (GLSurfaceView)findViewById(R.id.surface_view);
mSurfaceView.setRenderer(new CubeRenderer(false));
// Get a text view where we will show information about what's happening.
mInfoTextView = (TextView)findViewById(R.id.info);
}
示例7: onCreateOptionsMenu
import android.media.MediaRouter; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Be sure to call the super class.
super.onCreateOptionsMenu(menu);
// Inflate the menu and configure the media router action provider.
getMenuInflater().inflate(R.menu.presentation_with_media_router_menu, menu);
MenuItem mediaRouteMenuItem = menu.findItem(R.id.menu_media_route);
MediaRouteActionProvider mediaRouteActionProvider =
(MediaRouteActionProvider)mediaRouteMenuItem.getActionProvider();
mediaRouteActionProvider.setRouteTypes(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
// Return true to show the menu.
return true;
}
示例8: broadcastDescriptor
import android.media.MediaRouter; //导入依赖的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());
}
示例9: createPresentation
import android.media.MediaRouter; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void createPresentation() {
if (mMediaRouter == null || mEnableCloneMode)
return;
// Get the current route and its presentation display.
MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(
MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
Display presentationDisplay = route != null ? route.getPresentationDisplay() : null;
if (presentationDisplay != null) {
// Show a new presentation if possible.
Log.i(TAG, "Showing presentation on display: " + presentationDisplay);
mPresentation = new SecondaryDisplay(this, presentationDisplay);
mPresentation.setOnDismissListener(mOnDismissListener);
try {
mPresentation.show();
} catch (WindowManager.InvalidDisplayException ex) {
Log.w(TAG, "Couldn't show presentation! Display was removed in "
+ "the meantime.", ex);
mPresentation = null;
}
} else
Log.i(TAG, "No secondary display detected");
}
示例10: GetDefaultRouteWorkaround
import android.media.MediaRouter; //导入依赖的package包/类
public GetDefaultRouteWorkaround()
{
if (android.os.Build.VERSION.SDK_INT < 16 || android.os.Build.VERSION.SDK_INT > 17)
{
throw new UnsupportedOperationException();
}
try
{
mGetSystemAudioRouteMethod = android/media/MediaRouter.getMethod("getSystemAudioRoute", new Class[0]);
return;
}
catch (NoSuchMethodException nosuchmethodexception)
{
return;
}
}
示例11: SelectRouteWorkaround
import android.media.MediaRouter; //导入依赖的package包/类
public SelectRouteWorkaround()
{
if (android.os.Build.VERSION.SDK_INT < 16 || android.os.Build.VERSION.SDK_INT > 17)
{
throw new UnsupportedOperationException();
}
try
{
mSelectRouteIntMethod = android/media/MediaRouter.getMethod("selectRouteInt", new Class[] {
Integer.TYPE, android/media/MediaRouter$RouteInfo
});
return;
}
catch (NoSuchMethodException nosuchmethodexception)
{
return;
}
}
示例12: updatePresentation
import android.media.MediaRouter; //导入依赖的package包/类
private void updatePresentation() {
MediaRouter.RouteInfo route = mediaRouter
.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
Display presentationDisplay = route != null ? route
.getPresentationDisplay() : null;
if (displayPresentation != null
&& displayPresentation.getDisplay() != presentationDisplay) {
displayPresentation.dismiss();
displayPresentation = null;
}
if (displayPresentation == null && presentationDisplay != null) {
displayPresentation = new DisplayPresentation(this, presentationDisplay);
displayPresentation.setOnDismissListener(
new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (dialog == displayPresentation) {
displayPresentation = null;
}
}
}
);
displayPresentation.show();
displayPresentation.go(displayLayout.getCurrentSlidePos(), displayLayout.getCurrentSlidePhase());
}
}
示例13: setupThing
import android.media.MediaRouter; //导入依赖的package包/类
private void setupThing() {
MediaRouter mediaRouter = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
if (mediaRouter != null) {
MediaRouter.RouteInfo routeInfo = mediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
if (routeInfo != null) {
Display presentationDisplay = routeInfo.getPresentationDisplay();
Bundle bundle = ActivityOptions.makeBasic().setLaunchDisplayId(presentationDisplay.getDisplayId()).toBundle();
Intent intent = new Intent(this, EachAnotherActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent, bundle);
}
}
}
示例14: abw
import android.media.MediaRouter; //导入依赖的package包/类
public abw(Context paramContext, acf paramacf)
{
super(paramContext);
this.q = paramacf;
this.i = paramContext.getSystemService("media_router");
this.j = c();
this.r = new abe(this);
Resources localResources = paramContext.getResources();
Object localObject = this.i;
String str = localResources.getString(efj.bF);
this.s = ((MediaRouter)localObject).createRouteCategory(str, false);
e();
}
示例15: i
import android.media.MediaRouter; //导入依赖的package包/类
private static abz i(Object paramObject)
{
Object localObject = ((MediaRouter.RouteInfo)paramObject).getTag();
if ((localObject instanceof abz)) {
return (abz)localObject;
}
return null;
}