Java Code Examples for android.media.MediaRouter#RouteInfo
The following examples show how to use
android.media.MediaRouter#RouteInfo .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DisplayManager.java From libvlc-sdk-android with GNU General Public License v2.0 | 6 votes |
private SecondaryDisplay createPresentation() { if (mMediaRouter == null) return null; final MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO); final Display presentationDisplay = route != null ? route.getPresentationDisplay() : null; if (presentationDisplay != null) { if (BuildConfig.DEBUG) Log.i(TAG, "Showing presentation on display: " + presentationDisplay); final SecondaryDisplay presentation = new SecondaryDisplay(mActivity, presentationDisplay); presentation.setOnDismissListener(mOnDismissListener); try { presentation.show(); mPresentationId = presentationDisplay.getDisplayId(); return presentation; } catch (WindowManager.InvalidDisplayException ex) { if (BuildConfig.DEBUG) Log.w(TAG, "Couldn't show presentation! Display was removed in " + "the meantime.", ex); mPresentationId = -1; } } else if (BuildConfig.DEBUG) Log.i(TAG, "No secondary display detected"); return null; }
Example 2
Source File: DisplayManager.java From libvlc-sdk-android with GNU General Public License v2.0 | 6 votes |
public boolean setMediaRouterCallback() { if (mMediaRouter == null || mMediaRouterCallback != null) return false; mMediaRouterCallback = new MediaRouter.SimpleCallback() { @Override public void onRoutePresentationDisplayChanged(MediaRouter router, MediaRouter.RouteInfo info) { if (BuildConfig.DEBUG) Log.d(TAG, "onRoutePresentationDisplayChanged: info=" + info); final int newDisplayId = (info.getPresentationDisplay() != null) ? info.getPresentationDisplay().getDisplayId() : -1; if (newDisplayId == mPresentationId) return; mPresentationId = newDisplayId; if (newDisplayId == -1) removePresentation(); else updateDisplayType(); } }; mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_LIVE_VIDEO, mMediaRouterCallback); return true; }
Example 3
Source File: MediaProjectionManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onRouteSelected(MediaRouter router, int type, MediaRouter.RouteInfo info) { synchronized (mLock) { if ((type & MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY) != 0) { mMediaRouteInfo = info; if (mProjectionGrant != null) { mProjectionGrant.stop(); } } } }
Example 4
Source File: MediaRouteButton.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void refreshRoute() { final MediaRouter.RouteInfo route = mRouter.getSelectedRoute(); final boolean isRemote = !route.isDefault() && route.matchesTypes(mRouteTypes); final boolean isConnecting = isRemote && route.isConnecting(); boolean needsRefresh = false; if (mRemoteActive != isRemote) { mRemoteActive = isRemote; needsRefresh = true; } if (mIsConnecting != isConnecting) { mIsConnecting = isConnecting; needsRefresh = true; } if (needsRefresh) { refreshDrawableState(); } if (mAttachedToWindow) { setEnabled(mRouter.isRouteAvailable(mRouteTypes, MediaRouter.AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE)); } if (mRemoteIndicator != null && mRemoteIndicator.getCurrent() instanceof AnimationDrawable) { AnimationDrawable curDrawable = (AnimationDrawable) mRemoteIndicator.getCurrent(); if (mAttachedToWindow) { if ((needsRefresh || isConnecting) && !curDrawable.isRunning()) { curDrawable.start(); } } else if (isRemote && !isConnecting) { // When the route is already connected before the view is attached, show the last // frame of the connected animation immediately. if (curDrawable.isRunning()) { curDrawable.stop(); } curDrawable.selectDrawable(curDrawable.getNumberOfFrames() - 1); } } }
Example 5
Source File: VideoPlayerActivity.java From VCL-Android with Apache License 2.0 | 5 votes |
@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, LibVLC(), presentationDisplay); mPresentation.setOnDismissListener(mOnDismissListener); try { mPresentation.show(); mPresentationDisplayId = presentationDisplay.getDisplayId(); } 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"); }
Example 6
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 5 votes |
@Override public void onRouteSelected(MediaRouter router, int type, MediaRouter.RouteInfo info) { LOGD("MediaRouteListener", "onRouteSelected(" + type + ", " + info.getName() + ")"); mCurrentRouteInfo = info; mCurrentRouteType = type; refreshRoute(); }
Example 7
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 5 votes |
@Override public void onRouteUnselected(MediaRouter router, int type, MediaRouter.RouteInfo info) { LOGD("MediaRouteListener", "onRouteUnselected(" + type + ", " + info.getName() + ")"); mCurrentRouteInfo = null; mCurrentRouteType = type; refreshRoute(); }
Example 8
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 5 votes |
@Override public void onRouteSelected(MediaRouter router, int type, MediaRouter.RouteInfo info) { LOGD("MediaRouteListener", "onRouteSelected(" + type + ", " + info.getName() + ")"); mCurrentRouteInfo = info; mCurrentRouteType = type; refreshRoute(); }
Example 9
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 5 votes |
@Override public void onRouteUnselected(MediaRouter router, int type, MediaRouter.RouteInfo info) { LOGD("MediaRouteListener", "onRouteUnselected(" + type + ", " + info.getName() + ")"); mCurrentRouteInfo = null; mCurrentRouteType = type; refreshRoute(); }
Example 10
Source File: MediaProjectionManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override public void onRouteUnselected(MediaRouter route, int type, MediaRouter.RouteInfo info) { if (mMediaRouteInfo == info) { mMediaRouteInfo = null; } }
Example 11
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 4 votes |
@Override public void onRouteVolumeChanged(MediaRouter router, MediaRouter.RouteInfo info) { LOGD("MediaRouteListener", "onRouteVolumeChanged(" + info.getName() + ")"); mCurrentRouteInfo = info; refreshRoute(); }
Example 12
Source File: VolumePanel.java From Noyze with Apache License 2.0 | 4 votes |
@Override public void onRouteVolumeChanged(MediaRouter router, MediaRouter.RouteInfo info) { LOGD("MediaRouteListener", "onRouteVolumeChanged(" + info.getName() + ")"); mCurrentRouteInfo = info; refreshRoute(); }
Example 13
Source File: MRAIDImplementation.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
private void setupCallback() { callback = new MediaRouter.Callback() { @Override public void onRouteSelected(MediaRouter router, int type, MediaRouter.RouteInfo info) { Clog.d("onRouteSelected", info.getName().toString()); // This is called when the MediaRoute is changed from Phone or Headphones to Bluetooth or vice-versa fireAudioVolumeChangeEvent(getAudioVolumePercentage()); } @Override public void onRouteUnselected(MediaRouter router, int type, MediaRouter.RouteInfo info) { Clog.d("onRouteUnselected", info.getName().toString()); } @Override public void onRouteAdded(MediaRouter router, MediaRouter.RouteInfo info) { Clog.d("onRouteAdded", info.getName().toString()); } @Override public void onRouteRemoved(MediaRouter router, MediaRouter.RouteInfo info) { Clog.d("onRouteRemoved", info.getName().toString()); } @Override public void onRouteChanged(MediaRouter router, MediaRouter.RouteInfo info) { Clog.d("onRouteChanged", info.getName().toString()); // This is called when the MediaRoute is changed from Phone to Headphone or vice-versa fireAudioVolumeChangeEvent(getAudioVolumePercentage()); } @Override public void onRouteGrouped(MediaRouter router, MediaRouter.RouteInfo info, MediaRouter.RouteGroup group, int index) { Clog.d("onRouteUngrouped", info.getName().toString()); } @Override public void onRouteUngrouped(MediaRouter router, MediaRouter.RouteInfo info, MediaRouter.RouteGroup group) { Clog.d("onRouteUngrouped", info.getName().toString()); } @Override public void onRouteVolumeChanged(MediaRouter router, MediaRouter.RouteInfo info) { Clog.d("onRouteVolumeChanged", router.getDefaultRoute().getCategory().getName().toString()); Clog.d("onRouteVolumeChanged", info.getName() + ", " + info.getVolume() + ", " + info.getSupportedTypes()); fireAudioVolumeChangeEvent(getAudioVolumePercentage()); } }; }
Example 14
Source File: VolumePanel.java From Noyze with Apache License 2.0 | votes |
public MediaRouter.RouteInfo getCurrentRoute() { return mCurrentRouteInfo; }
Example 15
Source File: VolumePanel.java From Noyze with Apache License 2.0 | votes |
public MediaRouter.RouteInfo getCurrentRoute() { return mCurrentRouteInfo; }