Search in sources :

Example 1 with CoreMediaPlayer

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);
    }
}
Also used : AudioManager(android.media.AudioManager) CoreMediaPlayer(com.frostwire.android.core.player.CoreMediaPlayer) Intent(android.content.Intent)

Example 2 with CoreMediaPlayer

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);
}
Also used : ImageButton(android.widget.ImageButton) CoreMediaPlayer(com.frostwire.android.core.player.CoreMediaPlayer) TextView(android.widget.TextView) FileDescriptor(com.frostwire.android.core.FileDescriptor) MediaPlaybackStatusOverlayView(com.frostwire.android.gui.views.MediaPlaybackStatusOverlayView)

Example 3 with CoreMediaPlayer

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);
}
Also used : CoreMediaPlayer(com.frostwire.android.core.player.CoreMediaPlayer)

Example 4 with CoreMediaPlayer

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;
}
Also used : CoreMediaPlayer(com.frostwire.android.core.player.CoreMediaPlayer)

Example 5 with CoreMediaPlayer

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();
}
Also used : CoreMediaPlayer(com.frostwire.android.core.player.CoreMediaPlayer)

Aggregations

CoreMediaPlayer (com.frostwire.android.core.player.CoreMediaPlayer)5 Intent (android.content.Intent)1 AudioManager (android.media.AudioManager)1 ImageButton (android.widget.ImageButton)1 TextView (android.widget.TextView)1 FileDescriptor (com.frostwire.android.core.FileDescriptor)1 MediaPlaybackStatusOverlayView (com.frostwire.android.gui.views.MediaPlaybackStatusOverlayView)1