Search in sources :

Example 1 with MediaPlayer

use of org.antennapod.audio.MediaPlayer in project AntennaPod by AntennaPod.

the class LocalPSMP method clearMediaPlayerListeners.

private void clearMediaPlayerListeners() {
    if (mediaPlayer instanceof VideoPlayer) {
        VideoPlayer vp = (VideoPlayer) mediaPlayer;
        vp.setOnCompletionListener(x -> {
        });
        vp.setOnSeekCompleteListener(x -> {
        });
        vp.setOnErrorListener((mediaPlayer, i, i1) -> false);
        vp.setOnBufferingUpdateListener((mediaPlayer, i) -> {
        });
        vp.setOnInfoListener((mediaPlayer, i, i1) -> false);
    } else if (mediaPlayer instanceof AudioPlayer) {
        AudioPlayer ap = (AudioPlayer) mediaPlayer;
        ap.setOnCompletionListener(x -> {
        });
        ap.setOnSeekCompleteListener(x -> {
        });
        ap.setOnErrorListener((x, y, z) -> false);
        ap.setOnBufferingUpdateListener((arg0, percent) -> {
        });
        ap.setOnInfoListener((arg0, what, extra) -> false);
    } else if (mediaPlayer instanceof ExoPlayerWrapper) {
        ExoPlayerWrapper ap = (ExoPlayerWrapper) mediaPlayer;
        ap.setOnCompletionListener(x -> {
        });
        ap.setOnSeekCompleteListener(x -> {
        });
        ap.setOnBufferingUpdateListener((arg0, percent) -> {
        });
        ap.setOnErrorListener(x -> {
        });
        ap.setOnInfoListener((arg0, what, extra) -> false);
    }
}
Also used : VideoPlayer(de.danoeh.antennapod.core.util.playback.VideoPlayer) Context(android.content.Context) PlayerErrorEvent(de.danoeh.antennapod.event.PlayerErrorEvent) SpeedChangedEvent(de.danoeh.antennapod.event.playback.SpeedChangedEvent) AudioFocusRequestCompat(androidx.media.AudioFocusRequestCompat) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) NonNull(androidx.annotation.NonNull) VolumeAdaptionSetting(de.danoeh.antennapod.model.feed.VolumeAdaptionSetting) Pair(android.util.Pair) BufferUpdateEvent(de.danoeh.antennapod.event.playback.BufferUpdateEvent) FutureTask(java.util.concurrent.FutureTask) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IPlayer(de.danoeh.antennapod.core.util.playback.IPlayer) AudioAttributesCompat(androidx.media.AudioAttributesCompat) MediaPlayer(org.antennapod.audio.MediaPlayer) PlaybackServiceMediaPlayer(de.danoeh.antennapod.playback.base.PlaybackServiceMediaPlayer) AudioManager(android.media.AudioManager) UserPreferences(de.danoeh.antennapod.core.preferences.UserPreferences) UiModeManager(android.app.UiModeManager) PowerManager(android.os.PowerManager) Future(java.util.concurrent.Future) FeedPreferences(de.danoeh.antennapod.model.feed.FeedPreferences) VideoPlayer(de.danoeh.antennapod.core.util.playback.VideoPlayer) RewindAfterPauseUtils(de.danoeh.antennapod.playback.base.RewindAfterPauseUtils) TelephonyManager(android.telephony.TelephonyManager) EventBus(org.greenrobot.eventbus.EventBus) AudioPlayer(de.danoeh.antennapod.core.util.playback.AudioPlayer) AudioManagerCompat(androidx.media.AudioManagerCompat) SurfaceHolder(android.view.SurfaceHolder) Log(android.util.Log) MediaPlayerError(de.danoeh.antennapod.core.util.playback.MediaPlayerError) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia) MediaType(de.danoeh.antennapod.model.playback.MediaType) ReentrantLock(java.util.concurrent.locks.ReentrantLock) PlaybackSpeedUtils(de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils) Playable(de.danoeh.antennapod.model.playback.Playable) IOException(java.io.IOException) File(java.io.File) PlayerStatus(de.danoeh.antennapod.playback.base.PlayerStatus) TimeUnit(java.util.concurrent.TimeUnit) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) PlaybackServiceStarter(de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter) Configuration(android.content.res.Configuration) LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) AudioPlayer(de.danoeh.antennapod.core.util.playback.AudioPlayer)

Aggregations

UiModeManager (android.app.UiModeManager)1 Context (android.content.Context)1 Configuration (android.content.res.Configuration)1 AudioManager (android.media.AudioManager)1 PowerManager (android.os.PowerManager)1 TelephonyManager (android.telephony.TelephonyManager)1 Log (android.util.Log)1 Pair (android.util.Pair)1 SurfaceHolder (android.view.SurfaceHolder)1 NonNull (androidx.annotation.NonNull)1 AudioAttributesCompat (androidx.media.AudioAttributesCompat)1 AudioFocusRequestCompat (androidx.media.AudioFocusRequestCompat)1 AudioManagerCompat (androidx.media.AudioManagerCompat)1 PlaybackSpeedUtils (de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils)1 UserPreferences (de.danoeh.antennapod.core.preferences.UserPreferences)1 AudioPlayer (de.danoeh.antennapod.core.util.playback.AudioPlayer)1 IPlayer (de.danoeh.antennapod.core.util.playback.IPlayer)1 MediaPlayerError (de.danoeh.antennapod.core.util.playback.MediaPlayerError)1 PlaybackServiceStarter (de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter)1 VideoPlayer (de.danoeh.antennapod.core.util.playback.VideoPlayer)1