mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Document injection of DrmSessionManagers into MediaSources instead of Renderers
PiperOrigin-RevId: 263532499
This commit is contained in:
parent
4b75d3338e
commit
6a122f4740
5 changed files with 113 additions and 48 deletions
|
|
@ -36,6 +36,8 @@
|
||||||
quality video can be loaded up to the full default buffer duration.
|
quality video can be loaded up to the full default buffer duration.
|
||||||
* Replace `ExoPlayerFactory` by `SimpleExoPlayer.Builder` and
|
* Replace `ExoPlayerFactory` by `SimpleExoPlayer.Builder` and
|
||||||
`ExoPlayer.Builder`.
|
`ExoPlayer.Builder`.
|
||||||
|
* Inject `DrmSessionManager` into the `MediaSources` instead of `Renderers`
|
||||||
|
([#5619](https://github.com/google/ExoPlayer/issues/5619)).
|
||||||
|
|
||||||
### 2.10.4 ###
|
### 2.10.4 ###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import androidx.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
|
import com.google.android.exoplayer2.analytics.AnalyticsCollector;
|
||||||
import com.google.android.exoplayer2.drm.DrmSessionManager;
|
import com.google.android.exoplayer2.drm.DrmSessionManager;
|
||||||
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
|
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
|
||||||
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||||
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||||||
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
||||||
|
|
@ -34,7 +35,11 @@ public final class ExoPlayerFactory {
|
||||||
|
|
||||||
private ExoPlayerFactory() {}
|
private ExoPlayerFactory() {}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -49,7 +54,11 @@ public final class ExoPlayerFactory {
|
||||||
context, renderersFactory, trackSelector, loadControl, drmSessionManager);
|
context, renderersFactory, trackSelector, loadControl, drmSessionManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -98,7 +107,11 @@ public final class ExoPlayerFactory {
|
||||||
return newSimpleInstance(context, renderersFactory, trackSelector, loadControl);
|
return newSimpleInstance(context, renderersFactory, trackSelector, loadControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -111,7 +124,11 @@ public final class ExoPlayerFactory {
|
||||||
context, renderersFactory, trackSelector, loadControl, drmSessionManager);
|
context, renderersFactory, trackSelector, loadControl, drmSessionManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -140,7 +157,11 @@ public final class ExoPlayerFactory {
|
||||||
Util.getLooper());
|
Util.getLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -153,7 +174,11 @@ public final class ExoPlayerFactory {
|
||||||
context, renderersFactory, trackSelector, loadControl, drmSessionManager, Util.getLooper());
|
context, renderersFactory, trackSelector, loadControl, drmSessionManager, Util.getLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -174,7 +199,11 @@ public final class ExoPlayerFactory {
|
||||||
Util.getLooper());
|
Util.getLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -194,7 +223,11 @@ public final class ExoPlayerFactory {
|
||||||
Util.getLooper());
|
Util.getLooper());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -214,7 +247,11 @@ public final class ExoPlayerFactory {
|
||||||
looper);
|
looper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
|
|
@ -236,7 +273,11 @@ public final class ExoPlayerFactory {
|
||||||
looper);
|
looper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link SimpleExoPlayer.Builder} instead. */
|
/**
|
||||||
|
* @deprecated Use {@link SimpleExoPlayer.Builder} instead. The {@link DrmSessionManager} cannot
|
||||||
|
* be passed to {@link SimpleExoPlayer.Builder} and should instead be injected into the {@link
|
||||||
|
* MediaSource} factories.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static SimpleExoPlayer newSimpleInstance(
|
public static SimpleExoPlayer newSimpleInstance(
|
||||||
Context context,
|
Context context,
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
private Clock clock;
|
private Clock clock;
|
||||||
private TrackSelector trackSelector;
|
private TrackSelector trackSelector;
|
||||||
private LoadControl loadControl;
|
private LoadControl loadControl;
|
||||||
private DrmSessionManager<FrameworkMediaCrypto> drmSessionManager;
|
|
||||||
private BandwidthMeter bandwidthMeter;
|
private BandwidthMeter bandwidthMeter;
|
||||||
private AnalyticsCollector analyticsCollector;
|
private AnalyticsCollector analyticsCollector;
|
||||||
private Looper looper;
|
private Looper looper;
|
||||||
|
|
@ -111,7 +110,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
* <li>{@link RenderersFactory}: {@link DefaultRenderersFactory}
|
* <li>{@link RenderersFactory}: {@link DefaultRenderersFactory}
|
||||||
* <li>{@link TrackSelector}: {@link DefaultTrackSelector}
|
* <li>{@link TrackSelector}: {@link DefaultTrackSelector}
|
||||||
* <li>{@link LoadControl}: {@link DefaultLoadControl}
|
* <li>{@link LoadControl}: {@link DefaultLoadControl}
|
||||||
* <li>{@link DrmSessionManager}: {@link DrmSessionManager#getDummyDrmSessionManager()}
|
|
||||||
* <li>{@link BandwidthMeter}: {@link DefaultBandwidthMeter#getSingletonInstance(Context)}
|
* <li>{@link BandwidthMeter}: {@link DefaultBandwidthMeter#getSingletonInstance(Context)}
|
||||||
* <li>{@link Looper}: The {@link Looper} associated with the current thread, or the {@link
|
* <li>{@link Looper}: The {@link Looper} associated with the current thread, or the {@link
|
||||||
* Looper} of the application's main thread if the current thread doesn't have a {@link
|
* Looper} of the application's main thread if the current thread doesn't have a {@link
|
||||||
|
|
@ -141,7 +139,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
renderersFactory,
|
renderersFactory,
|
||||||
new DefaultTrackSelector(context),
|
new DefaultTrackSelector(context),
|
||||||
new DefaultLoadControl(),
|
new DefaultLoadControl(),
|
||||||
DrmSessionManager.getDummyDrmSessionManager(),
|
|
||||||
DefaultBandwidthMeter.getSingletonInstance(context),
|
DefaultBandwidthMeter.getSingletonInstance(context),
|
||||||
Util.getLooper(),
|
Util.getLooper(),
|
||||||
new AnalyticsCollector(Clock.DEFAULT),
|
new AnalyticsCollector(Clock.DEFAULT),
|
||||||
|
|
@ -160,7 +157,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
* player.
|
* player.
|
||||||
* @param trackSelector A {@link TrackSelector}.
|
* @param trackSelector A {@link TrackSelector}.
|
||||||
* @param loadControl A {@link LoadControl}.
|
* @param loadControl A {@link LoadControl}.
|
||||||
* @param drmSessionManager A {@link DrmSessionManager}.
|
|
||||||
* @param bandwidthMeter A {@link BandwidthMeter}.
|
* @param bandwidthMeter A {@link BandwidthMeter}.
|
||||||
* @param looper A {@link Looper} that must be used for all calls to the player.
|
* @param looper A {@link Looper} that must be used for all calls to the player.
|
||||||
* @param analyticsCollector An {@link AnalyticsCollector}.
|
* @param analyticsCollector An {@link AnalyticsCollector}.
|
||||||
|
|
@ -171,7 +167,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
RenderersFactory renderersFactory,
|
RenderersFactory renderersFactory,
|
||||||
TrackSelector trackSelector,
|
TrackSelector trackSelector,
|
||||||
LoadControl loadControl,
|
LoadControl loadControl,
|
||||||
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
|
|
||||||
BandwidthMeter bandwidthMeter,
|
BandwidthMeter bandwidthMeter,
|
||||||
Looper looper,
|
Looper looper,
|
||||||
AnalyticsCollector analyticsCollector,
|
AnalyticsCollector analyticsCollector,
|
||||||
|
|
@ -180,7 +175,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
this.renderersFactory = renderersFactory;
|
this.renderersFactory = renderersFactory;
|
||||||
this.trackSelector = trackSelector;
|
this.trackSelector = trackSelector;
|
||||||
this.loadControl = loadControl;
|
this.loadControl = loadControl;
|
||||||
this.drmSessionManager = drmSessionManager;
|
|
||||||
this.bandwidthMeter = bandwidthMeter;
|
this.bandwidthMeter = bandwidthMeter;
|
||||||
this.looper = looper;
|
this.looper = looper;
|
||||||
this.analyticsCollector = analyticsCollector;
|
this.analyticsCollector = analyticsCollector;
|
||||||
|
|
@ -213,19 +207,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the {@link DrmSessionManager} that will be used for DRM protected playbacks.
|
|
||||||
*
|
|
||||||
* @param drmSessionManager A {@link DrmSessionManager}.
|
|
||||||
* @return This builder.
|
|
||||||
* @throws IllegalStateException If {@link #build()} has already been called.
|
|
||||||
*/
|
|
||||||
public Builder setDrmSessionManager(DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) {
|
|
||||||
Assertions.checkState(!buildCalled);
|
|
||||||
this.drmSessionManager = drmSessionManager;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link BandwidthMeter} that will be used by the player.
|
* Sets the {@link BandwidthMeter} that will be used by the player.
|
||||||
*
|
*
|
||||||
|
|
@ -294,7 +275,6 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
renderersFactory,
|
renderersFactory,
|
||||||
trackSelector,
|
trackSelector,
|
||||||
loadControl,
|
loadControl,
|
||||||
drmSessionManager,
|
|
||||||
bandwidthMeter,
|
bandwidthMeter,
|
||||||
analyticsCollector,
|
analyticsCollector,
|
||||||
clock,
|
clock,
|
||||||
|
|
@ -354,7 +334,11 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
* will not be used for DRM protected playbacks.
|
* will not be used for DRM protected playbacks.
|
||||||
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
||||||
* used to call listeners on.
|
* used to call listeners on.
|
||||||
|
* @deprecated Use {@link #SimpleExoPlayer(Context, RenderersFactory, TrackSelector, LoadControl,
|
||||||
|
* BandwidthMeter, AnalyticsCollector, Clock, Looper)} instead, and pass the {@link
|
||||||
|
* DrmSessionManager} to the {@link MediaSource} factories.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected SimpleExoPlayer(
|
protected SimpleExoPlayer(
|
||||||
Context context,
|
Context context,
|
||||||
RenderersFactory renderersFactory,
|
RenderersFactory renderersFactory,
|
||||||
|
|
@ -386,7 +370,11 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
* player events.
|
* player events.
|
||||||
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
||||||
* used to call listeners on.
|
* used to call listeners on.
|
||||||
|
* @deprecated Use {@link #SimpleExoPlayer(Context, RenderersFactory, TrackSelector, LoadControl,
|
||||||
|
* BandwidthMeter, AnalyticsCollector, Clock, Looper)} instead, and pass the {@link
|
||||||
|
* DrmSessionManager} to the {@link MediaSource} factories.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected SimpleExoPlayer(
|
protected SimpleExoPlayer(
|
||||||
Context context,
|
Context context,
|
||||||
RenderersFactory renderersFactory,
|
RenderersFactory renderersFactory,
|
||||||
|
|
@ -408,6 +396,41 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
looper);
|
looper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context A {@link Context}.
|
||||||
|
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
|
||||||
|
* @param trackSelector The {@link TrackSelector} that will be used by the instance.
|
||||||
|
* @param loadControl The {@link LoadControl} that will be used by the instance.
|
||||||
|
* @param bandwidthMeter The {@link BandwidthMeter} that will be used by the instance.
|
||||||
|
* @param analyticsCollector A factory for creating the {@link AnalyticsCollector} that will
|
||||||
|
* collect and forward all player events.
|
||||||
|
* @param clock The {@link Clock} that will be used by the instance. Should always be {@link
|
||||||
|
* Clock#DEFAULT}, unless the player is being used from a test.
|
||||||
|
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
||||||
|
* used to call listeners on.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
protected SimpleExoPlayer(
|
||||||
|
Context context,
|
||||||
|
RenderersFactory renderersFactory,
|
||||||
|
TrackSelector trackSelector,
|
||||||
|
LoadControl loadControl,
|
||||||
|
BandwidthMeter bandwidthMeter,
|
||||||
|
AnalyticsCollector analyticsCollector,
|
||||||
|
Clock clock,
|
||||||
|
Looper looper) {
|
||||||
|
this(
|
||||||
|
context,
|
||||||
|
renderersFactory,
|
||||||
|
trackSelector,
|
||||||
|
loadControl,
|
||||||
|
DrmSessionManager.getDummyDrmSessionManager(),
|
||||||
|
bandwidthMeter,
|
||||||
|
analyticsCollector,
|
||||||
|
clock,
|
||||||
|
looper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param context A {@link Context}.
|
* @param context A {@link Context}.
|
||||||
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
|
* @param renderersFactory A factory for creating {@link Renderer}s to be used by the instance.
|
||||||
|
|
@ -422,7 +445,11 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
* Clock#DEFAULT}, unless the player is being used from a test.
|
* Clock#DEFAULT}, unless the player is being used from a test.
|
||||||
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
* @param looper The {@link Looper} which must be used for all calls to the player and which is
|
||||||
* used to call listeners on.
|
* used to call listeners on.
|
||||||
|
* @deprecated Use {@link #SimpleExoPlayer(Context, RenderersFactory, TrackSelector, LoadControl,
|
||||||
|
* BandwidthMeter, AnalyticsCollector, Clock, Looper)} instead, and pass the {@link
|
||||||
|
* DrmSessionManager} to the {@link MediaSource} factories.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected SimpleExoPlayer(
|
protected SimpleExoPlayer(
|
||||||
Context context,
|
Context context,
|
||||||
RenderersFactory renderersFactory,
|
RenderersFactory renderersFactory,
|
||||||
|
|
|
||||||
|
|
@ -257,10 +257,10 @@ public final class DashTestRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DefaultDrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
|
protected DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
|
||||||
final String userAgent) {
|
final String userAgent) {
|
||||||
if (widevineLicenseUrl == null) {
|
if (widevineLicenseUrl == null) {
|
||||||
return null;
|
return DrmSessionManager.getDummyDrmSessionManager();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl,
|
MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl,
|
||||||
|
|
@ -283,27 +283,25 @@ public final class DashTestRunner {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SimpleExoPlayer buildExoPlayer(
|
protected SimpleExoPlayer buildExoPlayer(
|
||||||
HostActivity host,
|
HostActivity host, Surface surface, MappingTrackSelector trackSelector) {
|
||||||
Surface surface,
|
|
||||||
MappingTrackSelector trackSelector,
|
|
||||||
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) {
|
|
||||||
SimpleExoPlayer player =
|
SimpleExoPlayer player =
|
||||||
new SimpleExoPlayer.Builder(host, new DebugRenderersFactory(host))
|
new SimpleExoPlayer.Builder(host, new DebugRenderersFactory(host))
|
||||||
.setTrackSelector(trackSelector)
|
.setTrackSelector(trackSelector)
|
||||||
.setDrmSessionManager(drmSessionManager)
|
|
||||||
.build();
|
.build();
|
||||||
player.setVideoSurface(surface);
|
player.setVideoSurface(surface);
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MediaSource buildSource(HostActivity host, String userAgent) {
|
protected MediaSource buildSource(
|
||||||
|
HostActivity host, String userAgent, DrmSessionManager<?> drmSessionManager) {
|
||||||
DataSource.Factory dataSourceFactory =
|
DataSource.Factory dataSourceFactory =
|
||||||
this.dataSourceFactory != null
|
this.dataSourceFactory != null
|
||||||
? this.dataSourceFactory
|
? this.dataSourceFactory
|
||||||
: new DefaultDataSourceFactory(host, userAgent);
|
: new DefaultDataSourceFactory(host, userAgent);
|
||||||
Uri manifestUri = Uri.parse(manifestUrl);
|
Uri manifestUri = Uri.parse(manifestUrl);
|
||||||
return new DashMediaSource.Factory(dataSourceFactory)
|
return new DashMediaSource.Factory(dataSourceFactory)
|
||||||
|
.setDrmSessionManager(drmSessionManager)
|
||||||
.setLoadErrorHandlingPolicy(new DefaultLoadErrorHandlingPolicy(MIN_LOADABLE_RETRY_COUNT))
|
.setLoadErrorHandlingPolicy(new DefaultLoadErrorHandlingPolicy(MIN_LOADABLE_RETRY_COUNT))
|
||||||
.createMediaSource(manifestUri);
|
.createMediaSource(manifestUri);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
|
||||||
// Build the player.
|
// Build the player.
|
||||||
trackSelector = buildTrackSelector(host);
|
trackSelector = buildTrackSelector(host);
|
||||||
String userAgent = "ExoPlayerPlaybackTests";
|
String userAgent = "ExoPlayerPlaybackTests";
|
||||||
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = buildDrmSessionManager(userAgent);
|
player = buildExoPlayer(host, surface, trackSelector);
|
||||||
player = buildExoPlayer(host, surface, trackSelector, drmSessionManager);
|
|
||||||
player.setPlayWhenReady(true);
|
player.setPlayWhenReady(true);
|
||||||
player.addAnalyticsListener(this);
|
player.addAnalyticsListener(this);
|
||||||
player.addAnalyticsListener(new EventLogger(trackSelector, tag));
|
player.addAnalyticsListener(new EventLogger(trackSelector, tag));
|
||||||
|
|
@ -141,7 +140,8 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
|
||||||
pendingSchedule.start(player, trackSelector, surface, actionHandler, /* callback= */ null);
|
pendingSchedule.start(player, trackSelector, surface, actionHandler, /* callback= */ null);
|
||||||
pendingSchedule = null;
|
pendingSchedule = null;
|
||||||
}
|
}
|
||||||
player.prepare(buildSource(host, Util.getUserAgent(host, userAgent)));
|
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = buildDrmSessionManager(userAgent);
|
||||||
|
player.prepare(buildSource(host, Util.getUserAgent(host, userAgent), drmSessionManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -230,7 +230,7 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
|
||||||
|
|
||||||
protected DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(String userAgent) {
|
protected DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(String userAgent) {
|
||||||
// Do nothing. Interested subclasses may override.
|
// Do nothing. Interested subclasses may override.
|
||||||
return null;
|
return DrmSessionManager.getDummyDrmSessionManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DefaultTrackSelector buildTrackSelector(HostActivity host) {
|
protected DefaultTrackSelector buildTrackSelector(HostActivity host) {
|
||||||
|
|
@ -238,23 +238,20 @@ public abstract class ExoHostedTest implements AnalyticsListener, HostedTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SimpleExoPlayer buildExoPlayer(
|
protected SimpleExoPlayer buildExoPlayer(
|
||||||
HostActivity host,
|
HostActivity host, Surface surface, MappingTrackSelector trackSelector) {
|
||||||
Surface surface,
|
|
||||||
MappingTrackSelector trackSelector,
|
|
||||||
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) {
|
|
||||||
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(host);
|
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(host);
|
||||||
renderersFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
|
renderersFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF);
|
||||||
renderersFactory.setAllowedVideoJoiningTimeMs(/* allowedVideoJoiningTimeMs= */ 0);
|
renderersFactory.setAllowedVideoJoiningTimeMs(/* allowedVideoJoiningTimeMs= */ 0);
|
||||||
SimpleExoPlayer player =
|
SimpleExoPlayer player =
|
||||||
new SimpleExoPlayer.Builder(host, renderersFactory)
|
new SimpleExoPlayer.Builder(host, renderersFactory)
|
||||||
.setTrackSelector(trackSelector)
|
.setTrackSelector(trackSelector)
|
||||||
.setDrmSessionManager(drmSessionManager)
|
|
||||||
.build();
|
.build();
|
||||||
player.setVideoSurface(surface);
|
player.setVideoSurface(surface);
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract MediaSource buildSource(HostActivity host, String userAgent);
|
protected abstract MediaSource buildSource(
|
||||||
|
HostActivity host, String userAgent, DrmSessionManager<?> drmSessionManager);
|
||||||
|
|
||||||
protected void onPlayerErrorInternal(ExoPlaybackException error) {
|
protected void onPlayerErrorInternal(ExoPlaybackException error) {
|
||||||
// Do nothing. Interested subclasses may override.
|
// Do nothing. Interested subclasses may override.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue