use of com.frostwire.android.core.player.CoreMediaPlayer in project frostwire by frostwire.
the class PreviewPlayerActivity method stopAnyOtherPlayers.
public void stopAnyOtherPlayers() {
try {
final CoreMediaPlayer mediaPlayer = Engine.instance().getMediaPlayer();
if (mediaPlayer != null && mediaPlayer.isPlaying()) {
mediaPlayer.stop();
}
} catch (Throwable ignored) {
}
AudioManager mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if (mAudioManager != null && mAudioManager.isMusicActive()) {
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
getApplication().sendBroadcast(i);
}
}
use of com.frostwire.android.core.player.CoreMediaPlayer in project frostwire by frostwire.
the class FileListAdapter method populateViewPlain.
private void populateViewPlain(View view, FileDescriptorItem item) {
FileDescriptor fd = item.fd;
TextView title = findView(view, R.id.view_my_files_thumbnail_list_image_item_file_title);
title.setText(fd.title);
TextView fileExtra = findView(view, R.id.view_my_files_thumbnail_list_image_item_extra_text);
if (fd.fileType == Constants.FILE_TYPE_AUDIO || fd.fileType == Constants.FILE_TYPE_APPLICATIONS) {
fileExtra.setText(fd.artist);
} else if (fd.fileType == Constants.FILE_TYPE_DOCUMENTS) {
fileExtra.setText(FilenameUtils.getExtension(fd.filePath));
} else {
fileExtra.setText(R.string.empty_string);
}
TextView fileSize = findView(view, R.id.view_my_files_thumbnail_list_image_item_file_size);
fileSize.setText(UIUtils.getBytesInHuman(fd.fileSize));
ImageButton downloadButton = findView(view, inGridMode() ? R.id.view_my_files_thumbnail_grid_item_browse_thumbnail_image_button : R.id.view_my_files_thumbnail_list_item_browse_thumbnail_image_button);
MediaPlaybackStatusOverlayView mediaOverlayView = findView(view, inGridMode() ? R.id.view_my_files_thumbnail_grid_item_playback_overlay_view : R.id.view_my_files_thumbnail_list_item_playback_overlay_view);
CoreMediaPlayer mediaPlayer = Engine.instance().getMediaPlayer();
if (mediaPlayer != null) {
if (fd.equals(mediaPlayer.getCurrentFD(getContext())) || fd.equals(mediaPlayer.getSimplePlayerCurrentFD(getContext()))) {
mediaOverlayView.setPlaybackState(MediaPlaybackOverlayPainter.MediaPlaybackState.STOP);
} else {
mediaOverlayView.setPlaybackState(MediaPlaybackOverlayPainter.MediaPlaybackState.PLAY);
}
}
downloadButton.setTag(fd);
downloadButton.setOnClickListener(downloadButtonClickListener);
populateSDState(view, item);
}
use of com.frostwire.android.core.player.CoreMediaPlayer in project frostwire by frostwire.
the class MiniPlayerView method onPlayPauseLongClick.
private void onPlayPauseLongClick() {
CoreMediaPlayer mediaPlayer = Engine.instance().getMediaPlayer();
if (mediaPlayer == null) {
return;
}
mediaPlayer.stop();
setVisibility(View.GONE);
}
use of com.frostwire.android.core.player.CoreMediaPlayer in project frostwire by frostwire.
the class MiniPlayerView method refreshOnTimerResultTask.
private static FileDescriptor refreshOnTimerResultTask(MiniPlayerView miniPlayer) {
CoreMediaPlayer mp = Engine.instance().getMediaPlayer();
if (mp != null) {
miniPlayer.isPlaying = MusicUtils.isPlaying();
miniPlayer.currentAlbumId = MusicUtils.getCurrentAlbumId();
return mp.getCurrentFD(miniPlayer.getContext());
}
return null;
}
use of com.frostwire.android.core.player.CoreMediaPlayer in project frostwire by frostwire.
the class MiniPlayerView method onPlayPauseClick.
private void onPlayPauseClick() {
CoreMediaPlayer mediaPlayer = Engine.instance().getMediaPlayer();
if (mediaPlayer == null) {
return;
}
MusicUtils.playOrPause();
refreshComponents();
}
Aggregations