Java 类com.google.android.exoplayer2.upstream.TransferListener 实例源码

项目:yjPlay    文件:EncryptedFileDataSourceFactory.java   
/**
 * Instantiates a new Encrypted file data source factory.
 *
 * @param context         the context
 * @param cipher          the cipher
 * @param secretKeySpec   the secret key spec
 * @param ivParameterSpec the iv parameter spec
 * @param listener        the listener
 */
public EncryptedFileDataSourceFactory(Context context, Cipher cipher, SecretKeySpec secretKeySpec, IvParameterSpec ivParameterSpec, TransferListener<? super DataSource> listener) {
    mCipher = cipher;
    mSecretKeySpec = secretKeySpec;
    mIvParameterSpec = ivParameterSpec;
    mTransferListener = listener;
    String userAgent = Util.getUserAgent(context, context.getPackageName());
    this.context = context.getApplicationContext();
    this.baseDataSourceFactory = new DefaultDataSourceFactory(context, userAgent);
}
项目:ExoMedia    文件:App.java   
private void configureExoMedia() {
    // Registers the media sources to use the OkHttp client instead of the standard Apache one
    // Note: the OkHttpDataSourceFactory can be found in the ExoPlayer extension library `extension-okhttp`
    ExoMedia.setDataSourceFactoryProvider(new ExoMedia.DataSourceFactoryProvider() {
        @NonNull
        @Override
        public DataSource.Factory provide(@NonNull String userAgent, @Nullable TransferListener<? super DataSource> listener) {
            // Updates the network data source to use the OKHttp implementation
            DataSource.Factory upstreamFactory = new OkHttpDataSourceFactory(new OkHttpClient(), userAgent, listener);

            // Adds a cache around the upstreamFactory
            Cache cache = new SimpleCache(getCacheDir(), new LeastRecentlyUsedCacheEvictor(50 * 1024 * 1024));
            return new CacheDataSourceFactory(cache, upstreamFactory, CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR);
        }
    });
}
项目:transistor    文件:DashTestRunner.java   
@Override
protected MediaSource buildSource(HostActivity host, String userAgent,
    TransferListener<? super DataSource> mediaTransferListener) {
  DataSource.Factory manifestDataSourceFactory = dataSourceFactory != null
      ? dataSourceFactory : new DefaultDataSourceFactory(host, userAgent);
  DataSource.Factory mediaDataSourceFactory = dataSourceFactory != null
      ? dataSourceFactory
      : new DefaultDataSourceFactory(host, userAgent, mediaTransferListener);
  Uri manifestUri = Uri.parse(manifestUrl);
  DefaultDashChunkSource.Factory chunkSourceFactory = new DefaultDashChunkSource.Factory(
      mediaDataSourceFactory);
  return new DashMediaSource.Factory(chunkSourceFactory, manifestDataSourceFactory)
      .setMinLoadableRetryCount(MIN_LOADABLE_RETRY_COUNT)
      .setLivePresentationDelayMs(0)
      .createMediaSource(manifestUri);
}
项目:transistor    文件:CronetDataSource.java   
CronetDataSource(CronetEngine cronetEngine, Executor executor,
    Predicate<String> contentTypePredicate, TransferListener<? super CronetDataSource> listener,
    int connectTimeoutMs, int readTimeoutMs, boolean resetTimeoutOnRedirects, Clock clock,
    RequestProperties defaultRequestProperties, boolean handleSetCookieRequests) {
  this.cronetEngine = Assertions.checkNotNull(cronetEngine);
  this.executor = Assertions.checkNotNull(executor);
  this.contentTypePredicate = contentTypePredicate;
  this.listener = listener;
  this.connectTimeoutMs = connectTimeoutMs;
  this.readTimeoutMs = readTimeoutMs;
  this.resetTimeoutOnRedirects = resetTimeoutOnRedirects;
  this.clock = Assertions.checkNotNull(clock);
  this.defaultRequestProperties = defaultRequestProperties;
  this.handleSetCookieRequests = handleSetCookieRequests;
  requestProperties = new RequestProperties();
  operation = new ConditionVariable();
}
项目:ExoPlayer-Offline    文件:DashTest.java   
@Override
protected MediaSource buildSource(HostActivity host, String userAgent,
    TransferListener<? super DataSource> mediaTransferListener) {
  DataSource.Factory manifestDataSourceFactory = new DefaultDataSourceFactory(host, userAgent);
  DataSource.Factory mediaDataSourceFactory = new DefaultDataSourceFactory(host, userAgent,
      mediaTransferListener);
  Uri manifestUri = Uri.parse(parameters.manifestUrl);
  DefaultDashChunkSource.Factory chunkSourceFactory = new DefaultDashChunkSource.Factory(
      mediaDataSourceFactory);
  return new DashMediaSource(manifestUri, manifestDataSourceFactory, chunkSourceFactory,
      MIN_LOADABLE_RETRY_COUNT, 0 /* livePresentationDelayMs */, null, null);
}
项目:react-native-exoplayer-intent-video    文件:PlayerController.java   
public PlayerController(Context context) {
    this.bandwidthMeter = new DefaultBandwidthMeter();
    this.loadControl = new DefaultLoadControl();
    this.extractorsFactory = new DefaultExtractorsFactory();
    this.trackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
    this.dataSourceFactory = new DefaultDataSourceFactory(context, Util.getUserAgent(context.getApplicationContext(), TAG_NAME), (TransferListener<? super DataSource>) bandwidthMeter);
    this.trackSelector = new DefaultTrackSelector(trackSelectionFactory);
    this.player = ExoPlayerFactory.newSimpleInstance(context, this.trackSelector, this.loadControl);
    this.playerView = new PlayerView(context,this.player);
}
项目:Cable-Android    文件:PartDataSource.java   
public PartDataSource(@NonNull Context context,
                      @NonNull MasterSecret masterSecret,
                      @Nullable TransferListener<? super PartDataSource> listener)
{
  this.context      = context.getApplicationContext();
  this.masterSecret = masterSecret;
  this.listener     = listener;
}
项目:Cable-Android    文件:AttachmentDataSourceFactory.java   
public AttachmentDataSourceFactory(@NonNull Context context, @NonNull MasterSecret masterSecret,
                                   @NonNull DefaultDataSourceFactory defaultDataSourceFactory,
                                   @Nullable TransferListener<? super DataSource> listener)
{
  this.context                  = context;
  this.masterSecret             = masterSecret;
  this.defaultDataSourceFactory = defaultDataSourceFactory;
  this.listener                 = listener;
}
项目:Exoplayer2Radio    文件:CustomDefaultHttpDataSourceFactory.java   
public CustomDefaultHttpDataSourceFactory(String userAgent,
                                          TransferListener<? super DataSource> listener,
                                          boolean enableShoutcast,
                                          PlayerCallback playerCallback) {
    this(userAgent,
         listener,
         DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
         DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
         false,
         enableShoutcast,
         playerCallback);
}
项目:Exoplayer2Radio    文件:CustomDefaultHttpDataSourceFactory.java   
public CustomDefaultHttpDataSourceFactory(String userAgent,
                                          TransferListener<? super DataSource> listener,
                                          int connectTimeoutMillis,
                                          int readTimeoutMillis,
                                          boolean allowCrossProtocolRedirects,
                                          boolean enableShoutcast,
                                          PlayerCallback playerCallback) {
    this.userAgent = userAgent;
    this.listener = listener;
    this.connectTimeoutMillis = connectTimeoutMillis;
    this.readTimeoutMillis = readTimeoutMillis;
    this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
    this.enableShoutcast = enableShoutcast;
    this.playerCallback = playerCallback;
}
项目:Radio2    文件:CustomHttpDataSource.java   
@SuppressWarnings("SameParameterValue")
public CustomHttpDataSource(String userAgent, TransferListener<? super DataSource> listener) {

    setUserAgent(userAgent);
    setListener(listener);
    setConnectTimeoutMillis();
    setReadTimeoutMillis();
    setAllowCrossProtocolRedirects();
}
项目:ExoPlayerSample    文件:VideoPlayerActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video_player);

    shouldAutoPlay = true;
    bandwidthMeter = new DefaultBandwidthMeter();
    mediaDataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "mediaPlayerSample"), (TransferListener<? super DataSource>) bandwidthMeter);
    window = new Timeline.Window();
    ivHideControllerButton = (ImageView) findViewById(R.id.exo_controller);

}
项目:ExoMedia    文件:MediaSourceProvider.java   
@NonNull
public MediaSource generate(@NonNull Context context, @NonNull Handler handler, @NonNull Uri uri, @Nullable TransferListener<? super DataSource> transferListener ) {
    String extension = MediaSourceUtil.getExtension(uri);

    // Searches for a registered builder
    SourceTypeBuilder sourceTypeBuilder = findByExtension(extension);
    if (sourceTypeBuilder == null) {
        sourceTypeBuilder = findByLooseComparison(uri);
    }

    // If a registered builder wasn't found then use the default
    MediaSourceBuilder builder = sourceTypeBuilder != null ? sourceTypeBuilder.builder : new DefaultMediaSourceBuilder();
    return builder.build(context, uri, userAgent, handler, transferListener);
}
项目:ExoMedia    文件:SsMediaSourceBuilder.java   
@NonNull
@Override
public MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener<? super DataSource> transferListener) {
    DataSource.Factory dataSourceFactory = buildDataSourceFactory(context, userAgent, null);
    DataSource.Factory meteredDataSourceFactory = buildDataSourceFactory(context, userAgent, transferListener);

    return new SsMediaSource(uri, dataSourceFactory, new DefaultSsChunkSource.Factory(meteredDataSourceFactory), handler, null);
}
项目:ExoMedia    文件:DefaultMediaSourceBuilder.java   
@NonNull
@Override
public MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener<? super DataSource> transferListener) {
    DataSource.Factory dataSourceFactory = buildDataSourceFactory(context, userAgent, transferListener);

    return new ExtractorMediaSource(uri, dataSourceFactory, new DefaultExtractorsFactory(), handler, null);
}
项目:ExoMedia    文件:HlsMediaSourceBuilder.java   
@NonNull
@Override
public MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener<? super DataSource> transferListener) {
    DataSource.Factory dataSourceFactory = buildDataSourceFactory(context, userAgent, transferListener);

    return new HlsMediaSource(uri, dataSourceFactory, handler, null);
}
项目:ExoMedia    文件:DashMediaSourceBuilder.java   
@NonNull
@Override
public MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener<? super DataSource> transferListener) {
    DataSource.Factory dataSourceFactory = buildDataSourceFactory(context, userAgent, null);
    DataSource.Factory meteredDataSourceFactory = buildDataSourceFactory(context, userAgent, transferListener);

    return new DashMediaSource(uri, dataSourceFactory, new DefaultDashChunkSource.Factory(meteredDataSourceFactory), handler, null);
}
项目:transistor    文件:OkHttpDataSource.java   
/**
 * @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
 *     by the source.
 * @param userAgent An optional User-Agent string.
 * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
 *     predicate then a {@link InvalidContentTypeException} is thrown from
 *     {@link #open(DataSpec)}.
 * @param listener An optional listener.
 * @param cacheControl An optional {@link CacheControl} for setting the Cache-Control header.
 * @param defaultRequestProperties The optional default {@link RequestProperties} to be sent to
 *    the server as HTTP headers on every request.
 */
public OkHttpDataSource(@NonNull Call.Factory callFactory, @Nullable String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener<? super OkHttpDataSource> listener,
    @Nullable CacheControl cacheControl, @Nullable RequestProperties defaultRequestProperties) {
  this.callFactory = Assertions.checkNotNull(callFactory);
  this.userAgent = userAgent;
  this.contentTypePredicate = contentTypePredicate;
  this.listener = listener;
  this.cacheControl = cacheControl;
  this.defaultRequestProperties = defaultRequestProperties;
  this.requestProperties = new RequestProperties();
}
项目:transistor    文件:OkHttpDataSourceFactory.java   
/**
 * @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
 *     by the sources created by the factory.
 * @param userAgent An optional User-Agent string.
 * @param listener An optional listener.
 * @param cacheControl An optional {@link CacheControl} for setting the Cache-Control header.
 */
public OkHttpDataSourceFactory(@NonNull Call.Factory callFactory, @Nullable String userAgent,
    @Nullable TransferListener<? super DataSource> listener,
    @Nullable CacheControl cacheControl) {
  this.callFactory = callFactory;
  this.userAgent = userAgent;
  this.listener = listener;
  this.cacheControl = cacheControl;
}
项目:transistor    文件:FakeDataSource.java   
public FakeDataSource(FakeDataSet fakeDataSet,
    @Nullable TransferListener<? super FakeDataSource> transferListener) {
  Assertions.checkNotNull(fakeDataSet);
  this.fakeDataSet = fakeDataSet;
  this.transferListener = transferListener;
  this.openedDataSpecs = new ArrayList<>();
}
项目:transistor    文件:CustomDefaultHttpDataSourceFactory.java   
public CustomDefaultHttpDataSourceFactory(String userAgent,
                                          TransferListener<? super DataSource> listener,
                                          boolean enableShoutcast,
                                          PlayerCallback playerCallback) {
    this(userAgent,
         listener,
         DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
         DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
         false,
         enableShoutcast,
         playerCallback);
}
项目:transistor    文件:CustomDefaultHttpDataSourceFactory.java   
public CustomDefaultHttpDataSourceFactory(String userAgent,
                                          TransferListener<? super DataSource> listener,
                                          int connectTimeoutMillis,
                                          int readTimeoutMillis,
                                          boolean allowCrossProtocolRedirects,
                                          boolean enableShoutcast,
                                          PlayerCallback playerCallback) {
    this.userAgent = userAgent;
    this.listener = listener;
    this.connectTimeoutMillis = connectTimeoutMillis;
    this.readTimeoutMillis = readTimeoutMillis;
    this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
    this.enableShoutcast = enableShoutcast;
    this.playerCallback = playerCallback;
}
项目:RadioDroid    文件:RadioDataSourceFactory.java   
public RadioDataSourceFactory(@NonNull OkHttpClient httpClient,
                              @NonNull TransferListener<? super HttpDataSource> transferListener,
                              @NonNull IcyDataSource.IcyDataSourceListener dataSourceListener,
                              long retryTimeout,
                              long retryDelay) {
    this.httpClient = httpClient;
    this.transferListener = transferListener;
    this.dataSourceListener = dataSourceListener;
    this.retryTimeout = retryTimeout;
    this.retryDelay = retryDelay;
}
项目:RadioDroid    文件:IcyDataSource.java   
public IcyDataSource(@NonNull OkHttpClient httpClient,
                     @NonNull TransferListener<? super HttpDataSource> listener,
                     @NonNull IcyDataSourceListener dataSourceListener,
                     long timeUntilStopReconnecting,
                     long delayBetweenReconnections) {
    this.httpClient = httpClient;
    this.transferListener = listener;
    this.dataSourceListener = dataSourceListener;
    this.timeUntilStopReconnecting = timeUntilStopReconnecting;
    this.delayBetweenReconnections = delayBetweenReconnections;
}
项目:ExoPlayer-Offline    文件:ExoHostedTest.java   
@SuppressWarnings("unused")
protected abstract MediaSource buildSource(HostActivity host, String userAgent,
    TransferListener<? super DataSource> mediaTransferListener);
项目:Radio2    文件:CustomHttpDataSource.java   
private void setListener(TransferListener<? super DataSource> value) {
    listener = value;
}
项目:ExoMedia    文件:ExoMedia.java   
@NonNull
HttpDataSource.BaseFactory provide(@NonNull String userAgent, @Nullable TransferListener<? super DataSource> listener);
项目:ExoMedia    文件:ExoMedia.java   
@NonNull
DataSource.Factory provide(@NonNull String userAgent, @Nullable TransferListener<? super DataSource> listener);
项目:ExoMedia    文件:MediaSourceBuilder.java   
@NonNull
public abstract MediaSource build(@NonNull Context context, @NonNull Uri uri, @NonNull String userAgent, @NonNull Handler handler, @Nullable TransferListener<? super DataSource> transferListener);
项目:transistor    文件:RtmpDataSourceFactory.java   
/**
 * @param listener An optional listener.
 */
public RtmpDataSourceFactory(@Nullable TransferListener<? super RtmpDataSource> listener) {
  this.listener = listener;
}
项目:transistor    文件:RtmpDataSource.java   
/**
 * @param listener An optional listener.
 */
public RtmpDataSource(@Nullable TransferListener<? super RtmpDataSource> listener) {
  this.listener = listener;
}
项目:transistor    文件:FakeDataSource.java   
public Factory(@Nullable TransferListener<? super FakeDataSource> transferListener) {
  this.transferListener = transferListener;
}
项目:transistor    文件:ExoHostedTest.java   
@SuppressWarnings("unused")
protected abstract MediaSource buildSource(HostActivity host, String userAgent,
    TransferListener<? super DataSource> mediaTransferListener);
项目:yjPlay    文件:EncryptedFileDataSource.java   
/**
 * Instantiates a new Encrypted file data source.
 *
 * @param cipher          the cipher
 * @param secretKeySpec   the secret key spec
 * @param ivParameterSpec the iv parameter spec
 * @param listener        the listener
 */
public EncryptedFileDataSource(Cipher cipher, SecretKeySpec secretKeySpec, IvParameterSpec ivParameterSpec, TransferListener<? super EncryptedFileDataSource> listener) {
    mCipher = cipher;
    mSecretKeySpec = secretKeySpec;
    mIvParameterSpec = ivParameterSpec;
    mTransferListener = listener;
}
项目:yjPlay    文件:MyDefaultDataSource.java   
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context                     A context.
 * @param listener                    An optional listener.
 * @param userAgent                   The User-Agent string that should be used when requesting remote data.
 * @param connectTimeoutMillis        The connection timeout that should be used when requesting remote                                    data, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
 * @param readTimeoutMillis           The read timeout that should be used when requesting remote data,                                    in milliseconds. A timeout of zero is interpreted as an infinite timeout.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP                                    to HTTPS and vice versa) are enabled when fetching remote data.
 */
public MyDefaultDataSource(Context context, TransferListener<? super DataSource> listener,
                           String userAgent, int connectTimeoutMillis, int readTimeoutMillis,
                           boolean allowCrossProtocolRedirects) {
    this(context, listener,
            new DefaultHttpDataSource(userAgent, null, listener, connectTimeoutMillis,
                    readTimeoutMillis, allowCrossProtocolRedirects, null));
}
项目:yjPlay    文件:MyDefaultDataSource.java   
/**
 * Constructs a new instance that delegates to a provided {@link DataSource} for URI schemes other
 * than file, asset and content.
 *
 * @param context        A context.                       constants in {@link Base64}
 * @param listener       An optional listener.
 * @param baseDataSource A {@link DataSource} to use for URI schemes other than file, asset and                       content. This {@link DataSource} should normally support at least http(s).
 */
public MyDefaultDataSource(Context context, TransferListener<? super DataSource> listener,
                           DataSource baseDataSource) {
    this.context = context.getApplicationContext();
    this.listener = listener;
    this.baseDataSource = Assertions.checkNotNull(baseDataSource);
}
项目:yjPlay    文件:MyDefaultDataSource.java   
/**
 * Instantiates a new My default data source.
 *
 * @param context         the context
 * @param cipher          the cipher
 * @param secretKeySpec   the secret key spec
 * @param ivParameterSpec the iv parameter spec
 * @param listener        the listener
 * @param baseDataSource  the base data source
 */
public MyDefaultDataSource(@NonNull Context context, @NonNull Cipher cipher, @NonNull SecretKeySpec secretKeySpec, @NonNull IvParameterSpec ivParameterSpec, @NonNull TransferListener<? super DataSource> listener, @NonNull DataSource baseDataSource) {
    this.context = context.getApplicationContext();
    mCipher = cipher;
    mSecretKeySpec = secretKeySpec;
    mIvParameterSpec = ivParameterSpec;
    this.listener = listener;
    this.baseDataSource = Assertions.checkNotNull(baseDataSource);
}
项目:AesExoPlayer    文件:AitripDataSource.java   
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context                     A context.
 * @param listener                    An optional listener.
 * @param userAgent                   The User-Agent string that should be used when requesting remote data.
 * @param connectTimeoutMillis        The connection timeout that should be used when requesting remote
 *                                    data, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
 * @param readTimeoutMillis           The read timeout that should be used when requesting remote data,
 *                                    in milliseconds. A timeout of zero is interpreted as an infinite timeout.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *                                    to HTTPS and vice versa) are enabled when fetching remote data.
 */
public AitripDataSource(Context context, TransferListener<? super DataSource> listener,
                        String userAgent, int connectTimeoutMillis, int readTimeoutMillis,
                        boolean allowCrossProtocolRedirects) {
    this(context, listener,
            new DefaultHttpDataSource(userAgent, null, listener, connectTimeoutMillis,
                    readTimeoutMillis, allowCrossProtocolRedirects, null));
}
项目:AesExoPlayer    文件:AitripDataSource.java   
/**
 * Constructs a new instance that delegates to a provided {@link DataSource} for URI schemes other
 * than file, asset and content.
 *
 * @param context        A context.
 * @param listener       An optional listener.
 * @param baseDataSource A {@link DataSource} to use for URI schemes other than file, asset and
 *                       content. This {@link DataSource} should normally support at least http(s).
 */
public AitripDataSource(Context context, TransferListener<? super DataSource> listener,
                        DataSource baseDataSource) {
    this.context = context.getApplicationContext();
    this.listener = listener;
    this.baseDataSource = Assertions.checkNotNull(baseDataSource);
}
项目:AesExoPlayer    文件:AitripDataSourceFactory.java   
/**
 * @param context A context.
 * @param listener An optional listener.
 * @param baseDataSourceFactory A {@link DataSource.Factory} to be used to create a base {@link DataSource}
 *     for {@link DefaultDataSource}.
 * @see DefaultDataSource#DefaultDataSource(Context, TransferListener, DataSource)
 */
public AitripDataSourceFactory(Context context, TransferListener<? super DataSource> listener,
                                DataSource.Factory baseDataSourceFactory) {
    this.context = context.getApplicationContext();
    this.listener = listener;
    this.baseDataSourceFactory = baseDataSourceFactory;
}