Search in sources :

Example 1 with ItemActionCallback

use of android.support.v7.media.RemotePlaybackClient.ItemActionCallback in project cw-omnibus by commonsguy.

the class PlaybackFragment method play.

private void play() {
    logToTranscript(getActivity().getString(R.string.play_requested));
    ItemActionCallback playCB = new ItemActionCallback() {

        @Override
        public void onResult(Bundle data, String sessionId, MediaSessionStatus sessionStatus, String itemId, MediaItemStatus itemStatus) {
            logToTranscript(getActivity().getString(R.string.playing));
            isPlaying = true;
            getActivity().supportInvalidateOptionsMenu();
        }

        @Override
        public void onError(String error, int code, Bundle data) {
            logToTranscript(getActivity().getString(R.string.play_error) + error);
        }
    };
    client.play(Uri.parse("http://misc.commonsware.com/ed_hd_512kb.mp4"), "video/mp4", null, 0, null, playCB);
}
Also used : MediaSessionStatus(android.support.v7.media.MediaSessionStatus) Bundle(android.os.Bundle) ItemActionCallback(android.support.v7.media.RemotePlaybackClient.ItemActionCallback) MediaItemStatus(android.support.v7.media.MediaItemStatus)

Example 2 with ItemActionCallback

use of android.support.v7.media.RemotePlaybackClient.ItemActionCallback in project cw-omnibus by commonsguy.

the class PlaybackFragment method play.

private void play() {
    logToTranscript(getActivity().getString(R.string.play_requested));
    ItemActionCallback playCB = new ItemActionCallback() {

        @Override
        public void onResult(Bundle data, String sessionId, MediaSessionStatus sessionStatus, String itemId, MediaItemStatus itemStatus) {
            logToTranscript(getActivity().getString(R.string.playing));
            isPlaying = true;
            updateMenu();
        }

        @Override
        public void onError(String error, int code, Bundle data) {
            logToTranscript(getActivity().getString(R.string.play_error) + error);
        }
    };
    client.play(Uri.parse("http://misc.commonsware.com/ed_hd_512kb.mp4"), "video/mp4", null, 0, null, playCB);
}
Also used : MediaSessionStatus(android.support.v7.media.MediaSessionStatus) Bundle(android.os.Bundle) ItemActionCallback(android.support.v7.media.RemotePlaybackClient.ItemActionCallback) MediaItemStatus(android.support.v7.media.MediaItemStatus)

Aggregations

Bundle (android.os.Bundle)2 MediaItemStatus (android.support.v7.media.MediaItemStatus)2 MediaSessionStatus (android.support.v7.media.MediaSessionStatus)2 ItemActionCallback (android.support.v7.media.RemotePlaybackClient.ItemActionCallback)2