use of com.waz.zclient.controllers.mediaplayer.MediaPlayerState in project wire-android by wireapp.
the class SpotifyMediaPlayer method onLoggedIn.
@Override
public void onLoggedIn() {
if (mediaPlayerState == MediaPlayerState.Paused) {
mediaPlayer.getPlayerState(new PlayerStateCallback() {
@Override
public void onPlayerState(PlayerState playerState) {
if (dataSource.toString().equals(playerState.trackUri)) {
mediaPlayer.resume();
} else {
reset();
onLoggedIn();
}
}
});
} else {
if (listener != null && !mediaPlayerState.isStartAllowed()) {
setState(MediaPlayerState.Prepared);
listener.onPrepared();
} else {
mediaPlayer.play(PlayConfig.createFor(dataSource.toString()).withInitialPosition(currentPosition));
}
}
}
use of com.waz.zclient.controllers.mediaplayer.MediaPlayerState in project wire-android by wireapp.
the class RightIndicatorView method updateMediaPlayerIndicator.
private boolean updateMediaPlayerIndicator() {
if (streamMediaPlayerController == null) {
mediaControlView.setVisibility(GONE);
return false;
}
MediaPlayerState mediaPlayerState = streamMediaPlayerController.getMediaPlayerState(conversation.getId());
if (!streamMediaPlayerController.isSelectedConversation(conversation.getId()) || mediaPlayerState == MediaPlayerState.PlaybackCompleted || mediaPlayerState == MediaPlayerState.Stopped) {
mediaControlView.setVisibility(GONE);
return false;
}
if (mediaPlayerState.isPauseControl()) {
mediaControlView.setText(R.string.glyph__pause);
mediaControlView.setVisibility(VISIBLE);
return true;
} else if (mediaPlayerState.isPlayControl()) {
mediaControlView.setText(R.string.glyph__play);
mediaControlView.setVisibility(VISIBLE);
return true;
} else {
mediaControlView.setVisibility(GONE);
return false;
}
}
use of com.waz.zclient.controllers.mediaplayer.MediaPlayerState in project wire-android by wireapp.
the class MediaPlayerView method setAllowControl.
public void setAllowControl(boolean allowControl) {
this.allowControl = allowControl;
final MediaPlayerState state = lastMediaState;
this.lastMediaState = null;
updateControl(state);
}
use of com.waz.zclient.controllers.mediaplayer.MediaPlayerState in project wire-android by wireapp.
the class StreamMediaPlayerBarFragment method updateMediaPlayerIndicator.
private void updateMediaPlayerIndicator() {
if (streamMediaController == null) {
return;
}
Message trackMetaData = streamMediaController.getMessage();
MediaPlayerState mediaPlayerState = streamMediaController.getMediaPlayerState(trackMetaData);
if (mediaPlayerState == MediaPlayerState.PlaybackCompleted) {
return;
}
if (mediaPlayerState.isPauseControl()) {
toolbar.setNavigationIcon(ThemeUtils.isDarkTheme(getContext()) ? R.drawable.ic_action_pause_light : R.drawable.ic_action_pause_dark);
} else if (mediaPlayerState.isPlayControl()) {
toolbar.setNavigationIcon(ThemeUtils.isDarkTheme(getContext()) ? R.drawable.ic_action_play_light : R.drawable.ic_action_play_dark);
}
}
Aggregations