android.support.v4.media.TransportMediator Java Examples

The following examples show how to use android.support.v4.media.TransportMediator. 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: a.java    From letv with Apache License 2.0 6 votes vote down vote up
public static String b(Context context, String str) {
    String str2 = VERSION.RELEASE + "," + Integer.toString(VERSION.SDK_INT);
    String str3 = Build.MODEL;
    String a = s.a(context, z[79], z[76]);
    String str4 = Build.DEVICE;
    Object F = cn.jpush.android.a.F();
    if (ai.a(F)) {
        F = " ";
    }
    String c = c(context);
    JSONObject jSONObject = new JSONObject();
    try {
        jSONObject.put(z[TransportMediator.KEYCODE_MEDIA_PLAY], str2);
        jSONObject.put(z[LeMessageIds.MSG_ALBUM_FETCH_PLAY_NEXT_CONTROLLER], str3);
        jSONObject.put(z[76], a);
        jSONObject.put(z[122], str4);
        jSONObject.put(z[125], F);
        jSONObject.put(z[123], c);
        jSONObject.put(z[124], str);
    } catch (JSONException e) {
    }
    return jSONObject.toString();
}
 
Example #2
Source File: MediaController.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
/**
 * Disable pause or seek buttons if the stream cannot be paused or seeked.
 * This requires the control interface to be a MediaPlayerControlExt
 */
void updateButtons() {
    int flags = mController.getTransportControlFlags();
    boolean enabled = isEnabled();
    if (mPauseButton != null) {
        mPauseButton.setEnabled(enabled && (flags&TransportMediator.FLAG_KEY_MEDIA_PAUSE) != 0);
    }
    if (mRewButton != null) {
        mRewButton.setEnabled(enabled && (flags&TransportMediator.FLAG_KEY_MEDIA_REWIND) != 0);
    }
    if (mFfwdButton != null) {
        mFfwdButton.setEnabled(enabled &&
                (flags&TransportMediator.FLAG_KEY_MEDIA_FAST_FORWARD) != 0);
    }
    if (mPrevButton != null) {
        mShowPrev = (flags&TransportMediator.FLAG_KEY_MEDIA_PREVIOUS) != 0
                || mPrevListener != null;
        mPrevButton.setEnabled(enabled && mShowPrev);
    }
    if (mNextButton != null) {
        mShowNext = (flags&TransportMediator.FLAG_KEY_MEDIA_NEXT) != 0
                || mNextListener != null;
        mNextButton.setEnabled(enabled && mShowNext);
    }
}
 
Example #3
Source File: TransportControllerActivity.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.videoview);

    // Find the video player in our UI.
    mContent = (Content) findViewById(R.id.content);

    // Create transport controller to control video, giving the callback
    // interface to receive actions from.
    mTransportMediator = new TransportMediator(this, mTransportPerformer);

    // Create and initialize the media control UI.
    mMediaController = (MediaController) findViewById(R.id.media_controller);
    mMediaController.setMediaPlayer(mTransportMediator);

    // We're just playing a built-in demo video.
    mContent.init(this, mTransportMediator, mMediaController);
    mContent.setVideoURI(Uri.parse("android.resource://" + getPackageName() +
            "/" + R.raw.videoviewdemo));
}
 
Example #4
Source File: cs.java    From letv with Apache License 2.0 5 votes vote down vote up
private void b(int i) throws cf {
    int i2 = 0;
    while ((i & -128) != 0) {
        int i3 = i2 + 1;
        this.a[i2] = (byte) ((i & TransportMediator.KEYCODE_MEDIA_PAUSE) | 128);
        i >>>= 7;
        i2 = i3;
    }
    int i4 = i2 + 1;
    this.a[i2] = (byte) i;
    this.g.b(this.a, 0, i4);
}
 
Example #5
Source File: SntpClient.java    From letv with Apache License 2.0 5 votes vote down vote up
private long read32(byte[] buffer, int offset) {
    int i0;
    int i1;
    int i2;
    int i3;
    byte b0 = buffer[offset];
    byte b1 = buffer[offset + 1];
    byte b2 = buffer[offset + 2];
    byte b3 = buffer[offset + 3];
    if ((b0 & 128) == 128) {
        i0 = (b0 & TransportMediator.KEYCODE_MEDIA_PAUSE) + 128;
    } else {
        byte i02 = b0;
    }
    if ((b1 & 128) == 128) {
        i1 = (b1 & TransportMediator.KEYCODE_MEDIA_PAUSE) + 128;
    } else {
        byte i12 = b1;
    }
    if ((b2 & 128) == 128) {
        i2 = (b2 & TransportMediator.KEYCODE_MEDIA_PAUSE) + 128;
    } else {
        byte i22 = b2;
    }
    if ((b3 & 128) == 128) {
        i3 = (b3 & TransportMediator.KEYCODE_MEDIA_PAUSE) + 128;
    } else {
        byte i32 = b3;
    }
    return (((((long) i0) << 24) + (((long) i1) << 16)) + (((long) i2) << 8)) + ((long) i3);
}
 
Example #6
Source File: VideoViewTV.java    From letv with Apache License 2.0 5 votes vote down vote up
public boolean onKeyDown(int keyCode, KeyEvent event) {
    boolean isKeyCodeSupported;
    if (keyCode == 4 || keyCode == 24 || keyCode == 25 || keyCode == 164 || keyCode == 82 || keyCode == 5 || keyCode == 6) {
        isKeyCodeSupported = false;
    } else {
        isKeyCodeSupported = true;
    }
    if (isInPlaybackState() && isKeyCodeSupported && this.mediaController != null) {
        if (keyCode == 79 || keyCode == 85) {
            if (this.mMediaPlayer.isPlaying()) {
                pause();
                this.mediaController.show();
                return true;
            }
            start();
            this.mediaController.hide();
            return true;
        } else if (keyCode == TransportMediator.KEYCODE_MEDIA_PLAY) {
            if (this.mMediaPlayer.isPlaying()) {
                return true;
            }
            start();
            this.mediaController.hide();
            return true;
        } else if (keyCode != 86 && keyCode != TransportMediator.KEYCODE_MEDIA_PAUSE) {
            toggleMediaControlsVisiblity();
        } else if (!this.mMediaPlayer.isPlaying()) {
            return true;
        } else {
            pause();
            this.mediaController.show();
            return true;
        }
    }
    return super.onKeyDown(keyCode, event);
}
 
Example #7
Source File: d.java    From letv with Apache License 2.0 5 votes vote down vote up
public final long b() {
    long j = 0;
    for (int i = 0; i < 64; i += 7) {
        byte i2 = i();
        j |= ((long) (i2 & TransportMediator.KEYCODE_MEDIA_PAUSE)) << i;
        if ((i2 & 128) == 0) {
            return j;
        }
    }
    throw j.c();
}
 
Example #8
Source File: d.java    From letv with Apache License 2.0 5 votes vote down vote up
public final int f() {
    byte i = i();
    if (i >= (byte) 0) {
        return i;
    }
    int i2 = i & TransportMediator.KEYCODE_MEDIA_PAUSE;
    byte i3 = i();
    if (i3 >= (byte) 0) {
        return i2 | (i3 << 7);
    }
    i2 |= (i3 & TransportMediator.KEYCODE_MEDIA_PAUSE) << 7;
    i3 = i();
    if (i3 >= (byte) 0) {
        return i2 | (i3 << 14);
    }
    i2 |= (i3 & TransportMediator.KEYCODE_MEDIA_PAUSE) << 14;
    i3 = i();
    if (i3 >= (byte) 0) {
        return i2 | (i3 << 21);
    }
    i2 |= (i3 & TransportMediator.KEYCODE_MEDIA_PAUSE) << 21;
    i3 = i();
    i2 |= i3 << 28;
    if (i3 >= (byte) 0) {
        return i2;
    }
    for (int i4 = 0; i4 < 5; i4++) {
        if (i() >= (byte) 0) {
            return i2;
        }
    }
    throw j.c();
}
 
Example #9
Source File: e.java    From letv with Apache License 2.0 5 votes vote down vote up
private void b(long j) {
    while ((-128 & j) != 0) {
        b((((int) j) & TransportMediator.KEYCODE_MEDIA_PAUSE) | 128);
        j >>>= 7;
    }
    b((int) j);
}
 
Example #10
Source File: e.java    From letv with Apache License 2.0 5 votes vote down vote up
private void d(int i) {
    while ((i & -128) != 0) {
        b((i & TransportMediator.KEYCODE_MEDIA_PAUSE) | 128);
        i >>>= 7;
    }
    b(i);
}
 
Example #11
Source File: ExpandedControllerActivity.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public int onGetTransportControlFlags() {
    int flags = TransportMediator.FLAG_KEY_MEDIA_REWIND
            | TransportMediator.FLAG_KEY_MEDIA_FAST_FORWARD;
    if (mMediaRouteController != null && mMediaRouteController.isPlaying()) {
        flags |= TransportMediator.FLAG_KEY_MEDIA_PAUSE;
    } else {
        flags |= TransportMediator.FLAG_KEY_MEDIA_PLAY;
    }
    return flags;
}
 
Example #12
Source File: ExpandedControllerActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public int onGetTransportControlFlags() {
    int flags = TransportMediator.FLAG_KEY_MEDIA_REWIND
            | TransportMediator.FLAG_KEY_MEDIA_FAST_FORWARD;
    if (mMediaRouteController != null && mMediaRouteController.isPlaying()) {
        flags |= TransportMediator.FLAG_KEY_MEDIA_PAUSE;
    } else {
        flags |= TransportMediator.FLAG_KEY_MEDIA_PLAY;
    }
    return flags;
}
 
Example #13
Source File: TransportControllerActivity.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
@Override public int onGetTransportControlFlags() {
    int flags = TransportMediator.FLAG_KEY_MEDIA_PLAY
            | TransportMediator.FLAG_KEY_MEDIA_PLAY_PAUSE
            | TransportMediator.FLAG_KEY_MEDIA_STOP;
    if (mContent.canPause()) {
        flags |= TransportMediator.FLAG_KEY_MEDIA_PAUSE;
    }
    if (mContent.canSeekBackward()) {
        flags |= TransportMediator.FLAG_KEY_MEDIA_REWIND;
    }
    if (mContent.canSeekForward()) {
        flags |= TransportMediator.FLAG_KEY_MEDIA_FAST_FORWARD;
    }
    return flags;
}
 
Example #14
Source File: TransportControllerActivity.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
public void init(Activity activity, TransportMediator transportMediator,
        MediaController mediaController) {
    // This called by the containing activity to supply the surrounding
    // state of the video player that it will interact with.
    mActivity = activity;
    mTransportMediator = transportMediator;
    mMediaController = mediaController;
    pause();
}
 
Example #15
Source File: ExpandedControllerActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MediaNotificationUma.recordClickSource(getIntent());

    mMediaRouteController =
            RemoteMediaPlayerController.instance().getCurrentlyPlayingMediaRouteController();

    if (mMediaRouteController == null || mMediaRouteController.routeIsDefaultRoute()) {
        // We don't want to do anything for the default (local) route
        finish();
        return;
    }

    // Make the activity full screen.
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // requestWindowFeature must be called before adding content.
    setContentView(R.layout.expanded_cast_controller);
    mHandler = new Handler();

    ViewGroup rootView = (ViewGroup) findViewById(android.R.id.content);
    rootView.setBackgroundColor(Color.BLACK);

    mMediaRouteController.addUiListener(this);

    // Create transport controller to control video, giving the callback
    // interface to receive actions from.
    mTransportMediator = new TransportMediator(this, mTransportPerformer);

    // Create and initialize the media control UI.
    mMediaController = (MediaController) findViewById(R.id.cast_media_controller);
    mMediaController.setMediaPlayer(mTransportMediator);

    View button = getLayoutInflater().inflate(R.layout.cast_controller_media_route_button,
            rootView, false);

    if (button instanceof FullscreenMediaRouteButton) {
        mMediaRouteButton = (FullscreenMediaRouteButton) button;
        rootView.addView(mMediaRouteButton);
        mMediaRouteButton.bringToFront();
        mMediaRouteButton.initialize(mMediaRouteController);
    } else {
        mMediaRouteButton = null;
    }

    // Initialize the video info.
    setVideoInfo(new RemoteVideoInfo(null, 0, RemoteVideoInfo.PlayerState.STOPPED, 0, null));

    mMediaController.refresh();

    scheduleProgressUpdate();
}
 
Example #16
Source File: ExpandedControllerActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MediaNotificationUma.recordClickSource(getIntent());

    mMediaRouteController =
            RemoteMediaPlayerController.instance().getCurrentlyPlayingMediaRouteController();

    if (mMediaRouteController == null || mMediaRouteController.routeIsDefaultRoute()) {
        // We don't want to do anything for the default (local) route
        finish();
        return;
    }

    // Make the activity full screen.
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // requestWindowFeature must be called before adding content.
    setContentView(R.layout.expanded_cast_controller);
    mHandler = new Handler();

    ViewGroup rootView = (ViewGroup) findViewById(android.R.id.content);
    rootView.setBackgroundColor(Color.BLACK);

    mMediaRouteController.addUiListener(this);

    // Create transport controller to control video, giving the callback
    // interface to receive actions from.
    mTransportMediator = new TransportMediator(this, mTransportPerformer);

    // Create and initialize the media control UI.
    mMediaController = (MediaController) findViewById(R.id.cast_media_controller);
    mMediaController.setMediaPlayer(mTransportMediator);

    View button = getLayoutInflater().inflate(R.layout.cast_controller_media_route_button,
            rootView, false);

    if (button instanceof FullscreenMediaRouteButton) {
        mMediaRouteButton = (FullscreenMediaRouteButton) button;
        rootView.addView(mMediaRouteButton);
        mMediaRouteButton.bringToFront();
        mMediaRouteButton.initialize(mMediaRouteController);
    } else {
        mMediaRouteButton = null;
    }

    // Initialize the video info.
    setVideoInfo(new RemoteVideoInfo(null, 0, RemoteVideoInfo.PlayerState.STOPPED, 0, null));

    mMediaController.refresh();

    scheduleProgressUpdate();
}