當前位置: 首頁>>代碼示例>>Java>>正文


Java PlaybackState.STATE_CONNECTING屬性代碼示例

本文整理匯總了Java中android.media.session.PlaybackState.STATE_CONNECTING屬性的典型用法代碼示例。如果您正苦於以下問題:Java PlaybackState.STATE_CONNECTING屬性的具體用法?Java PlaybackState.STATE_CONNECTING怎麽用?Java PlaybackState.STATE_CONNECTING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.media.session.PlaybackState的用法示例。


在下文中一共展示了PlaybackState.STATE_CONNECTING屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onClick

@Override
public void onClick(View v) {
    PlaybackState stateObj = getActivity().getMediaController().getPlaybackState();
    final int state = stateObj == null ?
            PlaybackState.STATE_NONE : stateObj.getState();
    LogHelper.d(TAG, "Button pressed, in state " + state);
    switch (v.getId()) {
        case R.id.play_pause:
            LogHelper.d(TAG, "Play button pressed, in state " + state);
            if (state == PlaybackState.STATE_PAUSED ||
                    state == PlaybackState.STATE_STOPPED ||
                    state == PlaybackState.STATE_NONE) {
                playMedia();
            } else if (state == PlaybackState.STATE_PLAYING ||
                    state == PlaybackState.STATE_BUFFERING ||
                    state == PlaybackState.STATE_CONNECTING) {
                pauseMedia();
            }
            break;
    }
}
 
開發者ID:mrinalgit-dev,項目名稱:MrinalMusicPlayer,代碼行數:21,代碼來源:PlaybackControlsFragment.java

示例2: isMediaPlaying

@Override
public boolean isMediaPlaying() {
    if (mMediaController.getPlaybackState() == null) {
        return false;
    }
    int state = mMediaController.getPlaybackState().getState();
    return (state == PlaybackState.STATE_BUFFERING
            || state == PlaybackState.STATE_CONNECTING
            || state == PlaybackState.STATE_PLAYING
            || state == PlaybackState.STATE_FAST_FORWARDING
            || state == PlaybackState.STATE_REWINDING
            || state == PlaybackState.STATE_SKIPPING_TO_PREVIOUS
            || state == PlaybackState.STATE_SKIPPING_TO_NEXT);
}
 
開發者ID:nejtv,項目名稱:androidtv-sample,代碼行數:14,代碼來源:PlaybackControlHelper.java

示例3: prepare

/**
 * Prepares playback.
 *
 * @param doPlay indicates DVR player do or do not start playback after media is prepared.
 */
public void prepare(boolean doPlay) throws IllegalStateException {
    if (DEBUG) Log.d(TAG, "prepare()");
    if (mProgram == null) {
        throw new IllegalStateException("Recorded program not set");
    } else if (mPlaybackState != PlaybackState.STATE_NONE) {
        throw new IllegalStateException("Playback is already prepared");
    }
    mTvView.timeShiftPlay(mProgram.getInputId(), mProgram.getUri());
    mPlaybackState = PlaybackState.STATE_CONNECTING;
    mPauseOnPrepared = !doPlay;
    mCallback.onPlaybackStateChanged(mPlaybackState, 1);
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:17,代碼來源:DvrPlayer.java

示例4: isMediaPlaying

@Override
public boolean isMediaPlaying() {
    PlaybackState playbackState = mMediaController.getPlaybackState();
    if (playbackState == null) {
        return false;
    }
    int state = playbackState.getState();
    return state != PlaybackState.STATE_NONE && state != PlaybackState.STATE_CONNECTING
            && state != PlaybackState.STATE_PAUSED;
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:10,代碼來源:DvrPlaybackControlHelper.java

示例5: switchToPlayer

/**
 * Helper to switch to a different Playback instance
 * @param playback switch to this playback
 */
private void switchToPlayer(Playback playback, boolean resumePlaying) {
    if (playback == null) {
        throw new IllegalArgumentException("Playback cannot be null");
    }
    // suspend the current one.
    int oldState = mPlayback.getState();
    int pos = mPlayback.getCurrentStreamPosition();
    String currentMediaId = mPlayback.getCurrentMediaId();
    mPlayback.stop(false);
    playback.setCallback(this);
    playback.setCurrentStreamPosition(pos < 0 ? 0 : pos);
    playback.setCurrentMediaId(currentMediaId);
    playback.start();
    // finally swap the instance
    mPlayback = playback;
    switch (oldState) {
        case PlaybackState.STATE_BUFFERING:
        case PlaybackState.STATE_CONNECTING:
        case PlaybackState.STATE_PAUSED:
            mPlayback.pause();
            break;
        case PlaybackState.STATE_PLAYING:
            if (resumePlaying && QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
                mPlayback.play(mPlayingQueue.get(mCurrentIndexOnQueue));
            } else if (!resumePlaying) {
                mPlayback.pause();
            } else {
                mPlayback.stop(true);
            }
            break;
        case PlaybackState.STATE_NONE:
            break;
        default:
            LogHelper.d(TAG, "Default called. Old state is ", oldState);
    }
}
 
開發者ID:mrinalgit-dev,項目名稱:MrinalMusicPlayer,代碼行數:40,代碼來源:MusicService.java

示例6: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    Timber.e("onPlayerStateChanged: playWhenReady = " + String.valueOf(playWhenReady)
            + " playbackState = " + playbackState);
    switch (playbackState) {
        case PlaybackState.STATE_PLAYING:
            //初始化播放點擊事件並設置總時長
            initPlayVideo();
            Timber.e("播放狀態: 準備 playing");
            break;

        case PlaybackState.STATE_BUFFERING:
            Timber.e("播放狀態: 緩存完成 playing");
            break;

        case PlaybackState.STATE_CONNECTING:
            Timber.e("播放狀態: 連接 CONNECTING");
            break;

        case PlaybackState.STATE_ERROR://錯誤
            Timber.e("播放狀態: 錯誤 STATE_ERROR");
            startPlay.setBackgroundColor(Color.WHITE);
            ToastUtil.showShort("播放錯誤");
            break;

        case PlaybackState.STATE_FAST_FORWARDING:
            Timber.e("播放狀態: 快速傳遞,播放完畢");

            pausePlay();//暫停播放
            break;

        case PlaybackState.STATE_NONE:
            Timber.e("播放狀態: 無 STATE_NONE");
            break;

        case PlaybackState.STATE_PAUSED:
            Timber.e("播放狀態: 暫停 PAUSED");
            break;

        case PlaybackState.STATE_REWINDING:
            Timber.e("播放狀態: 倒回 REWINDING");
            break;

        case PlaybackState.STATE_SKIPPING_TO_NEXT:
            Timber.e("播放狀態: 跳到下一個");
            break;

        case PlaybackState.STATE_SKIPPING_TO_PREVIOUS:
            Timber.e("播放狀態: 跳到上一個");
            break;

        case PlaybackState.STATE_SKIPPING_TO_QUEUE_ITEM:
            Timber.e("播放狀態: 跳到指定的Item");
            break;

        case PlaybackState.STATE_STOPPED:
            Timber.e("播放狀態: 停止的 STATE_STOPPED");
            break;


    }
}
 
開發者ID:ChangWeiBa,項目名稱:AesExoPlayer,代碼行數:62,代碼來源:TestPlayerActivity.java

示例7: isPlaybackPrepared

/**
 * Returns if playback of the recorded program is started.
 */
public boolean isPlaybackPrepared() {
    return mPlaybackState != PlaybackState.STATE_NONE
            && mPlaybackState != PlaybackState.STATE_CONNECTING;
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:7,代碼來源:DvrPlayer.java

示例8: onStateChanged

private void onStateChanged(int state, long positionMs, int speedLevel) {
    if (DEBUG) Log.d(TAG, "onStateChanged");
    getControlsRow().setCurrentTime((int) positionMs);
    if (state == mPlaybackState && mPlaybackSpeedLevel == speedLevel) {
        // Only position is changed, no need to update controls row
        return;
    }
    // NOTICE: The below two variables should only be used in this method.
    // The only usage of them is to confirm if the state is changed or not.
    mPlaybackState = state;
    mPlaybackSpeedLevel = speedLevel;
    switch (state) {
        case PlaybackState.STATE_PLAYING:
            mPlaybackSpeedId = PLAYBACK_SPEED_NORMAL;
            setFadingEnabled(true);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_PAUSED:
            mPlaybackSpeedId = PLAYBACK_SPEED_PAUSED;
            setFadingEnabled(true);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_FAST_FORWARDING:
            mPlaybackSpeedId = PLAYBACK_SPEED_FAST_L0 + speedLevel;
            setFadingEnabled(false);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_REWINDING:
            mPlaybackSpeedId = -PLAYBACK_SPEED_FAST_L0 - speedLevel;
            setFadingEnabled(false);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_CONNECTING:
            setFadingEnabled(false);
            mReadyToControl = false;
            break;
        case PlaybackState.STATE_NONE:
            mReadyToControl = false;
            break;
        default:
            setFadingEnabled(true);
            break;
    }
    onStateChanged();
}
 
開發者ID:trevd,項目名稱:android_packages_apps_tv,代碼行數:45,代碼來源:DvrPlaybackControlHelper.java


注:本文中的android.media.session.PlaybackState.STATE_CONNECTING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。