Skip to content

Commit 8445c38

Browse files
StypoxAudricV
authored andcommitted
Use DownloaderImpl.USER_AGENT directly
instead of passing it as a parameter
1 parent fa46b7b commit 8445c38

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
import com.squareup.picasso.Picasso;
151151
import com.squareup.picasso.Target;
152152

153-
import org.schabi.newpipe.DownloaderImpl;
154153
import org.schabi.newpipe.MainActivity;
155154
import org.schabi.newpipe.R;
156155
import org.schabi.newpipe.database.stream.model.StreamEntity;
@@ -429,7 +428,7 @@ public Player(@NonNull final MainPlayer service) {
429428
setupBroadcastReceiver();
430429

431430
trackSelector = new DefaultTrackSelector(context, PlayerHelper.getQualitySelector());
432-
final PlayerDataSource dataSource = new PlayerDataSource(context, DownloaderImpl.USER_AGENT,
431+
final PlayerDataSource dataSource = new PlayerDataSource(context,
433432
new DefaultBandwidthMeter.Builder(context).build());
434433
loadController = new LoadController();
435434
renderFactory = new DefaultRenderersFactory(context);

app/src/main/java/org/schabi/newpipe/player/helper/PlayerDataSource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
2323
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
2424

25+
import org.schabi.newpipe.DownloaderImpl;
2526
import org.schabi.newpipe.extractor.services.youtube.dashmanifestcreators.YoutubeOtfDashManifestCreator;
2627
import org.schabi.newpipe.extractor.services.youtube.dashmanifestcreators.YoutubePostLiveStreamDvrDashManifestCreator;
2728
import org.schabi.newpipe.extractor.services.youtube.dashmanifestcreators.YoutubeProgressiveDashManifestCreator;
@@ -76,7 +77,6 @@ public class PlayerDataSource {
7677

7778

7879
public PlayerDataSource(final Context context,
79-
final String userAgent,
8080
final TransferListener transferListener) {
8181

8282
progressiveLoadIntervalBytes = PlayerHelper.getProgressiveLoadIntervalBytes(context);
@@ -86,10 +86,10 @@ public PlayerDataSource(final Context context,
8686

8787
// generic data source factories use DefaultHttpDataSource.Factory
8888
cachelessDataSourceFactory = new DefaultDataSource.Factory(context,
89-
new DefaultHttpDataSource.Factory().setUserAgent(userAgent))
89+
new DefaultHttpDataSource.Factory().setUserAgent(DownloaderImpl.USER_AGENT))
9090
.setTransferListener(transferListener);
9191
cacheDataSourceFactory = new CacheFactory(context, transferListener, cache,
92-
new DefaultHttpDataSource.Factory().setUserAgent(userAgent));
92+
new DefaultHttpDataSource.Factory().setUserAgent(DownloaderImpl.USER_AGENT));
9393

9494
// YouTube-specific data source factories use getYoutubeHttpDataSourceFactory()
9595
ytHlsCacheDataSourceFactory = new CacheFactory(context, transferListener, cache,

0 commit comments

Comments
 (0)