本文整理匯總了Java中android.media.session.PlaybackState.ACTION_PLAY_FROM_MEDIA_ID屬性的典型用法代碼示例。如果您正苦於以下問題:Java PlaybackState.ACTION_PLAY_FROM_MEDIA_ID屬性的具體用法?Java PlaybackState.ACTION_PLAY_FROM_MEDIA_ID怎麽用?Java PlaybackState.ACTION_PLAY_FROM_MEDIA_ID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.media.session.PlaybackState
的用法示例。
在下文中一共展示了PlaybackState.ACTION_PLAY_FROM_MEDIA_ID屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAvailableActions
private long getAvailableActions(int nextState) {
long actions = PlaybackState.ACTION_PLAY |
PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_PLAY_FROM_SEARCH |
PlaybackState.ACTION_SKIP_TO_NEXT |
PlaybackState.ACTION_SKIP_TO_PREVIOUS |
PlaybackState.ACTION_FAST_FORWARD |
PlaybackState.ACTION_REWIND |
PlaybackState.ACTION_PAUSE;
if (nextState == PlaybackState.STATE_PLAYING) {
actions |= PlaybackState.ACTION_PAUSE;
}
return actions;
}
示例2: getAvailableActions
private long getAvailableActions() {
long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_PLAY_FROM_SEARCH;
if (mPlayingQueue == null || mPlayingQueue.isEmpty()) {
return actions;
}
if (mPlayback.isPlaying()) {
actions |= PlaybackState.ACTION_PAUSE;
}
if (mCurrentIndexOnQueue > 0) {
actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
}
if (mCurrentIndexOnQueue < mPlayingQueue.size() - 1) {
actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
}
return actions;
}
示例3: getAvailableActions
private long getAvailableActions() {
long actions = PlaybackState.ACTION_PLAY |
PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_PLAY_FROM_SEARCH;
if (mPlaybackState == LeanbackPlaybackState.PLAYING) {
actions |= PlaybackState.ACTION_PAUSE;
}
return actions;
}
示例4: getAvailableActions
private long getAvailableActions() {
long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID | PlaybackState.ACTION_PLAY_FROM_SEARCH;
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject != null) {
if (!MediaController.getInstance().isAudioPaused()) {
actions |= PlaybackState.ACTION_PAUSE;
}
actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
}
return actions;
}
示例5: getAvailableActions
private long getAvailableActions() {
long actions = PlaybackState.ACTION_PLAY |
PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_PLAY_FROM_SEARCH |
PlaybackState.ACTION_SKIP_TO_NEXT |
PlaybackState.ACTION_SKIP_TO_PREVIOUS |
PlaybackState.ACTION_FAST_FORWARD |
PlaybackState.ACTION_REWIND;
if (mPlaybackState == LeanbackPlaybackState.PLAYING) actions |= PlaybackState.ACTION_PAUSE;
return actions;
}
示例6: availableActions
private long availableActions() {
Log.d ( TAG, "availableActions()...") ;
long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_SKIP_TO_NEXT | PlaybackState.ACTION_SKIP_TO_PREVIOUS
| PlaybackState.ACTION_SKIP_TO_NEXT |PlaybackState.ACTION_PLAY_FROM_SEARCH
| PlaybackState.ACTION_PLAY_FROM_URI ;
if (isPlaying()) {
actions |= PlaybackState.ACTION_PAUSE;
}
return actions;
}
示例7: getAvailableActions
private long getAvailableActions() {
long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_PLAY_FROM_SEARCH |
PlaybackState.ACTION_SKIP_TO_NEXT | PlaybackState.ACTION_SKIP_TO_PREVIOUS;
if (isPlaying()) {
actions |= PlaybackState.ACTION_PAUSE;
}
return actions;
}
示例8: updateMediaSession
private void updateMediaSession(final String what) {
LogUtils.i(TAG, "updateMediaSession what : " + what);
int playState = mIsSupposedToBePlaying
? PlaybackState.STATE_PLAYING
: PlaybackState.STATE_PAUSED;
long playBackStateActions = PlaybackState.ACTION_PLAY |
PlaybackState.ACTION_PLAY_PAUSE |
PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
PlaybackState.ACTION_PAUSE |
PlaybackState.ACTION_SKIP_TO_NEXT |
PlaybackState.ACTION_SKIP_TO_PREVIOUS |
PlaybackState.ACTION_STOP;
if (what.equals(MusicServiceConstants.PLAYSTATE_CHANGED) || what.equals(MusicServiceConstants.POSITION_CHANGED)) {
mSession.setPlaybackState(new PlaybackState.Builder()
.setActions(playBackStateActions)
.setActiveQueueItemId(getAudioId())
.setState(playState, position(), 1.0f).build());
} else if (what.equals(META_CHANGED) || what.equals(MusicServiceConstants.QUEUE_CHANGED)) {
LogUtils.i(TAG, "sadsadsadsad thread id : " + Thread.currentThread().getId() + "name : " + Thread.currentThread().getName());
/*if (albumArt != null) {
// RemoteControlClient wants to recycle the bitmaps thrown at it, so we need
// to make sure not to hand out our cache copy
Bitmap.Config config = albumArt.getConfig();
if (config == null) {
config = Bitmap.Config.ARGB_8888;
}
albumArt = albumArt.copy(config, false);
}*/
/*mSession.setMetadata(new MediaMetadataCompat.Builder()
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, getArtistName())
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST, getAlbumArtistName())
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, getAlbumName())
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, getTrackName())
.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration())
.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, getQueuePosition() + 1)
.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, getQueue().length)
.putString(MediaMetadataCompat.METADATA_KEY_GENRE, getGenreName())
.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART,
mShowAlbumArtOnLockscreen ? albumArt : null)
.build());*/
if (what.equals(MusicServiceConstants.QUEUE_CHANGED)) {
updateMediaSessionQueue();
}
mSession.setPlaybackState(new PlaybackState.Builder()
.setActions(playBackStateActions)
.setActiveQueueItemId(getAudioId())
.setState(playState, position(), 1.0f).build());
}
LogUtils.i(TAG, "updateMediaSession finished");
}