Java Code Examples for com.google.android.exoplayer2.drm.DrmSessionManager#getDummyDrmSessionManager()

The following examples show how to use com.google.android.exoplayer2.drm.DrmSessionManager#getDummyDrmSessionManager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtractorMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private ExtractorMediaSource(
    Uri uri,
    DataSource.Factory dataSourceFactory,
    ExtractorsFactory extractorsFactory,
    LoadErrorHandlingPolicy loadableLoadErrorHandlingPolicy,
    @Nullable String customCacheKey,
    int continueLoadingCheckIntervalBytes,
    @Nullable Object tag) {
  progressiveMediaSource =
      new ProgressiveMediaSource(
          uri,
          dataSourceFactory,
          extractorsFactory,
          DrmSessionManager.getDummyDrmSessionManager(),
          loadableLoadErrorHandlingPolicy,
          customCacheKey,
          continueLoadingCheckIntervalBytes,
          tag);
}
 
Example 2
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance to play a given {@link DashManifest}, which must be static.
 *
 * @param manifest The manifest. {@link DashManifest#dynamic} must be false.
 * @param chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public DashMediaSource(
    DashManifest manifest,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      DrmSessionManager.getDummyDrmSessionManager(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* livePresentationDelayOverridesManifest= */ false,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example 3
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance to play a given {@link SsManifest}, which must not be live.
 *
 * @param manifest The manifest. {@link SsManifest#isLive} must be false.
 * @param chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public SsMediaSource(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      DrmSessionManager.getDummyDrmSessionManager(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example 4
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance to play the manifest at a given {@link Uri}, which may be live or
 * on-demand.
 *
 * @param manifestUri The manifest {@link Uri}.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest.
 * @param manifestParser A parser for loaded manifest data.
 * @param chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the
 *     default start position should precede the end of the live window.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public SsMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      DrmSessionManager.getDummyDrmSessionManager(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      livePresentationDelayMs,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example 5
Source File: SimpleExoPlayer.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @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);
}
 
Example 6
Source File: HlsMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new factory for {@link HlsMediaSource}s.
 *
 * @param hlsDataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for
 *     manifests, segments and keys.
 */
public Factory(HlsDataSourceFactory hlsDataSourceFactory) {
  this.hlsDataSourceFactory = Assertions.checkNotNull(hlsDataSourceFactory);
  playlistParserFactory = new DefaultHlsPlaylistParserFactory();
  playlistTrackerFactory = DefaultHlsPlaylistTracker.FACTORY;
  extractorFactory = HlsExtractorFactory.DEFAULT;
  drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
  loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
  compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
  metadataType = METADATA_TYPE_ID3;
}
 
Example 7
Source File: ProgressiveMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new factory for {@link ProgressiveMediaSource}s.
 *
 * @param dataSourceFactory A factory for {@link DataSource}s to read the media.
 * @param extractorsFactory A factory for extractors used to extract media from its container.
 */
public Factory(DataSource.Factory dataSourceFactory, ExtractorsFactory extractorsFactory) {
  this.dataSourceFactory = dataSourceFactory;
  this.extractorsFactory = extractorsFactory;
  drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
  loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
  continueLoadingCheckIntervalBytes = DEFAULT_LOADING_CHECK_INTERVAL_BYTES;
}
 
Example 8
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new factory for {@link DashMediaSource}s.
 *
 * @param chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest. May be {@code null} if the factory will only ever be
 *     used to create create media sources with sideloaded manifests via {@link
 *     #createMediaSource(DashManifest, Handler, MediaSourceEventListener)}.
 */
public Factory(
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable DataSource.Factory manifestDataSourceFactory) {
  this.chunkSourceFactory = Assertions.checkNotNull(chunkSourceFactory);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
  loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
  livePresentationDelayMs = DEFAULT_LIVE_PRESENTATION_DELAY_MS;
  compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
}
 
Example 9
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance to play the manifest at a given {@link Uri}, which may be dynamic or
 * static.
 *
 * @param manifestUri The manifest {@link Uri}.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest.
 * @param manifestParser A parser for loaded manifest data.
 * @param chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param livePresentationDelayMs For live playbacks, the duration in milliseconds by which the
 *     default start position should precede the end of the live window. Use {@link
 *     #DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS} to use the value specified by the
 *     manifest, if present.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
@SuppressWarnings("deprecation")
public DashMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      DrmSessionManager.getDummyDrmSessionManager(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      livePresentationDelayMs == DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
          ? DEFAULT_LIVE_PRESENTATION_DELAY_MS
          : livePresentationDelayMs,
      livePresentationDelayMs != DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example 10
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new factory for {@link SsMediaSource}s.
 *
 * @param chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @param manifestDataSourceFactory A factory for {@link DataSource} instances that will be used
 *     to load (and refresh) the manifest. May be {@code null} if the factory will only ever be
 *     used to create create media sources with sideloaded manifests via {@link
 *     #createMediaSource(SsManifest, Handler, MediaSourceEventListener)}.
 */
public Factory(
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable DataSource.Factory manifestDataSourceFactory) {
  this.chunkSourceFactory = Assertions.checkNotNull(chunkSourceFactory);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  drmSessionManager = DrmSessionManager.getDummyDrmSessionManager();
  loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
  livePresentationDelayMs = DEFAULT_LIVE_PRESENTATION_DELAY_MS;
  compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
}
 
Example 11
Source File: ChunkSampleStream.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param primaryTrackType The type of the primary track. One of the {@link C} {@code
 *     TRACK_TYPE_*} constants.
 * @param embeddedTrackTypes The types of any embedded tracks, or null.
 * @param embeddedTrackFormats The formats of the embedded tracks, or null.
 * @param chunkSource A {@link ChunkSource} from which chunks to load are obtained.
 * @param callback An {@link Callback} for the stream.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 * @param positionUs The position from which to start loading media.
 * @param drmSessionManager The {@link DrmSessionManager} to obtain {@link DrmSession DrmSessions}
 *     from.
 * @param loadErrorHandlingPolicy The {@link LoadErrorHandlingPolicy}.
 * @param eventDispatcher A dispatcher to notify of events.
 */
public ChunkSampleStream(
    int primaryTrackType,
    @Nullable int[] embeddedTrackTypes,
    @Nullable Format[] embeddedTrackFormats,
    T chunkSource,
    Callback<ChunkSampleStream<T>> callback,
    Allocator allocator,
    long positionUs,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher) {
  this.primaryTrackType = primaryTrackType;
  this.embeddedTrackTypes = embeddedTrackTypes;
  this.embeddedTrackFormats = embeddedTrackFormats;
  this.chunkSource = chunkSource;
  this.callback = callback;
  this.eventDispatcher = eventDispatcher;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  loader = new Loader("Loader:ChunkSampleStream");
  nextChunkHolder = new ChunkHolder();
  mediaChunks = new ArrayList<>();
  readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);

  int embeddedTrackCount = embeddedTrackTypes == null ? 0 : embeddedTrackTypes.length;
  embeddedSampleQueues = new SampleQueue[embeddedTrackCount];
  embeddedTracksSelected = new boolean[embeddedTrackCount];
  int[] trackTypes = new int[1 + embeddedTrackCount];
  SampleQueue[] sampleQueues = new SampleQueue[1 + embeddedTrackCount];

  primarySampleQueue = new SampleQueue(allocator, drmSessionManager);
  trackTypes[0] = primaryTrackType;
  sampleQueues[0] = primarySampleQueue;

  for (int i = 0; i < embeddedTrackCount; i++) {
    SampleQueue sampleQueue =
        new SampleQueue(allocator, DrmSessionManager.getDummyDrmSessionManager());
    embeddedSampleQueues[i] = sampleQueue;
    sampleQueues[i + 1] = sampleQueue;
    trackTypes[i + 1] = embeddedTrackTypes[i];
  }

  mediaChunkOutput = new BaseMediaChunkOutput(trackTypes, sampleQueues);
  pendingResetPositionUs = positionUs;
  lastSeekPositionUs = positionUs;
}
 
Example 12
Source File: PlayerEmsgHandler.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/** Returns a {@link TrackOutput} that emsg messages could be written to. */
public PlayerTrackEmsgHandler newPlayerTrackEmsgHandler() {
  return new PlayerTrackEmsgHandler(
      new SampleQueue(allocator, DrmSessionManager.getDummyDrmSessionManager()));
}