本文整理汇总了Java中android.support.v7.media.MediaRouter.Callback方法的典型用法代码示例。如果您正苦于以下问题:Java MediaRouter.Callback方法的具体用法?Java MediaRouter.Callback怎么用?Java MediaRouter.Callback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.media.MediaRouter
的用法示例。
在下文中一共展示了MediaRouter.Callback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Fragment
import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
public Fragment(BaseMediaRouteDialogManager manager, MediaRouter.Callback callback) {
mManager = manager;
mCallback = callback;
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:5,代码来源:MediaRouteControllerDialogManager.java
示例2: onCreate
import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
public void onCreate() {
super.onCreate();
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouterCallback = new MediaRouter.Callback (){
public void onRoutePresentationDisplayChanged(MediaRouter router, MediaRouter.RouteInfo route) {
Log.d(TAG,"onRoutePresentationDisplayChanged ");
if(CastPlayerService.sCastPlayerService !=null&&route.getPresentationDisplay()!=null)
CastPlayerService.sCastPlayerService.createDisplayContext(route.getPresentationDisplay());
}
@Override
public void onRouteSelected(MediaRouter router, final MediaRouter.RouteInfo info) {
final CastDevice device = CastDevice.getFromBundle(info.getExtras());
if(device==null)
return;
ArchosVideoCastManager.getInstance().setSelectedRoute(info);
}
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
ArchosVideoCastManager.getInstance().setSelectedRoute(info);
}
};
sCastPlayerService = this;
mAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mSubtitleSizeDefault = getResources().getInteger(R.integer.player_pref_subtitle_size_default);
mSubtitleColorDefault = Color.parseColor(getResources().getString(R.string.subtitle_color_default));
mSubtitleVPosDefault = getResources().getInteger(R.integer.player_pref_subtitle_vpos_default);
Log.d(TAG,"onCreate");
bindService(new Intent(this, PlayerService.class), mPlayerServiceConnection, BIND_AUTO_CREATE);
if(PlayerService.sPlayerService!=null)
onFirstScreenPresentationCreatedAndServiceConnected();
mWindowManager = (WindowManager)getSystemService(WINDOW_SERVICE);
AppState.addOnForeGroundListener(this);
IntentFilter filter = new IntentFilter();
filter.addAction("DISPLAY_FLOATING_PLAYER");
filter.addAction(PlayerService.PLAY_INTENT);
filter.addAction(PlayerService.PAUSE_INTENT);
filter.addAction(PlayerService.EXIT_INTENT);
filter.addAction(PlayerService.FULLSCREEN_INTENT);
}
示例3: getRouteSelectorCallback
import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
public MediaRouter.Callback getRouteSelectorCallback() {
return mRouteSelectorCallback;
}
示例4: ArchosVideoCastManager
import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
public ArchosVideoCastManager(Context context){
mMiniControllers = new ArrayList();
mContext = context;
reset();
mArchosCastManagerListeners = new ArrayList<>();
if(!isCastAvailable()) {
mCastManager = null;
mMediaRouter = null;
mMediaRouteSelector = null;
return;
}
mCastManager = VideoCastManager.getInstance();
mCastManager.addMiniController(this);//this will set mOnMiniControllerChangedListener
mCastManager.addVideoCastConsumer(mCastConsumer);
mCastManager.addTracksSelectedListener(new OnTracksSelectedListener() {
@Override
public void onTracksSelected(List<MediaTrack> tracks) {
ArchosVideoCastManager.getInstance().setSelectedTracks(tracks);
}
});
mRouteSelectorCallback = new MediaRouter.Callback(){
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo route) {
setSelectedRoute(route);
if(CastDebug.DBG){
CastDebug.log("onRouteSelected null ? "+(route==null));
}
}
public void onRouteRemoved(MediaRouter router, MediaRouter.RouteInfo route) {
Log.d(TAG, "route removed");
if(CastDebug.DBG){
CastDebug.log("onRouteRemoved "+route.getName());
}
//sometimes onRouteRemoved is called when doing screencast, even when it still works
}
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo route, int reason) {
Log.d(TAG, "onRouteUnselected "+mDoNotUnselectRoute);
if(CastDebug.DBG){
CastDebug.log("onRouteUnselected mDoNotUnselectRoute ?"+(mDoNotUnselectRoute));
}
if(mDoNotUnselectRoute){
mDoNotUnselectRoute = false;
}
else {
if(CastDebug.DBG){
//check if deco is normal
if(route!=null&&route.getExtras()!=null) {
CastDevice device = CastDevice.getFromBundle(route.getExtras());
if (device.getFriendlyName() != null && device.getFriendlyName().equals(getDeviceName())) {
CastDebug.log("WARNING: current device removed : " + getDeviceName());
}
}
}
setSelectedRoute(null);
reset();
refreshCastListeners();
}
}
};
mMediaRouter = MediaRouter.getInstance(mContext);
mMediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory(
CastMediaControlIntent.categoryForCast(mContext.getString(R.string.app_id))).build();
mMediaRouter.addCallback(mMediaRouteSelector, mRouteSelectorCallback,
MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
}