本文整理汇总了Java中com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultHttpDataSourceFactory类的具体用法?Java DefaultHttpDataSourceFactory怎么用?Java DefaultHttpDataSourceFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultHttpDataSourceFactory类属于com.google.android.exoplayer2.upstream包,在下文中一共展示了DefaultHttpDataSourceFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildDrmSessionManager
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
@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;
}
示例2: buildMediaSource
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
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);
}
}
}
示例3: buildDrmSessionManager
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
@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);
}
}
示例4: setUp
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
@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);
}
}
示例5: TestOfflineLicenseHelper
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
public TestOfflineLicenseHelper(DashHostedTestEncParameters parameters)
throws UnsupportedDrmException {
this.parameters = parameters;
httpDataSourceFactory = new DefaultHttpDataSourceFactory("ExoPlayerPlaybackTests");
offlineLicenseHelper = OfflineLicenseHelper.newWidevineInstance(
parameters.widevineLicenseUrl, httpDataSourceFactory);
}
示例6: buildMediaSource
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
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);
}
示例7: buildMediaSource
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
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);
}
示例8: getHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
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;
}
示例9: CacheDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
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));
}
示例10: buildHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
}
示例11: buildHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
public static
@NonNull
HttpDataSource.Factory buildHttpDataSourceFactory(@NonNull Context context, @NonNull DefaultBandwidthMeter bandwidthMeter) {
return new DefaultHttpDataSourceFactory(Util.getUserAgent(context, "TubiExoPlayer"), bandwidthMeter);
}
示例12: buildHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
return new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "TubiPlayerActivity"), bandwidthMeter);
}
示例13: buildHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
public HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
return new DefaultHttpDataSourceFactory(deviceIdentifier, bandwidthMeter);
}
示例14: buildHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
return new DefaultHttpDataSourceFactory(mUserAgent, bandwidthMeter,
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
true /* allowCrossProtocolRedirects */);
}
示例15: buildMediaSource
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; //导入依赖的package包/类
private MediaSource buildMediaSource(Uri uri) {
return new ExtractorMediaSource.Factory(new DefaultHttpDataSourceFactory("exoplayer-codelab"))
.createMediaSource(uri);
}