com.google.android.exoplayer2.source.MediaSourceEventListener Java Examples

The following examples show how to use com.google.android.exoplayer2.source.MediaSourceEventListener. 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: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* livePresentationDelayOverridesManifest= */ false,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #2
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      livePresentationDelayMs,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #3
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.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 chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @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 SsMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    SsChunkSource.Factory chunkSourceFactory,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      chunkSourceFactory,
      DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT,
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      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 chunkSourceFactory A factory for {@link SsChunkSource} instances.
 * @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 SsMediaSource(
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      chunkSourceFactory,
      DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT,
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      eventHandler,
      eventListener);
}
 
Example #5
Source File: SsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      livePresentationDelayMs,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #6
Source File: DashMediaSource.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 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 chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @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,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      chunkSourceFactory,
      DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT,
      DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS,
      eventHandler,
      eventListener);
}
 
Example #7
Source File: DashMediaSource.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 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 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,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      new DashManifestParser(),
      chunkSourceFactory,
      minLoadableRetryCount,
      livePresentationDelayMs,
      eventHandler,
      eventListener);
}
 
Example #8
Source File: AnalyticsListenerForwarder.java    From no-player with Apache License 2.0 6 votes vote down vote up
@Override
public void onLoadError(EventTime eventTime,
                        MediaSourceEventListener.LoadEventInfo loadEventInfo,
                        MediaSourceEventListener.MediaLoadData mediaLoadData,
                        IOException error,
                        boolean wasCanceled) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put(Parameters.EVENT_TIME, eventTime.toString());
    callingMethodParameters.put(Parameters.LOAD_EVENT_INFO, loadEventInfo.toString());
    callingMethodParameters.put(Parameters.MEDIA_LOAD_DATA, mediaLoadData.toString());
    callingMethodParameters.put(Parameters.ERROR, error.toString());
    callingMethodParameters.put(Parameters.WAS_CANCELED, String.valueOf(wasCanceled));

    infoListeners.onNewInfo(Methods.ON_LOAD_ERROR, callingMethodParameters);
}
 
Example #9
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 #10
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 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 chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @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,
    DashChunkSource.Factory chunkSourceFactory,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      chunkSourceFactory,
      DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT,
      DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS,
      eventHandler,
      eventListener);
}
 
Example #11
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* livePresentationDelayOverridesManifest= */ false,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #12
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* livePresentationDelayOverridesManifest= */ false,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #13
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 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 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,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      new DashManifestParser(),
      chunkSourceFactory,
      minLoadableRetryCount,
      livePresentationDelayMs,
      eventHandler,
      eventListener);
}
 
Example #14
Source File: MediaSourceFactory.java    From no-player with Apache License 2.0 6 votes vote down vote up
public MediaSource create(Options options,
                          Uri uri,
                          MediaSourceEventListener mediaSourceEventListener,
                          DefaultBandwidthMeter bandwidthMeter) {
    DefaultDataSourceFactory defaultDataSourceFactory = createDataSourceFactory(bandwidthMeter);
    switch (options.contentType()) {
        case HLS:
            return createHlsMediaSource(defaultDataSourceFactory, uri, mediaSourceEventListener);
        case H264:
            return createH264MediaSource(defaultDataSourceFactory, uri, mediaSourceEventListener);
        case DASH:
            return createDashMediaSource(defaultDataSourceFactory, uri, mediaSourceEventListener);
        default:
            throw new UnsupportedOperationException("Content type: " + options + " is not supported.");
    }
}
 
Example #15
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #16
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #17
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      minLoadableRetryCount,
      livePresentationDelayMs,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #18
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 6 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 chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @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,
    DashChunkSource.Factory chunkSourceFactory,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      chunkSourceFactory,
      DefaultLoadErrorHandlingPolicy.DEFAULT_MIN_LOADABLE_RETRY_COUNT,
      DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS,
      eventHandler,
      eventListener);
}
 
Example #19
Source File: MediaSourceBuilder.java    From ARVI with Apache License 2.0 6 votes vote down vote up
@NonNull @Override
public MediaSource buildMediaSource(@NonNull Context context,
                                    @NonNull Uri fileUri,
                                    @Nullable String fileExtension,
                                    @Nullable Handler handler,
                                    @NonNull DataSource.Factory manifestDataSourceFactory,
                                    @NonNull DataSource.Factory mediaDataSourceFactory,
                                    @Nullable MediaSourceEventListener eventListener) {
    return new LoopingMediaSource(DEFAULT.buildMediaSource(
        context,
        fileUri,
        fileExtension,
        handler,
        manifestDataSourceFactory,
        mediaDataSourceFactory,
        eventListener
    ));
}
 
Example #20
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 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 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,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      new DashManifestParser(),
      chunkSourceFactory,
      minLoadableRetryCount,
      livePresentationDelayMs,
      eventHandler,
      eventListener);
}
 
Example #21
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 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 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,
    DashChunkSource.Factory chunkSourceFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      manifestDataSourceFactory,
      new DashManifestParser(),
      chunkSourceFactory,
      minLoadableRetryCount,
      livePresentationDelayMs,
      eventHandler,
      eventListener);
}
 
Example #22
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param manifestUri The {@link Uri} of the HLS manifest.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for manifests,
 *     segments and keys.
 * @param minLoadableRetryCount The minimum number of times loads must be retried before errors
 *     are propagated.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A {@link MediaSourceEventListener}. May be null if delivery of events is
 *     not required.
 * @deprecated Use {@link Factory} instead.
 */
@Deprecated
public HlsMediaSource(
    Uri manifestUri,
    DataSource.Factory dataSourceFactory,
    int minLoadableRetryCount,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifestUri,
      new DefaultHlsDataSourceFactory(dataSourceFactory),
      HlsExtractorFactory.DEFAULT,
      minLoadableRetryCount,
      eventHandler,
      eventListener,
      new HlsPlaylistParser());
}
 
Example #23
Source File: SsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      manifest,
      /* manifestUri= */ null,
      /* manifestDataSourceFactory= */ null,
      /* manifestParser= */ null,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      new DefaultLoadErrorHandlingPolicy(minLoadableRetryCount),
      DEFAULT_LIVE_PRESENTATION_DELAY_MS,
      /* tag= */ null);
  if (eventHandler != null && eventListener != null) {
    addEventListener(eventHandler, eventListener);
  }
}
 
Example #24
Source File: AnalyticsListenerForwarder.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpstreamDiscarded(EventTime eventTime, MediaSourceEventListener.MediaLoadData mediaLoadData) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put(Parameters.EVENT_TIME, eventTime.toString());
    callingMethodParameters.put(Parameters.MEDIA_LOAD_DATA, mediaLoadData.toString());

    infoListeners.onNewInfo(Methods.ON_UPSTREAM_DISCARDED, callingMethodParameters);
}
 
Example #25
Source File: AnalyticsListenerForwarder.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onLoadCanceled(EventTime eventTime,
                           MediaSourceEventListener.LoadEventInfo loadEventInfo,
                           MediaSourceEventListener.MediaLoadData mediaLoadData) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put(Parameters.EVENT_TIME, eventTime.toString());
    callingMethodParameters.put(Parameters.LOAD_EVENT_INFO, loadEventInfo.toString());
    callingMethodParameters.put(Parameters.MEDIA_LOAD_DATA, mediaLoadData.toString());

    infoListeners.onNewInfo(Methods.ON_LOAD_CANCELED, callingMethodParameters);
}
 
Example #26
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.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,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(
      /* manifest= */ null,
      manifestUri,
      manifestDataSourceFactory,
      manifestParser,
      chunkSourceFactory,
      new DefaultCompositeSequenceableLoaderFactory(),
      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 #27
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @deprecated Use {@link #createMediaSource(Uri)} and {@link #addEventListener(Handler,
 *     MediaSourceEventListener)} instead.
 */
@Deprecated
public DashMediaSource createMediaSource(
    Uri manifestUri,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  DashMediaSource mediaSource = createMediaSource(manifestUri);
  if (eventHandler != null && eventListener != null) {
    mediaSource.addEventListener(eventHandler, eventListener);
  }
  return mediaSource;
}
 
Example #28
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.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 chunkSourceFactory A factory for {@link DashChunkSource} instances.
 * @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,
    DashChunkSource.Factory chunkSourceFactory,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(manifestUri, manifestDataSourceFactory, chunkSourceFactory,
      DEFAULT_MIN_LOADABLE_RETRY_COUNT, DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS,
      eventHandler, eventListener);
}
 
Example #29
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated Use {@link #createMediaSource(DashManifest)} and {@link
 *     #addEventListener(Handler, MediaSourceEventListener)} instead.
 */
@Deprecated
public DashMediaSource createMediaSource(
    DashManifest manifest,
    @Nullable Handler eventHandler,
    @Nullable MediaSourceEventListener eventListener) {
  DashMediaSource mediaSource = createMediaSource(manifest);
  if (eventHandler != null && eventListener != null) {
    mediaSource.addEventListener(eventHandler, eventListener);
  }
  return mediaSource;
}
 
Example #30
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 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 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(
    DashManifest manifest,
    DashChunkSource.Factory chunkSourceFactory,
    Handler eventHandler,
    MediaSourceEventListener eventListener) {
  this(manifest, chunkSourceFactory, DEFAULT_MIN_LOADABLE_RETRY_COUNT, eventHandler,
      eventListener);
}