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

项目:ExoPlayer-Offline    文件:DashTest.java   
@Override
protected final DefaultDrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
    final String userAgent) {
  DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = null;
  if (parameters.isWidevineEncrypted) {
    try {
      MediaDrmCallback drmCallback = new HttpMediaDrmCallback(parameters.widevineLicenseUrl,
          new DefaultHttpDataSourceFactory(userAgent));
      drmSessionManager = DefaultDrmSessionManager.newWidevineInstance(drmCallback, null,
          null, null);
      if (!parameters.useL1Widevine) {
        drmSessionManager.setPropertyString(SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3);
      }
      if (offlineLicenseKeySetId != null) {
        drmSessionManager.setMode(DefaultDrmSessionManager.MODE_PLAYBACK,
            offlineLicenseKeySetId);
      }
    } catch (UnsupportedDrmException e) {
      throw new IllegalStateException(e);
    }
  }
  return drmSessionManager;
}
项目:QSVideoPlayer    文件:ExoMedia.java   
private MediaSource buildMediaSource(Context context, Uri uri) {
    int type = getUrlType(uri.toString());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri, new DefaultDataSourceFactory(context, null,
                    new DefaultHttpDataSourceFactory(USER_AGENT, null)),
                    new DefaultSsChunkSource.Factory(new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                            new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER))), mainThreadHandler, null);
        case C.TYPE_DASH:
            return new DashMediaSource(uri, new DefaultDataSourceFactory(context, null,
                    new DefaultHttpDataSourceFactory(USER_AGENT, null)),
                    new DefaultDashChunkSource.Factory(new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                            new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER))), mainThreadHandler, null);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri, new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                    new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER)), mainThreadHandler, null);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri, new DefaultDataSourceFactory(context, BANDWIDTH_METER,
                    new DefaultHttpDataSourceFactory(USER_AGENT, BANDWIDTH_METER)), new DefaultExtractorsFactory(),
                    mainThreadHandler, null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:transistor    文件:DashTestRunner.java   
@Override
protected DefaultDrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
    final String userAgent) {
  if (widevineLicenseUrl == null) {
    return null;
  }
  try {
    MediaDrmCallback drmCallback = new HttpMediaDrmCallback(widevineLicenseUrl,
        new DefaultHttpDataSourceFactory(userAgent));
    DefaultDrmSessionManager<FrameworkMediaCrypto> drmSessionManager =
        DefaultDrmSessionManager.newWidevineInstance(drmCallback, null, null, null);
    if (!useL1Widevine) {
      drmSessionManager.setPropertyString(
          SECURITY_LEVEL_PROPERTY, WIDEVINE_SECURITY_LEVEL_3);
    }
    if (offlineLicenseKeySetId != null) {
      drmSessionManager.setMode(DefaultDrmSessionManager.MODE_PLAYBACK,
          offlineLicenseKeySetId);
    }
    return drmSessionManager;
  } catch (UnsupportedDrmException e) {
    throw new IllegalStateException(e);
  }
}
项目:transistor    文件:DashWidevineOfflineTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  testRunner = new DashTestRunner(TAG, getActivity(), getInstrumentation())
      .setStreamName("test_widevine_h264_fixed_offline")
      .setManifestUrl(DashTestData.WIDEVINE_H264_MANIFEST)
      .setWidevineInfo(MimeTypes.VIDEO_H264, true)
      .setFullPlaybackNoSeeking(true)
      .setCanIncludeAdditionalVideoFormats(false)
      .setAudioVideoFormats(DashTestData.WIDEVINE_AAC_AUDIO_REPRESENTATION_ID,
          DashTestData.WIDEVINE_H264_CDD_FIXED);

  boolean useL1Widevine = DashTestRunner.isL1WidevineAvailable(MimeTypes.VIDEO_H264);
  String widevineLicenseUrl = DashTestData.getWidevineLicenseUrl(true, useL1Widevine);
  httpDataSourceFactory = new DefaultHttpDataSourceFactory(USER_AGENT);
  if (Util.SDK_INT >= 18) {
    offlineLicenseHelper = OfflineLicenseHelper.newWidevineInstance(widevineLicenseUrl,
        httpDataSourceFactory);
  }
}
项目:ExoPlayer-Offline    文件:DashTest.java   
public TestOfflineLicenseHelper(DashHostedTestEncParameters parameters)
    throws UnsupportedDrmException {
  this.parameters = parameters;
  httpDataSourceFactory = new DefaultHttpDataSourceFactory("ExoPlayerPlaybackTests");
  offlineLicenseHelper = OfflineLicenseHelper.newWidevineInstance(
      parameters.widevineLicenseUrl, httpDataSourceFactory);
}
项目:exoplayer-intro    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri) {
  DataSource.Factory manifestDataSourceFactory = new DefaultHttpDataSourceFactory("ua");
  DashChunkSource.Factory dashChunkSourceFactory = new DefaultDashChunkSource.Factory(
      new DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER));
  return new DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory)
      .createMediaSource(uri);
}
项目:exoplayer-intro    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri) {
  DataSource.Factory manifestDataSourceFactory = new DefaultHttpDataSourceFactory("ua");
  DashChunkSource.Factory dashChunkSourceFactory = new DefaultDashChunkSource.Factory(
      new DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER));
  return new DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory)
      .createMediaSource(uri);
}
项目:exoplayer-intro    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri) {
  DashChunkSource.Factory dashChunkSourceFactory = new DefaultDashChunkSource.Factory(
      new DefaultHttpDataSourceFactory("ua", BANDWIDTH_METER));
  DataSource.Factory manifestDataSourceFactory = new DefaultHttpDataSourceFactory("ua");
  return new DashMediaSource.Factory(dashChunkSourceFactory, manifestDataSourceFactory).
      createMediaSource(uri);
}
项目:GSYVideoPlayer    文件:IjkExo2MediaPlayer.java   
private DataSource.Factory getHttpDataSourceFactory(boolean preview) {
    DefaultHttpDataSourceFactory dataSourceFactory = new DefaultHttpDataSourceFactory(Util.getUserAgent(mAppContext,
            TAG), preview ? null : new DefaultBandwidthMeter());
    if (mHeaders != null && mHeaders.size() > 0) {
        for (Map.Entry<String, String> header : mHeaders.entrySet()) {
            dataSourceFactory.getDefaultRequestProperties().set(header.getKey(), header.getValue());
        }
    }
    return dataSourceFactory;
}
项目:Slide    文件:MediaVideoView.java   
CacheDataSourceFactory(Context context, long maxCacheSize, long maxFileSize) {
    super();
    this.context = context;
    this.maxCacheSize = maxCacheSize;
    this.maxFileSize = maxFileSize;
    String userAgent = Util.getUserAgent(context, context.getString(R.string.app_name));
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    defaultDatasourceFactory = new DefaultDataSourceFactory(this.context, bandwidthMeter,
            new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter));
}
项目:TubiPlayer    文件:DemoApplication.java   
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:TubiPlayer    文件:MediaHelper.java   
public static
@NonNull
HttpDataSource.Factory buildHttpDataSourceFactory(@NonNull Context context, @NonNull DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(Util.getUserAgent(context, "TubiExoPlayer"), bandwidthMeter);
}
项目:TubiPlayer    文件:TubiPlayerActivity.java   
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "TubiPlayerActivity"), bandwidthMeter);
}
项目:Android-app    文件:TgbApp.java   
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(deviceIdentifier, bandwidthMeter);
}
项目:chaosflix-leanback    文件:PlayerActivity.java   
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(mUserAgent, bandwidthMeter,
            DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
            true /* allowCrossProtocolRedirects */);
}
项目:exoplayer-intro    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri) {
  return new ExtractorMediaSource.Factory(new DefaultHttpDataSourceFactory("exoplayer-codelab"))
      .createMediaSource(uri);
}
项目:chaosflix    文件:ExoPlayerFragment.java   
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(mUserAgent, bandwidthMeter);
}
项目:chaosflix    文件:PlayerActivity.java   
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(mUserAgent, bandwidthMeter,
            DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
            true /* allowCrossProtocolRedirects */);
}
项目:PreviewSeekBar    文件:ExoPlayerMediaSourceBuilder.java   
private DataSource.Factory getHttpDataSourceFactory(boolean preview) {
    return new DefaultHttpDataSourceFactory(Util.getUserAgent(context,
            "ExoPlayerDemo"), preview ? null : bandwidthMeter);
}
项目:PreviewSeekBar-master    文件:ExoPlayerMediaSourceBuilder.java   
private DataSource.Factory getHttpDataSourceFactory(boolean preview) {
    return new DefaultHttpDataSourceFactory(Util.getUserAgent(context,
            "ExoPlayerDemo"), preview ? null : bandwidthMeter);
}
项目:nuclei-android    文件:ExoPlayerPlayback.java   
protected HttpDataSource.Factory buildHttpDataSourceFactory(Context context, boolean useBandwidthMeter) {
    final String userAgent = Util.getUserAgent(context, "NucleiPlayer");
    return new DefaultHttpDataSourceFactory(userAgent, useBandwidthMeter ? BANDWIDTH_METER : null, 15000, 15000, false);
}
项目:TigerVideo    文件:VideoExoPlayer.java   
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {

        return new DefaultHttpDataSourceFactory(Util.getUserAgent(mContext, TAG), bandwidthMeter, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
                DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, true);
    }
项目:ExoPlayerVideoView    文件:ExoVideoView.java   
HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(Util.getUserAgent(getContext().getApplicationContext(), "ExoVideoView"), bandwidthMeter);
}
项目:ChatMessagesAdapter-android    文件:SimpleExoPlayerInitializer.java   
public static MediaSource buildMediaSource(Uri uri, Context context) {
    String userAgent = Util.getUserAgent(context, context.getResources().getString(R.string.app_name));
    return new ExtractorMediaSource(uri,
            new DefaultHttpDataSourceFactory(userAgent),
            new DefaultExtractorsFactory(), null, null);
}
项目:cpe-manifest-android-experience    文件:ECVideoViewFragment.java   
private HttpDataSource.Factory buildHttpDataSourceFactory(boolean useBandwidthMeter) {
    String userAgent = Util.getUserAgent(getActivity(), "NextGenExoPlayer");
    DefaultBandwidthMeter bandwidthMeter = useBandwidthMeter ? BANDWIDTH_METER : null;
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:cpe-manifest-android-experience    文件:StartupActivity.java   
private HttpDataSource.Factory buildHttpDataSourceFactory(boolean useBandwidthMeter) {
    String userAgent = Util.getUserAgent(this, "NextGenExoPlayer");
    DefaultBandwidthMeter bandwidthMeter = useBandwidthMeter ? BANDWIDTH_METER : null;
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:MDVideo    文件:PlayerActivityV2.java   
HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "MDVideo"), bandwidthMeter);
}
项目:videoPickPlayer    文件:ExoApplication.java   
HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:Komica    文件:KomicaApplication.java   
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:transistor    文件:DemoApplication.java   
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
  return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:transistor    文件:DashDownloadTest.java   
private DashDownloader createDashDownloader(boolean offline) {
  DownloaderConstructorHelper constructorHelper = new DownloaderConstructorHelper(cache,
      offline ? DummyDataSource.FACTORY : new DefaultHttpDataSourceFactory("ExoPlayer", null));
  return new DashDownloader(Uri.parse(DashTestData.H264_MANIFEST), constructorHelper);
}
项目:CumulusTV    文件:MediaSourceFactory.java   
public static HttpDataSource.Factory buildHttpDataSourceFactory(Context context,
         DefaultBandwidthMeter bandwidthMeter) {
    String userAgent = Util.getUserAgent(context, "ExoPlayerDemo");
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:evercam-android    文件:EvercamPlayApplication.java   
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
项目:transistor    文件:CronetDataSourceFactory.java   
/**
 * Constructs a CronetDataSourceFactory.
 * <p>
 * If the {@link CronetEngineWrapper} fails to provide a {@link CronetEngine}, a
 * {@link DefaultHttpDataSourceFactory} will be used instead.
 *
 * Sets {@link CronetDataSource#DEFAULT_CONNECT_TIMEOUT_MILLIS} as the connection timeout, {@link
 * CronetDataSource#DEFAULT_READ_TIMEOUT_MILLIS} as the read timeout and disables
 * cross-protocol redirects.
 *
 * @param cronetEngineWrapper A {@link CronetEngineWrapper}.
 * @param executor The {@link java.util.concurrent.Executor} that will perform the requests.
 * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
 *     predicate then an {@link InvalidContentTypeException} is thrown from
 *     {@link CronetDataSource#open}.
 * @param transferListener An optional listener.
 * @param userAgent A user agent used to create a fallback HttpDataSource if needed.
 */
public CronetDataSourceFactory(CronetEngineWrapper cronetEngineWrapper,
    Executor executor, Predicate<String> contentTypePredicate,
    TransferListener<? super DataSource> transferListener, String userAgent) {
  this(cronetEngineWrapper, executor, contentTypePredicate, transferListener,
      DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS, false,
      new DefaultHttpDataSourceFactory(userAgent, transferListener,
          DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS, false));
}
项目:transistor    文件:CronetDataSourceFactory.java   
/**
 * Constructs a CronetDataSourceFactory.
 * <p>
 * If the {@link CronetEngineWrapper} fails to provide a {@link CronetEngine}, a
 * {@link DefaultHttpDataSourceFactory} will be used instead.
 *
 * @param cronetEngineWrapper A {@link CronetEngineWrapper}.
 * @param executor The {@link java.util.concurrent.Executor} that will perform the requests.
 * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
 *     predicate then an {@link InvalidContentTypeException} is thrown from
 *     {@link CronetDataSource#open}.
 * @param transferListener An optional listener.
 * @param connectTimeoutMs The connection timeout, in milliseconds.
 * @param readTimeoutMs The read timeout, in milliseconds.
 * @param resetTimeoutOnRedirects Whether the connect timeout is reset when a redirect occurs.
 * @param userAgent A user agent used to create a fallback HttpDataSource if needed.
 */
public CronetDataSourceFactory(CronetEngineWrapper cronetEngineWrapper,
    Executor executor, Predicate<String> contentTypePredicate,
    TransferListener<? super DataSource> transferListener, int connectTimeoutMs,
    int readTimeoutMs, boolean resetTimeoutOnRedirects, String userAgent) {
  this(cronetEngineWrapper, executor, contentTypePredicate, transferListener,
      DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS, resetTimeoutOnRedirects,
      new DefaultHttpDataSourceFactory(userAgent, transferListener, connectTimeoutMs,
          readTimeoutMs, resetTimeoutOnRedirects));
}
项目:AesExoPlayer    文件:AitripDataSourceFactory.java   
/**
 * @param context A context.
 * @param userAgent The User-Agent string that should be used.
 * @param listener An optional listener.
 */
public AitripDataSourceFactory(Context context, String userAgent,
                                TransferListener<? super DataSource> listener) {
    this(context, listener, new DefaultHttpDataSourceFactory(userAgent, listener));
}
项目:NSMPlayer-Android    文件:WrapExoPlayer.java   
/**
 * Returns a new HttpDataSource factory.
 *
 * @param useBandwidthMeter Whether to set {@link #BANDWIDTH_METER} as a listener to the new
 *     DataSource factory.
 * @return A new HttpDataSource factory.
 */
private HttpDataSource.Factory buildHttpDataSourceFactory(boolean useBandwidthMeter) {
    return new DefaultHttpDataSourceFactory(userAgent, useBandwidthMeter ? BANDWIDTH_METER : null);
}