本文整理汇总了Java中com.google.android.exoplayer2.upstream.TransferListener类的典型用法代码示例。如果您正苦于以下问题:Java TransferListener类的具体用法?Java TransferListener怎么用?Java TransferListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransferListener类属于com.google.android.exoplayer2.upstream包,在下文中一共展示了TransferListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EncryptedFileDataSourceFactory
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
/**
* 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);
}
示例2: configureExoMedia
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
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);
}
});
}
示例3: buildSource
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}
示例4: CronetDataSource
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
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();
}
示例5: buildSource
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}
示例6: PlayerController
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
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);
}
示例7: PartDataSource
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
public PartDataSource(@NonNull Context context,
@NonNull MasterSecret masterSecret,
@Nullable TransferListener<? super PartDataSource> listener)
{
this.context = context.getApplicationContext();
this.masterSecret = masterSecret;
this.listener = listener;
}
示例8: AttachmentDataSourceFactory
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
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;
}
示例9: CustomDefaultHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
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);
}
示例10: CustomHttpDataSource
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@SuppressWarnings("SameParameterValue")
public CustomHttpDataSource(String userAgent, TransferListener<? super DataSource> listener) {
setUserAgent(userAgent);
setListener(listener);
setConnectTimeoutMillis();
setReadTimeoutMillis();
setAllowCrossProtocolRedirects();
}
示例11: onCreate
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}
示例12: generate
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}
示例13: build
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}
示例14: build
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}
示例15: build
import com.google.android.exoplayer2.upstream.TransferListener; //导入依赖的package包/类
@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);
}