org.chromium.chrome.browser.media.remote.MediaRouteController.MediaStateListener Java Examples

The following examples show how to use org.chromium.chrome.browser.media.remote.MediaRouteController.MediaStateListener. 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: RemoteMediaPlayerController.java    From delion with Apache License 2.0 6 votes vote down vote up
private void showMediaRouteDialog(MediaStateListener player, MediaRouteController controller,
        Activity activity) {

    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }

    MediaRouteDialogFactory factory = new MediaRouteChooserDialogFactory(player, controller,
            activity);

    if (fm.findFragmentByTag(
            "android.support.v7.mediarouter:MediaRouteChooserDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route chooser dialog already showing!");
        return;
    }
    MediaRouteChooserDialogFragment f = factory.onCreateChooserDialogFragment();

    f.setRouteSelector(controller.buildMediaRouteSelector());
    f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment");
}
 
Example #2
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void showMediaRouteDialog(MediaStateListener player, MediaRouteController controller,
        Activity activity) {

    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }

    MediaRouteDialogFactory factory = new MediaRouteChooserDialogFactory(player, controller,
            activity);

    if (fm.findFragmentByTag(
            "android.support.v7.mediarouter:MediaRouteChooserDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route chooser dialog already showing!");
        return;
    }
    MediaRouteChooserDialogFragment f = factory.onCreateChooserDialogFragment();

    f.setRouteSelector(controller.buildMediaRouteSelector());
    f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment");
}
 
Example #3
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void showMediaRouteControlDialog(MediaStateListener player, Activity activity) {
    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }
    MediaRouteDialogFactory factory = new MediaRouteControllerDialogFactory(player);

    if (fm.findFragmentByTag(
            "android.support.v7.mediarouter:MediaRouteControllerDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route controller dialog already showing!");
        return;
    }
    MediaRouteControllerDialogFragment f = factory.onCreateControllerDialogFragment();

    f.show(fm, "android.support.v7.mediarouter:MediaRouteControllerDialogFragment");
}
 
Example #4
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void showMediaRouteControlDialog(MediaStateListener player, Activity activity) {
    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }
    MediaRouteDialogFactory factory = new MediaRouteControllerDialogFactory(player);

    if (fm.findFragmentByTag(
            "android.support.v7.mediarouter:MediaRouteControllerDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route controller dialog already showing!");
        return;
    }
    MediaRouteControllerDialogFragment f = factory.onCreateControllerDialogFragment();

    f.show(fm, "android.support.v7.mediarouter:MediaRouteControllerDialogFragment");
}
 
Example #5
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void showMediaRouteDialog(MediaStateListener player, MediaRouteController controller,
        Activity activity) {

    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }

    MediaRouteDialogFactory factory = new MediaRouteChooserDialogFactory(player, controller,
            activity);

    if (fm.findFragmentByTag(
            "android.support.v7.mediarouter:MediaRouteChooserDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route chooser dialog already showing!");
        return;
    }
    MediaRouteChooserDialogFragment f = factory.onCreateChooserDialogFragment();

    f.setRouteSelector(controller.buildMediaRouteSelector());
    f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment");
}
 
Example #6
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests to stop casting the video.
 * @param player The player to stop remote playback for.
 */
public void requestRemotePlaybackStop(MediaRouteController.MediaStateListener player) {
    if (mCurrentRouteController == null) return;
    if (mCurrentRouteController.getMediaStateListener() != player) return;

    mCurrentRouteController.release();
}
 
Example #7
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests control of a video that is being cast.
 * @param player The player for which remote playback control is being requested.
 */
public void requestRemotePlaybackControl(MediaRouteController.MediaStateListener player) {
    // Player should match currently remotely played item, but there
    // can be a race between various
    // ways that the a video can stop playing remotely. Check that the
    // player is current, and ignore if not.

    if (mCurrentRouteController == null) return;
    if (mCurrentRouteController.getMediaStateListener() != player) return;

    showMediaRouteControlDialog(player, ApplicationStatus.getLastTrackedFocusedActivity());
}
 
Example #8
Source File: RemoteMediaPlayerController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests that a video be cast. This will typically be a request
 * from Blink when the cast button is pressed on the default video controls.
 * @param player the player for which cast is being requested
 * @param frameUrl the URL of the frame containing the video, needed for YouTube videos
 */
public void requestRemotePlayback(
        MediaRouteController.MediaStateListener player, MediaRouteController controller) {
    Activity currentActivity = ApplicationStatus.getLastTrackedFocusedActivity();
    mChromeVideoActivity = new WeakReference<Activity>(currentActivity);

    if (mCurrentRouteController != null && controller != mCurrentRouteController) {
        mCurrentRouteController.release();
    }

    onStateReset(controller);
    showMediaRouteDialog(player, controller, currentActivity);

}
 
Example #9
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests to stop casting the video.
 * @param player The player to stop remote playback for.
 */
public void requestRemotePlaybackStop(MediaRouteController.MediaStateListener player) {
    if (mCurrentRouteController == null) return;
    if (mCurrentRouteController.getMediaStateListener() != player) return;

    mCurrentRouteController.release();
}
 
Example #10
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests control of a video that is being cast.
 * @param player The player for which remote playback control is being requested.
 */
public void requestRemotePlaybackControl(MediaRouteController.MediaStateListener player) {
    // Player should match currently remotely played item, but there
    // can be a race between various
    // ways that the a video can stop playing remotely. Check that the
    // player is current, and ignore if not.

    if (mCurrentRouteController == null) return;
    if (mCurrentRouteController.getMediaStateListener() != player) return;

    showMediaRouteControlDialog(player, ApplicationStatus.getLastTrackedFocusedActivity());
}
 
Example #11
Source File: RemoteMediaPlayerController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests that a video be cast. This will typically be a request
 * from Blink when the cast button is pressed on the default video controls.
 * @param player the player for which cast is being requested
 * @param frameUrl the URL of the frame containing the video, needed for YouTube videos
 */
public void requestRemotePlayback(
        MediaRouteController.MediaStateListener player, MediaRouteController controller) {
    Activity currentActivity = ApplicationStatus.getLastTrackedFocusedActivity();
    mChromeVideoActivity = new WeakReference<Activity>(currentActivity);

    if (mCurrentRouteController != null && controller != mCurrentRouteController) {
        mCurrentRouteController.release();
    }

    onStateReset(controller);
    showMediaRouteDialog(player, controller, currentActivity);

}
 
Example #12
Source File: RemoteMediaPlayerController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests that a video be cast. This will typically be a request
 * from Blink when the cast button is pressed on the default video controls.
 * @param player the player for which cast is being requested
 * @param frameUrl the URL of the frame containing the video, needed for YouTube videos
 */
public void requestRemotePlayback(
        MediaRouteController.MediaStateListener player, MediaRouteController controller) {
    Activity currentActivity = ApplicationStatus.getLastTrackedFocusedActivity();
    mChromeVideoActivity = new WeakReference<Activity>(currentActivity);

    if (mCurrentRouteController != null && controller != mCurrentRouteController) {
        mCurrentRouteController.release();
    }

    onStateReset(controller);
    showMediaRouteDialog(player, controller, currentActivity);

}
 
Example #13
Source File: RemoteMediaPlayerController.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Called when a lower layer requests control of a video that is being cast.
 * @param player The player for which remote playback control is being requested.
 */
public void requestRemotePlaybackControl(MediaRouteController.MediaStateListener player) {
    // Player should match currently remotely played item, but there
    // can be a race between various
    // ways that the a video can stop playing remotely. Check that the
    // player is current, and ignore if not.

    if (mCurrentRouteController == null) return;
    if (mCurrentRouteController.getMediaStateListener() != player) return;

    showMediaRouteControlDialog(ApplicationStatus.getLastTrackedFocusedActivity());
}
 
Example #14
Source File: MediaRouteChooserDialogFactory.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@SuppressLint("ValidFragment")
Fragment(MediaRouteController controller, MediaStateListener player) {
    mController = controller;
    mPlayer = player;
}
 
Example #15
Source File: MediaRouteChooserDialogFactory.java    From 365browser with Apache License 2.0 4 votes vote down vote up
MediaRouteChooserDialogFactory(MediaStateListener player, MediaRouteController controller,
        Context context) {
    mPlayer = player;
    mController = controller;
    mContext = context;
}
 
Example #16
Source File: MediaRouteControllerDialogFactory.java    From 365browser with Apache License 2.0 4 votes vote down vote up
MediaRouteControllerDialogFactory(MediaStateListener player) {
    mPlayer = player;
}
 
Example #17
Source File: MediaRouteControllerDialogFactory.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@SuppressLint("ValidFragment")
Fragment(MediaStateListener player) {
    mPlayer = player;
}
 
Example #18
Source File: MediaRouteControllerDialogFactory.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@SuppressLint("ValidFragment")
Fragment(MediaStateListener player) {
    mPlayer = player;
}
 
Example #19
Source File: MediaRouteControllerDialogFactory.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
MediaRouteControllerDialogFactory(MediaStateListener player) {
    mPlayer = player;
}
 
Example #20
Source File: MediaRouteChooserDialogFactory.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@SuppressLint("ValidFragment")
Fragment(MediaRouteController controller, MediaStateListener player) {
    mController = controller;
    mPlayer = player;
}
 
Example #21
Source File: MediaRouteChooserDialogFactory.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
MediaRouteChooserDialogFactory(MediaStateListener player, MediaRouteController controller,
        Context context) {
    mPlayer = player;
    mController = controller;
    mContext = context;
}
 
Example #22
Source File: MediaRouteChooserDialogFactory.java    From delion with Apache License 2.0 4 votes vote down vote up
Fragment(MediaRouteController controller, MediaStateListener player) {
    mController = controller;
    mPlayer = player;
}
 
Example #23
Source File: MediaRouteChooserDialogFactory.java    From delion with Apache License 2.0 4 votes vote down vote up
MediaRouteChooserDialogFactory(MediaStateListener player, MediaRouteController controller,
        Context context) {
    mPlayer = player;
    mController = controller;
    mContext = context;
}