Remove deprecated media players (#6354)
This commit is contained in:
parent
3e077e5653
commit
ccea00e405
|
@ -125,7 +125,6 @@ dependencies {
|
||||||
implementation "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyVersion"
|
implementation "com.joanzapata.iconify:android-iconify-fontawesome:$iconifyVersion"
|
||||||
implementation "com.joanzapata.iconify:android-iconify-material:$iconifyVersion"
|
implementation "com.joanzapata.iconify:android-iconify-material:$iconifyVersion"
|
||||||
implementation 'com.leinardi.android:speed-dial:3.2.0'
|
implementation 'com.leinardi.android:speed-dial:3.2.0'
|
||||||
implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion"
|
|
||||||
implementation 'com.github.ByteHamster:SearchPreference:v2.0.0'
|
implementation 'com.github.ByteHamster:SearchPreference:v2.0.0'
|
||||||
implementation 'com.github.skydoves:balloon:1.4.0'
|
implementation 'com.github.skydoves:balloon:1.4.0'
|
||||||
implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3'
|
implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3'
|
||||||
|
|
|
@ -4,45 +4,38 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import androidx.preference.PreferenceManager;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
import androidx.test.filters.LargeTest;
|
import androidx.test.filters.LargeTest;
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
import androidx.test.rule.ActivityTestRule;
|
import androidx.test.rule.ActivityTestRule;
|
||||||
|
import de.danoeh.antennapod.R;
|
||||||
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
|
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||||
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
|
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
|
||||||
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
|
import de.danoeh.antennapod.core.util.LongList;
|
||||||
|
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||||
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
||||||
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.model.feed.SortOrder;
|
import de.danoeh.antennapod.model.feed.SortOrder;
|
||||||
import de.danoeh.antennapod.playback.base.PlayerStatus;
|
import de.danoeh.antennapod.playback.base.PlayerStatus;
|
||||||
|
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||||
|
import de.test.antennapod.EspressoTestUtils;
|
||||||
|
import de.test.antennapod.IgnoreOnCi;
|
||||||
|
import de.test.antennapod.ui.UITestUtils;
|
||||||
import org.awaitility.Awaitility;
|
import org.awaitility.Awaitility;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
|
||||||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
|
||||||
import de.danoeh.antennapod.core.util.LongList;
|
|
||||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
|
||||||
import de.test.antennapod.EspressoTestUtils;
|
|
||||||
import de.test.antennapod.IgnoreOnCi;
|
|
||||||
import de.test.antennapod.ui.UITestUtils;
|
|
||||||
|
|
||||||
import static androidx.test.espresso.Espresso.onView;
|
import static androidx.test.espresso.Espresso.onView;
|
||||||
import static androidx.test.espresso.action.ViewActions.click;
|
import static androidx.test.espresso.action.ViewActions.click;
|
||||||
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
|
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
|
||||||
|
@ -69,31 +62,20 @@ import static org.junit.Assert.assertTrue;
|
||||||
*/
|
*/
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@IgnoreOnCi
|
@IgnoreOnCi
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
public class PlaybackTest {
|
public class PlaybackTest {
|
||||||
@Rule
|
@Rule
|
||||||
public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
|
public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
|
||||||
|
|
||||||
@Parameterized.Parameter(value = 0)
|
|
||||||
public String playerToUse;
|
|
||||||
private UITestUtils uiTestUtils;
|
private UITestUtils uiTestUtils;
|
||||||
protected Context context;
|
protected Context context;
|
||||||
private PlaybackController controller;
|
private PlaybackController controller;
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "{0}")
|
|
||||||
public static Collection<Object[]> initParameters() {
|
|
||||||
return Arrays.asList(new Object[][] { { "exoplayer" }, { "builtin" }, { "sonic" } });
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
context = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
context = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
EspressoTestUtils.clearPreferences();
|
EspressoTestUtils.clearPreferences();
|
||||||
EspressoTestUtils.clearDatabase();
|
EspressoTestUtils.clearDatabase();
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, playerToUse).apply();
|
|
||||||
|
|
||||||
uiTestUtils = new UITestUtils(context);
|
uiTestUtils = new UITestUtils(context);
|
||||||
uiTestUtils.setup();
|
uiTestUtils.setup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,9 @@ import android.text.SpannableString;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.event.PlayerErrorEvent;
|
import de.danoeh.antennapod.event.PlayerErrorEvent;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
|
||||||
|
|
||||||
public class MediaPlayerErrorDialog {
|
public class MediaPlayerErrorDialog {
|
||||||
public static void show(Activity activity, PlayerErrorEvent event) {
|
public static void show(Activity activity, PlayerErrorEvent event) {
|
||||||
|
@ -25,13 +23,6 @@ public class MediaPlayerErrorDialog {
|
||||||
errorDialog.setMessage(errorMessage);
|
errorDialog.setMessage(errorMessage);
|
||||||
errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) ->
|
errorDialog.setPositiveButton(android.R.string.ok, (dialog, which) ->
|
||||||
((MainActivity) activity).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED));
|
((MainActivity) activity).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED));
|
||||||
if (!UserPreferences.useExoplayer()) {
|
|
||||||
errorDialog.setNeutralButton(R.string.media_player_switch_to_exoplayer, (dialog, which) -> {
|
|
||||||
UserPreferences.enableExoplayer();
|
|
||||||
((MainActivity) activity).showSnackbarAbovePlayer(
|
|
||||||
R.string.media_player_switched_to_exoplayer, Snackbar.LENGTH_LONG);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
errorDialog.create().show();
|
errorDialog.create().show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,31 +63,12 @@ public class PlaybackControlsDialog extends DialogFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupUi() {
|
private void setupUi() {
|
||||||
final CheckBox stereoToMono = dialog.findViewById(R.id.stereo_to_mono);
|
|
||||||
stereoToMono.setChecked(UserPreferences.stereoToMono());
|
|
||||||
if (controller != null && !controller.canDownmix()) {
|
|
||||||
stereoToMono.setEnabled(false);
|
|
||||||
String sonicOnly = getString(R.string.sonic_only);
|
|
||||||
stereoToMono.setText(getString(R.string.stereo_to_mono) + " [" + sonicOnly + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
final CheckBox skipSilence = dialog.findViewById(R.id.skipSilence);
|
final CheckBox skipSilence = dialog.findViewById(R.id.skipSilence);
|
||||||
skipSilence.setChecked(UserPreferences.isSkipSilence());
|
skipSilence.setChecked(UserPreferences.isSkipSilence());
|
||||||
if (!UserPreferences.useExoplayer()) {
|
|
||||||
skipSilence.setEnabled(false);
|
|
||||||
String exoplayerOnly = getString(R.string.exoplayer_only);
|
|
||||||
skipSilence.setText(getString(R.string.pref_skip_silence_title) + " [" + exoplayerOnly + "]");
|
|
||||||
}
|
|
||||||
skipSilence.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
skipSilence.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
UserPreferences.setSkipSilence(isChecked);
|
UserPreferences.setSkipSilence(isChecked);
|
||||||
controller.setSkipSilence(isChecked);
|
controller.setSkipSilence(isChecked);
|
||||||
});
|
});
|
||||||
stereoToMono.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
|
||||||
UserPreferences.stereoToMono(isChecked);
|
|
||||||
if (controller != null) {
|
|
||||||
controller.setDownmix(isChecked);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupAudioTracks() {
|
private void setupAudioTracks() {
|
||||||
|
|
|
@ -57,9 +57,6 @@ public class PreferenceUpgrader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion < 1070300) {
|
if (oldVersion < 1070300) {
|
||||||
prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER,
|
|
||||||
UserPreferences.PREF_MEDIA_PLAYER_EXOPLAYER).apply();
|
|
||||||
|
|
||||||
if (prefs.getBoolean("prefEnableAutoDownloadOnMobile", false)) {
|
if (prefs.getBoolean("prefEnableAutoDownloadOnMobile", false)) {
|
||||||
UserPreferences.setAllowMobileAutoDownload(true);
|
UserPreferences.setAllowMobileAutoDownload(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/pref_skip_silence_title" />
|
android:text="@string/pref_skip_silence_title" />
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/stereo_to_mono"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/stereo_to_mono" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
android:id="@+id/imgvCover"
|
android:id="@+id/imgvCover"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:contentDescription="@string/media_player"
|
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
android:maxWidth="96dp"
|
android:maxWidth="96dp"
|
||||||
|
|
|
@ -111,14 +111,4 @@
|
||||||
android:summary="@string/pref_skip_keeps_episodes_sum"
|
android:summary="@string/pref_skip_keeps_episodes_sum"
|
||||||
android:title="@string/pref_skip_keeps_episodes_title"/>
|
android:title="@string/pref_skip_keeps_episodes_title"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/experimental_pref">
|
|
||||||
<de.danoeh.antennapod.preferences.MaterialListPreference
|
|
||||||
android:defaultValue="exoplayer"
|
|
||||||
android:entries="@array/media_player_options"
|
|
||||||
android:key="prefMediaPlayer"
|
|
||||||
android:title="@string/media_player"
|
|
||||||
android:summary="@string/pref_media_player_message"
|
|
||||||
android:entryValues="@array/media_player_values"/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -45,7 +45,6 @@ project.ext {
|
||||||
rxJavaVersion = "2.2.2"
|
rxJavaVersion = "2.2.2"
|
||||||
iconifyVersion = "2.2.2"
|
iconifyVersion = "2.2.2"
|
||||||
exoPlayerVersion = "2.14.2"
|
exoPlayerVersion = "2.14.2"
|
||||||
audioPlayerVersion = "v2.0.0"
|
|
||||||
|
|
||||||
// Google Play build
|
// Google Play build
|
||||||
wearableSupportVersion = "2.6.0"
|
wearableSupportVersion = "2.6.0"
|
||||||
|
|
|
@ -66,7 +66,6 @@ dependencies {
|
||||||
implementation "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion"
|
implementation "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion"
|
||||||
implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion"
|
implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion"
|
||||||
implementation "com.google.android.exoplayer:extension-okhttp:$exoPlayerVersion"
|
implementation "com.google.android.exoplayer:extension-okhttp:$exoPlayerVersion"
|
||||||
implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion"
|
|
||||||
|
|
||||||
// Non-free dependencies:
|
// Non-free dependencies:
|
||||||
playApi "com.google.android.support:wearable:$wearableSupportVersion"
|
playApi "com.google.android.support:wearable:$wearableSupportVersion"
|
||||||
|
|
|
@ -40,12 +40,10 @@ import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
|
||||||
import de.danoeh.antennapod.core.service.download.HttpCredentialEncoder;
|
import de.danoeh.antennapod.core.service.download.HttpCredentialEncoder;
|
||||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||||
import de.danoeh.antennapod.core.util.playback.IPlayer;
|
|
||||||
import de.danoeh.antennapod.model.playback.Playable;
|
import de.danoeh.antennapod.model.playback.Playable;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import org.antennapod.audio.MediaPlayer;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -53,19 +51,21 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class ExoPlayerWrapper implements IPlayer {
|
public class ExoPlayerWrapper {
|
||||||
|
public static final int BUFFERING_STARTED = -1;
|
||||||
|
public static final int BUFFERING_ENDED = -2;
|
||||||
private static final String TAG = "ExoPlayerWrapper";
|
private static final String TAG = "ExoPlayerWrapper";
|
||||||
public static final int ERROR_CODE_OFFSET = 1000;
|
public static final int ERROR_CODE_OFFSET = 1000;
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final Disposable bufferingUpdateDisposable;
|
private final Disposable bufferingUpdateDisposable;
|
||||||
private SimpleExoPlayer exoPlayer;
|
private SimpleExoPlayer exoPlayer;
|
||||||
private MediaSource mediaSource;
|
private MediaSource mediaSource;
|
||||||
private MediaPlayer.OnSeekCompleteListener audioSeekCompleteListener;
|
private Runnable audioSeekCompleteListener;
|
||||||
private MediaPlayer.OnCompletionListener audioCompletionListener;
|
private Runnable audioCompletionListener;
|
||||||
private Consumer<String> audioErrorListener;
|
private Consumer<String> audioErrorListener;
|
||||||
private MediaPlayer.OnBufferingUpdateListener bufferingUpdateListener;
|
private Consumer<Integer> bufferingUpdateListener;
|
||||||
private PlaybackParameters playbackParameters;
|
private PlaybackParameters playbackParameters;
|
||||||
private MediaPlayer.OnInfoListener infoListener;
|
|
||||||
private DefaultTrackSelector trackSelector;
|
private DefaultTrackSelector trackSelector;
|
||||||
|
|
||||||
ExoPlayerWrapper(Context context) {
|
ExoPlayerWrapper(Context context) {
|
||||||
|
@ -76,7 +76,7 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(tickNumber -> {
|
.subscribe(tickNumber -> {
|
||||||
if (bufferingUpdateListener != null) {
|
if (bufferingUpdateListener != null) {
|
||||||
bufferingUpdateListener.onBufferingUpdate(null, exoPlayer.getBufferedPercentage());
|
bufferingUpdateListener.accept(exoPlayer.getBufferedPercentage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -97,11 +97,11 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackStateChanged(@Player.State int playbackState) {
|
public void onPlaybackStateChanged(@Player.State int playbackState) {
|
||||||
if (audioCompletionListener != null && playbackState == Player.STATE_ENDED) {
|
if (audioCompletionListener != null && playbackState == Player.STATE_ENDED) {
|
||||||
audioCompletionListener.onCompletion(null);
|
audioCompletionListener.run();
|
||||||
} else if (infoListener != null && playbackState == Player.STATE_BUFFERING) {
|
} else if (bufferingUpdateListener != null && playbackState == Player.STATE_BUFFERING) {
|
||||||
infoListener.onInfo(null, android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START, 0);
|
bufferingUpdateListener.accept(BUFFERING_STARTED);
|
||||||
} else if (infoListener != null) {
|
} else if (bufferingUpdateListener != null) {
|
||||||
infoListener.onInfo(null, android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END, 0);
|
bufferingUpdateListener.accept(BUFFERING_ENDED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,28 +130,20 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
@NonNull Player.PositionInfo newPosition,
|
@NonNull Player.PositionInfo newPosition,
|
||||||
@Player.DiscontinuityReason int reason) {
|
@Player.DiscontinuityReason int reason) {
|
||||||
if (audioSeekCompleteListener != null && reason == Player.DISCONTINUITY_REASON_SEEK) {
|
if (audioSeekCompleteListener != null && reason == Player.DISCONTINUITY_REASON_SEEK) {
|
||||||
audioSeekCompleteListener.onSeekComplete(null);
|
audioSeekCompleteListener.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDownmix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCurrentPosition() {
|
public int getCurrentPosition() {
|
||||||
return (int) exoPlayer.getCurrentPosition();
|
return (int) exoPlayer.getCurrentPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getCurrentSpeedMultiplier() {
|
public float getCurrentSpeedMultiplier() {
|
||||||
return playbackParameters.speed;
|
return playbackParameters.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDuration() {
|
public int getDuration() {
|
||||||
if (exoPlayer.getDuration() == C.TIME_UNSET) {
|
if (exoPlayer.getDuration() == C.TIME_UNSET) {
|
||||||
return Playable.INVALID_TIME;
|
return Playable.INVALID_TIME;
|
||||||
|
@ -159,23 +151,19 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
return (int) exoPlayer.getDuration();
|
return (int) exoPlayer.getDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPlaying() {
|
public boolean isPlaying() {
|
||||||
return exoPlayer.getPlayWhenReady();
|
return exoPlayer.getPlayWhenReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void pause() {
|
public void pause() {
|
||||||
exoPlayer.pause();
|
exoPlayer.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void prepare() throws IllegalStateException {
|
public void prepare() throws IllegalStateException {
|
||||||
exoPlayer.setMediaSource(mediaSource, false);
|
exoPlayer.setMediaSource(mediaSource, false);
|
||||||
exoPlayer.prepare();
|
exoPlayer.prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void release() {
|
public void release() {
|
||||||
bufferingUpdateDisposable.dispose();
|
bufferingUpdateDisposable.dispose();
|
||||||
if (exoPlayer != null) {
|
if (exoPlayer != null) {
|
||||||
|
@ -187,21 +175,18 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
bufferingUpdateListener = null;
|
bufferingUpdateListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
exoPlayer.release();
|
exoPlayer.release();
|
||||||
createPlayer();
|
createPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void seekTo(int i) throws IllegalStateException {
|
public void seekTo(int i) throws IllegalStateException {
|
||||||
exoPlayer.seekTo(i);
|
exoPlayer.seekTo(i);
|
||||||
if (audioSeekCompleteListener != null) {
|
if (audioSeekCompleteListener != null) {
|
||||||
audioSeekCompleteListener.onSeekComplete(null);
|
audioSeekCompleteListener.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAudioStreamType(int i) {
|
public void setAudioStreamType(int i) {
|
||||||
AudioAttributes a = exoPlayer.getAudioAttributes();
|
AudioAttributes a = exoPlayer.getAudioAttributes();
|
||||||
AudioAttributes.Builder b = new AudioAttributes.Builder();
|
AudioAttributes.Builder b = new AudioAttributes.Builder();
|
||||||
|
@ -235,51 +220,34 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
mediaSource = f.createMediaSource(mediaItem);
|
mediaSource = f.createMediaSource(mediaItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDataSource(String s) throws IllegalArgumentException, IllegalStateException {
|
public void setDataSource(String s) throws IllegalArgumentException, IllegalStateException {
|
||||||
setDataSource(s, null, null);
|
setDataSource(s, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplay(SurfaceHolder sh) {
|
public void setDisplay(SurfaceHolder sh) {
|
||||||
exoPlayer.setVideoSurfaceHolder(sh);
|
exoPlayer.setVideoSurfaceHolder(sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlaybackParams(float speed, boolean skipSilence) {
|
public void setPlaybackParams(float speed, boolean skipSilence) {
|
||||||
playbackParameters = new PlaybackParameters(speed, playbackParameters.pitch);
|
playbackParameters = new PlaybackParameters(speed, playbackParameters.pitch);
|
||||||
exoPlayer.setSkipSilenceEnabled(skipSilence);
|
exoPlayer.setSkipSilenceEnabled(skipSilence);
|
||||||
exoPlayer.setPlaybackParameters(playbackParameters);
|
exoPlayer.setPlaybackParameters(playbackParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDownmix(boolean b) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVolume(float v, float v1) {
|
public void setVolume(float v, float v1) {
|
||||||
exoPlayer.setVolume(v);
|
exoPlayer.setVolume(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWakeMode(Context context, int i) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
public void start() {
|
||||||
exoPlayer.play();
|
exoPlayer.play();
|
||||||
// Can't set params when paused - so always set it on start in case they changed
|
// Can't set params when paused - so always set it on start in case they changed
|
||||||
exoPlayer.setPlaybackParameters(playbackParameters);
|
exoPlayer.setPlaybackParameters(playbackParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
exoPlayer.stop();
|
exoPlayer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getAudioTracks() {
|
public List<String> getAudioTracks() {
|
||||||
List<String> trackNames = new ArrayList<>();
|
List<String> trackNames = new ArrayList<>();
|
||||||
TrackNameProvider trackNameProvider = new DefaultTrackNameProvider(context.getResources());
|
TrackNameProvider trackNameProvider = new DefaultTrackNameProvider(context.getResources());
|
||||||
|
@ -302,7 +270,6 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAudioTrack(int track) {
|
public void setAudioTrack(int track) {
|
||||||
MappingTrackSelector.MappedTrackInfo trackInfo = trackSelector.getCurrentMappedTrackInfo();
|
MappingTrackSelector.MappedTrackInfo trackInfo = trackSelector.getCurrentMappedTrackInfo();
|
||||||
if (trackInfo == null) {
|
if (trackInfo == null) {
|
||||||
|
@ -324,7 +291,6 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSelectedAudioTrack() {
|
public int getSelectedAudioTrack() {
|
||||||
TrackSelectionArray trackSelections = exoPlayer.getCurrentTrackSelections();
|
TrackSelectionArray trackSelections = exoPlayer.getCurrentTrackSelections();
|
||||||
List<Format> availableFormats = getFormats();
|
List<Format> availableFormats = getFormats();
|
||||||
|
@ -340,11 +306,11 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOnCompletionListener(MediaPlayer.OnCompletionListener audioCompletionListener) {
|
void setOnCompletionListener(Runnable audioCompletionListener) {
|
||||||
this.audioCompletionListener = audioCompletionListener;
|
this.audioCompletionListener = audioCompletionListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener audioSeekCompleteListener) {
|
void setOnSeekCompleteListener(Runnable audioSeekCompleteListener) {
|
||||||
this.audioSeekCompleteListener = audioSeekCompleteListener;
|
this.audioSeekCompleteListener = audioSeekCompleteListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,11 +332,7 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
return exoPlayer.getVideoFormat().height;
|
return exoPlayer.getVideoFormat().height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener bufferingUpdateListener) {
|
void setOnBufferingUpdateListener(Consumer<Integer> bufferingUpdateListener) {
|
||||||
this.bufferingUpdateListener = bufferingUpdateListener;
|
this.bufferingUpdateListener = bufferingUpdateListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnInfoListener(MediaPlayer.OnInfoListener infoListener) {
|
|
||||||
this.infoListener = infoListener;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1578,14 +1578,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
return mediaPlayer.getPlaybackSpeed();
|
return mediaPlayer.getPlaybackSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDownmix() {
|
|
||||||
return mediaPlayer.canDownmix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownmix(boolean enable) {
|
|
||||||
mediaPlayer.setDownmix(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isStartWhenPrepared() {
|
public boolean isStartWhenPrepared() {
|
||||||
return mediaPlayer.isStartWhenPrepared();
|
return mediaPlayer.isStartWhenPrepared();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
package de.danoeh.antennapod.core.util.playback;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import androidx.preference.PreferenceManager;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.SurfaceHolder;
|
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.ClientConfig;
|
|
||||||
import org.antennapod.audio.MediaPlayer;
|
|
||||||
|
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AudioPlayer extends MediaPlayer implements IPlayer {
|
|
||||||
private static final String TAG = "AudioPlayer";
|
|
||||||
|
|
||||||
public AudioPlayer(Context context) {
|
|
||||||
super(context, true, ClientConfig.USER_AGENT);
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(context)
|
|
||||||
.registerOnSharedPreferenceChangeListener((sharedPreferences, key) -> {
|
|
||||||
if (UserPreferences.PREF_MEDIA_PLAYER.equals(key)) {
|
|
||||||
checkMpi();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplay(SurfaceHolder sh) {
|
|
||||||
if (sh != null) {
|
|
||||||
Log.e(TAG, "Setting display not supported in Audio Player");
|
|
||||||
throw new UnsupportedOperationException("Setting display not supported in Audio Player");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlaybackParams(float speed, boolean skipSilence) {
|
|
||||||
if (canSetSpeed()) {
|
|
||||||
try {
|
|
||||||
setPlaybackSpeed(speed);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Default player does not support silence skipping
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean useSonic() {
|
|
||||||
return UserPreferences.useSonic();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean downmix() {
|
|
||||||
return UserPreferences.stereoToMono();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAudioTracks() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAudioTrack(int track) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSelectedAudioTrack() {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDataSource(String streamUrl, String username, String password) throws IOException {
|
|
||||||
setDataSource(streamUrl);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package de.danoeh.antennapod.core.util.playback;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.SurfaceHolder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IPlayer {
|
|
||||||
boolean canDownmix();
|
|
||||||
|
|
||||||
int getCurrentPosition();
|
|
||||||
|
|
||||||
float getCurrentSpeedMultiplier();
|
|
||||||
|
|
||||||
int getDuration();
|
|
||||||
|
|
||||||
boolean isPlaying();
|
|
||||||
|
|
||||||
void pause();
|
|
||||||
|
|
||||||
void prepare() throws IllegalStateException, IOException;
|
|
||||||
|
|
||||||
void release();
|
|
||||||
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
void seekTo(int msec);
|
|
||||||
|
|
||||||
void setAudioStreamType(int streamtype);
|
|
||||||
|
|
||||||
void setDataSource(String path) throws IllegalStateException, IOException,
|
|
||||||
IllegalArgumentException, SecurityException;
|
|
||||||
|
|
||||||
void setDataSource(String streamUrl, String username, String password) throws IOException;
|
|
||||||
|
|
||||||
void setDisplay(SurfaceHolder sh);
|
|
||||||
|
|
||||||
void setPlaybackParams(float speed, boolean skipSilence);
|
|
||||||
|
|
||||||
void setDownmix(boolean enable);
|
|
||||||
|
|
||||||
void setVolume(float left, float right);
|
|
||||||
|
|
||||||
void start();
|
|
||||||
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
void setWakeMode(Context context, int mode);
|
|
||||||
|
|
||||||
List<String> getAudioTracks();
|
|
||||||
|
|
||||||
void setAudioTrack(int track);
|
|
||||||
|
|
||||||
int getSelectedAudioTrack();
|
|
||||||
}
|
|
|
@ -21,7 +21,6 @@ import de.danoeh.antennapod.event.playback.SpeedChangedEvent;
|
||||||
import de.danoeh.antennapod.model.playback.MediaType;
|
import de.danoeh.antennapod.model.playback.MediaType;
|
||||||
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
|
import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils;
|
||||||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
|
||||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||||
import de.danoeh.antennapod.model.playback.Playable;
|
import de.danoeh.antennapod.model.playback.Playable;
|
||||||
import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer;
|
import de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer;
|
||||||
|
@ -420,17 +419,6 @@ public abstract class PlaybackController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDownmix() {
|
|
||||||
return (playbackService != null && playbackService.canDownmix())
|
|
||||||
|| UserPreferences.useSonic();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDownmix(boolean enable) {
|
|
||||||
if (playbackService != null) {
|
|
||||||
playbackService.setDownmix(enable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAudioTracks() {
|
public List<String> getAudioTracks() {
|
||||||
if (playbackService == null) {
|
if (playbackService == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package de.danoeh.antennapod.core.util.playback;
|
|
||||||
|
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class VideoPlayer extends MediaPlayer implements IPlayer {
|
|
||||||
private static final String TAG = "VideoPlayer";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDownmix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getCurrentSpeedMultiplier() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlaybackParams(float speed, boolean skipSilence) {
|
|
||||||
//Ignore this for non ExoPlayer implementations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDownmix(boolean b) {
|
|
||||||
Log.e(TAG, "Setting downmix unsupported in video player");
|
|
||||||
throw new UnsupportedOperationException("Setting downmix unsupported in video player");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVideoScalingMode(int mode) {
|
|
||||||
super.setVideoScalingMode(mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAudioTracks() {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAudioTrack(int track) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSelectedAudioTrack() {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDataSource(String streamUrl, String username, String password) throws IOException {
|
|
||||||
setDataSource(streamUrl);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -216,18 +216,6 @@
|
||||||
<item>DownloadsSection</item>
|
<item>DownloadsSection</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="media_player_options">
|
|
||||||
<item>@string/media_player_exoplayer_recommended</item>
|
|
||||||
<item>@string/media_player_builtin</item>
|
|
||||||
<item>@string/media_player_sonic</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="media_player_values">
|
|
||||||
<item>exoplayer</item>
|
|
||||||
<item>builtin</item>
|
|
||||||
<item>sonic</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- sort for podcast screen, not for queue -->
|
<!-- sort for podcast screen, not for queue -->
|
||||||
<string-array name="feed_episodes_sort_options">
|
<string-array name="feed_episodes_sort_options">
|
||||||
<item>@string/sort_date_new_old</item>
|
<item>@string/sort_date_new_old</item>
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.util.Pair;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import de.danoeh.antennapod.model.playback.MediaType;
|
import de.danoeh.antennapod.model.playback.MediaType;
|
||||||
|
@ -158,13 +157,6 @@ public abstract class PlaybackServiceMediaPlayer {
|
||||||
*/
|
*/
|
||||||
public abstract void setVolume(float volumeLeft, float volumeRight);
|
public abstract void setVolume(float volumeLeft, float volumeRight);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the mediaplayer can mix stereo down to mono
|
|
||||||
*/
|
|
||||||
public abstract boolean canDownmix();
|
|
||||||
|
|
||||||
public abstract void setDownmix(boolean enable);
|
|
||||||
|
|
||||||
public abstract MediaType getCurrentMediaType();
|
public abstract MediaType getCurrentMediaType();
|
||||||
|
|
||||||
public abstract boolean isStreaming();
|
public abstract boolean isStreaming();
|
||||||
|
@ -232,8 +224,8 @@ public abstract class PlaybackServiceMediaPlayer {
|
||||||
*
|
*
|
||||||
* @see #endPlayback(boolean, boolean, boolean, boolean)
|
* @see #endPlayback(boolean, boolean, boolean, boolean)
|
||||||
*/
|
*/
|
||||||
public Future<?> stopPlayback(boolean toStoppedState) {
|
public void stopPlayback(boolean toStoppedState) {
|
||||||
return endPlayback(false, false, false, toStoppedState);
|
endPlayback(false, false, false, toStoppedState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -262,7 +254,7 @@ public abstract class PlaybackServiceMediaPlayer {
|
||||||
*
|
*
|
||||||
* @return a Future, just for the purpose of tracking its execution.
|
* @return a Future, just for the purpose of tracking its execution.
|
||||||
*/
|
*/
|
||||||
protected abstract Future<?> endPlayback(boolean hasEnded, boolean wasSkipped,
|
protected abstract void endPlayback(boolean hasEnded, boolean wasSkipped,
|
||||||
boolean shouldContinue, boolean toStoppedState);
|
boolean shouldContinue, boolean toStoppedState);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,8 +8,6 @@ import android.view.SurfaceHolder;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.concurrent.FutureTask;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
@ -430,16 +428,6 @@ public class CastPsmp extends PlaybackServiceMediaPlayer {
|
||||||
remoteMediaClient.setStreamVolume(volumeLeft);
|
remoteMediaClient.setStreamVolume(volumeLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDownmix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDownmix(boolean enable) {
|
|
||||||
throw new UnsupportedOperationException("Setting downmix unsupported in Remote Media Player");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MediaType getCurrentMediaType() {
|
public MediaType getCurrentMediaType() {
|
||||||
return mediaType;
|
return mediaType;
|
||||||
|
@ -497,7 +485,7 @@ public class CastPsmp extends PlaybackServiceMediaPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Future<?> endPlayback(boolean hasEnded, boolean wasSkipped, boolean shouldContinue,
|
protected void endPlayback(boolean hasEnded, boolean wasSkipped, boolean shouldContinue,
|
||||||
boolean toStoppedState) {
|
boolean toStoppedState) {
|
||||||
Log.d(TAG, "endPlayback() called");
|
Log.d(TAG, "endPlayback() called");
|
||||||
boolean isPlaying = playerStatus == PlayerStatus.PLAYING;
|
boolean isPlaying = playerStatus == PlayerStatus.PLAYING;
|
||||||
|
@ -544,10 +532,6 @@ public class CastPsmp extends PlaybackServiceMediaPlayer {
|
||||||
callback.onPlaybackPause(currentMedia,
|
callback.onPlaybackPause(currentMedia,
|
||||||
currentMedia != null ? currentMedia.getPosition() : Playable.INVALID_TIME);
|
currentMedia != null ? currentMedia.getPosition() : Playable.INVALID_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureTask<?> future = new FutureTask<>(() -> { }, null);
|
|
||||||
future.run();
|
|
||||||
return future;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -112,11 +112,8 @@ public class UserPreferences {
|
||||||
// Other
|
// Other
|
||||||
private static final String PREF_DATA_FOLDER = "prefDataFolder";
|
private static final String PREF_DATA_FOLDER = "prefDataFolder";
|
||||||
public static final String PREF_DELETE_REMOVES_FROM_QUEUE = "prefDeleteRemovesFromQueue";
|
public static final String PREF_DELETE_REMOVES_FROM_QUEUE = "prefDeleteRemovesFromQueue";
|
||||||
public static final String PREF_USAGE_COUNTING_DATE = "prefUsageCounting";
|
|
||||||
|
|
||||||
// Mediaplayer
|
// Mediaplayer
|
||||||
public static final String PREF_MEDIA_PLAYER = "prefMediaPlayer";
|
|
||||||
public static final String PREF_MEDIA_PLAYER_EXOPLAYER = "exoplayer";
|
|
||||||
private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
|
private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed";
|
||||||
private static final String PREF_VIDEO_PLAYBACK_SPEED = "prefVideoPlaybackSpeed";
|
private static final String PREF_VIDEO_PLAYBACK_SPEED = "prefVideoPlaybackSpeed";
|
||||||
public static final String PREF_PLAYBACK_SKIP_SILENCE = "prefSkipSilence";
|
public static final String PREF_PLAYBACK_SKIP_SILENCE = "prefSkipSilence";
|
||||||
|
@ -125,7 +122,6 @@ public class UserPreferences {
|
||||||
private static final String PREF_QUEUE_LOCKED = "prefQueueLocked";
|
private static final String PREF_QUEUE_LOCKED = "prefQueueLocked";
|
||||||
|
|
||||||
// Experimental
|
// Experimental
|
||||||
private static final String PREF_STEREO_TO_MONO = "PrefStereoToMono";
|
|
||||||
public static final int EPISODE_CLEANUP_QUEUE = -1;
|
public static final int EPISODE_CLEANUP_QUEUE = -1;
|
||||||
public static final int EPISODE_CLEANUP_NULL = -2;
|
public static final int EPISODE_CLEANUP_NULL = -2;
|
||||||
public static final int EPISODE_CLEANUP_EXCEPT_FAVORITE = -3;
|
public static final int EPISODE_CLEANUP_EXCEPT_FAVORITE = -3;
|
||||||
|
@ -780,32 +776,6 @@ public class UserPreferences {
|
||||||
return Arrays.asList(1.0f, 1.25f, 1.5f);
|
return Arrays.asList(1.0f, 1.25f, 1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMediaPlayer() {
|
|
||||||
return prefs.getString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean useSonic() {
|
|
||||||
return getMediaPlayer().equals("sonic");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean useExoplayer() {
|
|
||||||
return getMediaPlayer().equals(PREF_MEDIA_PLAYER_EXOPLAYER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void enableExoplayer() {
|
|
||||||
prefs.edit().putString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean stereoToMono() {
|
|
||||||
return prefs.getBoolean(PREF_STEREO_TO_MONO, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void stereoToMono(boolean enable) {
|
|
||||||
prefs.edit()
|
|
||||||
.putBoolean(PREF_STEREO_TO_MONO, enable)
|
|
||||||
.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getEpisodeCleanupValue() {
|
public static int getEpisodeCleanupValue() {
|
||||||
return Integer.parseInt(prefs.getString(PREF_EPISODE_CLEANUP, "" + EPISODE_CLEANUP_NULL));
|
return Integer.parseInt(prefs.getString(PREF_EPISODE_CLEANUP, "" + EPISODE_CLEANUP_NULL));
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,7 +385,6 @@
|
||||||
<string name="preference_search_hint">Search…</string>
|
<string name="preference_search_hint">Search…</string>
|
||||||
<string name="preference_search_no_results">No results</string>
|
<string name="preference_search_no_results">No results</string>
|
||||||
<string name="preference_search_clear_history">Clear history</string>
|
<string name="preference_search_clear_history">Clear history</string>
|
||||||
<string name="media_player">Media player</string>
|
|
||||||
<string name="pref_episode_cleanup_title">Episode Cleanup</string>
|
<string name="pref_episode_cleanup_title">Episode Cleanup</string>
|
||||||
<string name="pref_episode_cleanup_summary">Episodes that should be eligible for removal if Auto Download needs space for new episodes</string>
|
<string name="pref_episode_cleanup_summary">Episodes that should be eligible for removal if Auto Download needs space for new episodes</string>
|
||||||
<string name="pref_pauseOnDisconnect_sum">Pause playback when headphones or bluetooth are disconnected</string>
|
<string name="pref_pauseOnDisconnect_sum">Pause playback when headphones or bluetooth are disconnected</string>
|
||||||
|
@ -500,19 +499,12 @@
|
||||||
<string name="open_bug_tracker">Open bug tracker</string>
|
<string name="open_bug_tracker">Open bug tracker</string>
|
||||||
<string name="copy_to_clipboard">Copy to clipboard</string>
|
<string name="copy_to_clipboard">Copy to clipboard</string>
|
||||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||||
<string name="experimental_pref">Experimental</string>
|
|
||||||
<string name="pref_media_player_message">Select which media player to use to play files</string>
|
|
||||||
<string name="pref_current_value">Current value: %1$s</string>
|
<string name="pref_current_value">Current value: %1$s</string>
|
||||||
<string name="pref_proxy_title">Proxy</string>
|
<string name="pref_proxy_title">Proxy</string>
|
||||||
<string name="pref_proxy_sum">Set a network proxy</string>
|
<string name="pref_proxy_sum">Set a network proxy</string>
|
||||||
<string name="pref_no_browser_found">No web browser found.</string>
|
<string name="pref_no_browser_found">No web browser found.</string>
|
||||||
<string name="pref_enqueue_downloaded_title">Enqueue Downloaded</string>
|
<string name="pref_enqueue_downloaded_title">Enqueue Downloaded</string>
|
||||||
<string name="pref_enqueue_downloaded_summary">Add downloaded episodes to the queue</string>
|
<string name="pref_enqueue_downloaded_summary">Add downloaded episodes to the queue</string>
|
||||||
<string name="media_player_builtin">Built-in Android player (deprecated) </string>
|
|
||||||
<string name="media_player_sonic">Sonic Media Player (deprecated) </string>
|
|
||||||
<string name="media_player_exoplayer_recommended">ExoPlayer (recommended)</string>
|
|
||||||
<string name="media_player_switch_to_exoplayer">Switch to ExoPlayer</string>
|
|
||||||
<string name="media_player_switched_to_exoplayer">Switched to ExoPlayer.</string>
|
|
||||||
<string name="pref_skip_silence_title">Skip Silence in Audio</string>
|
<string name="pref_skip_silence_title">Skip Silence in Audio</string>
|
||||||
<string name="behavior">Behavior</string>
|
<string name="behavior">Behavior</string>
|
||||||
<string name="pref_default_page">Default Page</string>
|
<string name="pref_default_page">Default Page</string>
|
||||||
|
@ -800,9 +792,6 @@
|
||||||
<string name="audio_controls">Audio controls</string>
|
<string name="audio_controls">Audio controls</string>
|
||||||
<string name="playback_speed">Playback Speed</string>
|
<string name="playback_speed">Playback Speed</string>
|
||||||
<string name="audio_effects">Audio Effects</string>
|
<string name="audio_effects">Audio Effects</string>
|
||||||
<string name="stereo_to_mono">Downmix: Stereo to mono</string>
|
|
||||||
<string name="sonic_only">Sonic only</string>
|
|
||||||
<string name="exoplayer_only">ExoPlayer only</string>
|
|
||||||
<string name="player_switch_to_audio_only">Switch to audio only</string>
|
<string name="player_switch_to_audio_only">Switch to audio only</string>
|
||||||
|
|
||||||
<!-- proxy settings -->
|
<!-- proxy settings -->
|
||||||
|
|
Loading…
Reference in New Issue