1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-10-02 00:40:51 +00:00

Fixed deprecations

This commit is contained in:
Robin 2019-10-07 09:41:44 +02:00 committed by TobiGr
parent dcd5197a19
commit 87eab2a9b0
3 changed files with 13 additions and 9 deletions

View File

@ -28,12 +28,13 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.media.AudioManager; import android.media.AudioManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.ExoPlayerFactory;
@ -209,7 +210,7 @@ public abstract class BasePlayer implements
this.databaseUpdateReactor = new CompositeDisposable(); this.databaseUpdateReactor = new CompositeDisposable();
final String userAgent = Downloader.USER_AGENT; final String userAgent = Downloader.USER_AGENT;
final DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); final DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter.Builder(context).build();
this.dataSource = new PlayerDataSource(context, userAgent, bandwidthMeter); this.dataSource = new PlayerDataSource(context, userAgent, bandwidthMeter);
final TrackSelection.Factory trackSelectionFactory = PlayerHelper.getQualitySelector(context); final TrackSelection.Factory trackSelectionFactory = PlayerHelper.getQualitySelector(context);

View File

@ -1,9 +1,11 @@
package org.schabi.newpipe.player.helper; package org.schabi.newpipe.player.helper;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import com.google.android.exoplayer2.database.ExoDatabaseProvider;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSource; import com.google.android.exoplayer2.upstream.DefaultDataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
@ -54,7 +56,7 @@ import java.io.File;
if (cache == null) { if (cache == null) {
final LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(maxCacheSize); final LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(maxCacheSize);
cache = new SimpleCache(cacheDir, evictor); cache = new SimpleCache(cacheDir, evictor, new ExoDatabaseProvider(context));
} }
} }

View File

@ -1,9 +1,10 @@
package org.schabi.newpipe.player.helper; package org.schabi.newpipe.player.helper;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.source.SingleSampleMediaSource; import com.google.android.exoplayer2.source.SingleSampleMediaSource;
import com.google.android.exoplayer2.source.dash.DashMediaSource; import com.google.android.exoplayer2.source.dash.DashMediaSource;
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource; import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
@ -64,12 +65,12 @@ public class PlayerDataSource {
cacheDataSourceFactory), cacheDataSourceFactory); cacheDataSourceFactory), cacheDataSourceFactory);
} }
public ExtractorMediaSource.Factory getExtractorMediaSourceFactory() { public ProgressiveMediaSource.Factory getExtractorMediaSourceFactory() {
return new ExtractorMediaSource.Factory(cacheDataSourceFactory) return new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
.setLoadErrorHandlingPolicy(new DefaultLoadErrorHandlingPolicy(EXTRACTOR_MINIMUM_RETRY)); .setLoadErrorHandlingPolicy(new DefaultLoadErrorHandlingPolicy(EXTRACTOR_MINIMUM_RETRY));
} }
public ExtractorMediaSource.Factory getExtractorMediaSourceFactory(@NonNull final String key) { public ProgressiveMediaSource.Factory getExtractorMediaSourceFactory(@NonNull final String key) {
return getExtractorMediaSourceFactory().setCustomCacheKey(key); return getExtractorMediaSourceFactory().setCustomCacheKey(key);
} }