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


Java RemoteControlClient.PLAYSTATE_STOPPED屬性代碼示例

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


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

示例1: getStateFromPlayState

static int getStateFromPlayState(PlayState playState) {
    switch (playState) {
        case BUFFERING:
            return RemoteControlClient.PLAYSTATE_BUFFERING;
        case ERROR:
            return RemoteControlClient.PLAYSTATE_ERROR;
        case FAST_FORWARDING:
            return RemoteControlClient.PLAYSTATE_FAST_FORWARDING;
        case PAUSED:
            return RemoteControlClient.PLAYSTATE_PAUSED;
        case PLAYING:
            return RemoteControlClient.PLAYSTATE_PLAYING;
        case REWINDING:
            return RemoteControlClient.PLAYSTATE_REWINDING;
        case SKIPPING_BACKWARDS:
            return RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS;
        case SKIPPING_FORWARDS:
            return RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS;
        case STOPPED:
            return RemoteControlClient.PLAYSTATE_STOPPED;
        default:
            return RemoteControlClient.PLAYSTATE_ERROR;
    }
}
 
開發者ID:Tombarr,項目名稱:Noyze,代碼行數:24,代碼來源:MediaProviderDelegate.java

示例2: wasPlayingRecently

public boolean wasPlayingRecently() {
    switch (mState) {
        case RemoteControlClient.PLAYSTATE_PLAYING:
        case RemoteControlClient.PLAYSTATE_FAST_FORWARDING:
        case RemoteControlClient.PLAYSTATE_REWINDING:
        case RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS:
        case RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS:
        case RemoteControlClient.PLAYSTATE_BUFFERING:
            // actively playing or about to play
            return true;
        case RemoteControlClient.PLAYSTATE_STOPPED:
        case RemoteControlClient.PLAYSTATE_PAUSED:
        case RemoteControlClient.PLAYSTATE_ERROR:
            return ((SystemClock.elapsedRealtime() - mStateChangeTimeMs) < DISPLAY_TIMEOUT_MS);
        default:
            LOGE("PlaybackInfo", "Unknown playback state " + mState + " in wasPlayingRecently()");
            return false;
    }
}
 
開發者ID:Tombarr,項目名稱:Noyze,代碼行數:19,代碼來源:PlaybackInfo.java

示例3: stopPlaying

public void stopPlaying() {
    if (mPlayState != RemoteControlClient.PLAYSTATE_STOPPED) {
        mPlayState = RemoteControlClient.PLAYSTATE_STOPPED;
        mRemoteControl.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
    }
    dropAudioFocus();
}
 
開發者ID:bestarandyan,項目名稱:ShoppingMall,代碼行數:7,代碼來源:TransportMediatorJellybeanMR2.java

示例4: setPlaybackState

@Override
public void setPlaybackState(int state, int index, int queueSize) {
	PlaybackState.Builder builder = new PlaybackState.Builder();

	int newState = PlaybackState.STATE_NONE;
	switch(state) {
		case RemoteControlClient.PLAYSTATE_PLAYING:
			newState = PlaybackState.STATE_PLAYING;
			break;
		case RemoteControlClient.PLAYSTATE_STOPPED:
			newState = PlaybackState.STATE_STOPPED;
			break;
		case RemoteControlClient.PLAYSTATE_PAUSED:
			newState = PlaybackState.STATE_PAUSED;
			break;
		case RemoteControlClient.PLAYSTATE_BUFFERING:
			newState = PlaybackState.STATE_BUFFERING;
			break;
	}

	long position = -1;
	if(state == RemoteControlClient.PLAYSTATE_PLAYING || state == RemoteControlClient.PLAYSTATE_PAUSED) {
		position = downloadService.getPlayerPosition();
	}
	builder.setState(newState, position, 1.0f);
	DownloadFile downloadFile = downloadService.getCurrentPlaying();
	Entry entry = null;
	boolean isSong = true;
	if(downloadFile != null) {
		entry = downloadFile.getSong();
		isSong = entry.isSong();
	}

	builder.setActions(getPlaybackActions(isSong, index, queueSize));

	if(entry != null) {
		addCustomActions(entry, builder);
		builder.setActiveQueueItemId(entry.getId().hashCode());
	}

	PlaybackState playbackState = builder.build();
	mediaSession.setPlaybackState(playbackState);
	previousState = state;
}
 
開發者ID:popeen,項目名稱:Popeens-DSub,代碼行數:44,代碼來源:RemoteControlClientLP.java


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