Search in sources :

Example 6 with PlaybackServiceStarter

use of de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter in project AntennaPod by AntennaPod.

the class PlayActionButton method onClick.

@Override
public void onClick(Context context) {
    FeedMedia media = item.getMedia();
    if (media == null) {
        return;
    }
    if (!media.fileExists()) {
        DBTasks.notifyMissingFeedMediaFile(context, media);
        return;
    }
    new PlaybackServiceStarter(context, media).callEvenIfRunning(true).startWhenPrepared(true).shouldStream(false).start();
    if (media.getMediaType() == MediaType.VIDEO) {
        context.startActivity(PlaybackService.getPlayerActivityIntent(context, media));
    }
}
Also used : PlaybackServiceStarter(de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia)

Example 7 with PlaybackServiceStarter

use of de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter in project AntennaPod by AntennaPod.

the class StreamActionButton method onClick.

@Override
public void onClick(Context context) {
    final FeedMedia media = item.getMedia();
    if (media == null) {
        return;
    }
    UsageStatistics.logAction(UsageStatistics.ACTION_STREAM);
    if (!NetworkUtils.isStreamingAllowed()) {
        new StreamingConfirmationDialog(context, media).show();
        return;
    }
    new PlaybackServiceStarter(context, media).callEvenIfRunning(true).startWhenPrepared(true).shouldStream(true).start();
    if (media.getMediaType() == MediaType.VIDEO) {
        context.startActivity(PlaybackService.getPlayerActivityIntent(context, media));
    }
}
Also used : PlaybackServiceStarter(de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia) StreamingConfirmationDialog(de.danoeh.antennapod.dialog.StreamingConfirmationDialog)

Aggregations

PlaybackServiceStarter (de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter)7 FeedMedia (de.danoeh.antennapod.model.feed.FeedMedia)5 StreamingConfirmationDialog (de.danoeh.antennapod.dialog.StreamingConfirmationDialog)2 FeedItem (de.danoeh.antennapod.model.feed.FeedItem)2 LayoutInflater (android.view.LayoutInflater)1 NonNull (androidx.annotation.NonNull)1 Playable (de.danoeh.antennapod.model.playback.Playable)1 RemoteMedia (de.danoeh.antennapod.model.playback.RemoteMedia)1