How to use custom DataSource in ExoPlayer 2?
Asked Answered
T

1

7
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this,
    Util.getUserAgent(this, "yourApplicationName"), bandwidthMeter);
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
MediaSource videoSource = new ExtractorMediaSource(mp4VideoUri,
    dataSourceFactory, extractorsFactory, null, null);
player.prepare(videoSource);

How can i use custom datasource or AesCipherDataSource in ExoPlayer 2. I tried searching in google, but no solution at all

Trodden answered 4/2, 2017 at 9:26 Comment(0)
A
0

To use AesCipherDataSource you need to implement the library datasource from exoplayer or media3 depending if you have done the migration or not

#For Exoplayer
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"

# For Media3
implementation "androidx.media3:media3-datasource:$media3_version"
Anemic answered 25/10, 2023 at 6:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.