@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; }
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); } } }
@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); } }
@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); } }
public TestOfflineLicenseHelper(DashHostedTestEncParameters parameters) throws UnsupportedDrmException { this.parameters = parameters; httpDataSourceFactory = new DefaultHttpDataSourceFactory("ExoPlayerPlaybackTests"); offlineLicenseHelper = OfflineLicenseHelper.newWidevineInstance( parameters.widevineLicenseUrl, httpDataSourceFactory); }
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); }
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); }
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; }
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)); }
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter); }
public static @NonNull HttpDataSource.Factory buildHttpDataSourceFactory(@NonNull Context context, @NonNull DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(Util.getUserAgent(context, "TubiExoPlayer"), bandwidthMeter); }
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "TubiPlayerActivity"), bandwidthMeter); }
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(deviceIdentifier, bandwidthMeter); }
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(mUserAgent, bandwidthMeter, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, true /* allowCrossProtocolRedirects */); }
private MediaSource buildMediaSource(Uri uri) { return new ExtractorMediaSource.Factory(new DefaultHttpDataSourceFactory("exoplayer-codelab")) .createMediaSource(uri); }
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(mUserAgent, bandwidthMeter); }
private DataSource.Factory getHttpDataSourceFactory(boolean preview) { return new DefaultHttpDataSourceFactory(Util.getUserAgent(context, "ExoPlayerDemo"), preview ? null : bandwidthMeter); }
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); }
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); }
HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(Util.getUserAgent(getContext().getApplicationContext(), "ExoVideoView"), bandwidthMeter); }
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); }
private HttpDataSource.Factory buildHttpDataSourceFactory(boolean useBandwidthMeter) { String userAgent = Util.getUserAgent(getActivity(), "NextGenExoPlayer"); DefaultBandwidthMeter bandwidthMeter = useBandwidthMeter ? BANDWIDTH_METER : null; return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter); }
private HttpDataSource.Factory buildHttpDataSourceFactory(boolean useBandwidthMeter) { String userAgent = Util.getUserAgent(this, "NextGenExoPlayer"); DefaultBandwidthMeter bandwidthMeter = useBandwidthMeter ? BANDWIDTH_METER : null; return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter); }
HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "MDVideo"), bandwidthMeter); }
HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) { return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter); }
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); }
public static HttpDataSource.Factory buildHttpDataSourceFactory(Context context, DefaultBandwidthMeter bandwidthMeter) { String userAgent = Util.getUserAgent(context, "ExoPlayerDemo"); return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter); }
/** * 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)); }
/** * 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)); }
/** * @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)); }
/** * 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); }