use of androidx.media3.extractor.DefaultExtractorsFactory in project jellyfin-androidtv by jellyfin.
the class VideoManager method configureExoplayerBuilder.
/**
* Configures Exoplayer for video playback. Initially we try with core decoders, but allow
* ExoPlayer to silently fallback to software renderers.
*
* @param context The associated context
* @return A configured builder for Exoplayer
*/
private ExoPlayer.Builder configureExoplayerBuilder(Context context) {
ExoPlayer.Builder exoPlayerBuilder = new ExoPlayer.Builder(context);
DefaultRenderersFactory defaultRendererFactory = new DefaultRenderersFactory(context);
defaultRendererFactory.setEnableDecoderFallback(true);
defaultRendererFactory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON);
exoPlayerBuilder.setRenderersFactory(defaultRendererFactory);
DefaultExtractorsFactory defaultExtractorsFactory = new DefaultExtractorsFactory().setTsExtractorTimestampSearchBytes(TsExtractor.DEFAULT_TIMESTAMP_SEARCH_BYTES * 3);
exoPlayerBuilder.setMediaSourceFactory(new DefaultMediaSourceFactory(context, defaultExtractorsFactory));
return exoPlayerBuilder;
}
use of androidx.media3.extractor.DefaultExtractorsFactory in project deltachat-android by deltachat.
the class AudioSlidePlayer method createMediaSource.
private MediaSource createMediaSource(@NonNull Uri uri) {
DefaultDataSourceFactory defaultDataSourceFactory = new DefaultDataSourceFactory(context, "GenericUserAgent", null);
AttachmentDataSourceFactory attachmentDataSourceFactory = new AttachmentDataSourceFactory(defaultDataSourceFactory);
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory().setConstantBitrateSeekingEnabled(true);
return new ExtractorMediaSource.Factory(attachmentDataSourceFactory).setExtractorsFactory(extractorsFactory).createMediaSource(uri);
}
use of androidx.media3.extractor.DefaultExtractorsFactory in project deltachat-android by deltachat.
the class VideoPlayer method setExoViewSource.
private void setExoViewSource(@NonNull VideoSlide videoSource, boolean autoplay) throws IOException {
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
LoadControl loadControl = new DefaultLoadControl();
exoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(), trackSelector, loadControl);
exoPlayer.addListener(new ExoPlayerListener(window));
// noinspection ConstantConditions
exoView.setPlayer(exoPlayer);
DefaultDataSourceFactory defaultDataSourceFactory = new DefaultDataSourceFactory(getContext(), "GenericUserAgent", null);
AttachmentDataSourceFactory attachmentDataSourceFactory = new AttachmentDataSourceFactory(defaultDataSourceFactory);
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
MediaSource mediaSource = new ExtractorMediaSource(videoSource.getUri(), attachmentDataSourceFactory, extractorsFactory, null, null);
exoPlayer.prepare(mediaSource);
exoPlayer.setPlayWhenReady(autoplay);
}
use of androidx.media3.extractor.DefaultExtractorsFactory in project TV-youtube by chiou711.
the class PlaybackFragment method prepareMediaForPlaying.
private void prepareMediaForPlaying(Uri mediaSourceUri) {
String userAgent = Util.getUserAgent(getActivity(), "VideoPlayerGlue");
MediaSource mediaSource = new ExtractorMediaSource(mediaSourceUri, new DefaultDataSourceFactory(getActivity(), userAgent), new DefaultExtractorsFactory(), null, null);
mPlayer.prepare(mediaSource);
}
use of androidx.media3.extractor.DefaultExtractorsFactory in project AntennaPod by AntennaPod.
the class ExoPlayerWrapper method setDataSource.
public void setDataSource(String s, String user, String password) throws IllegalArgumentException, IllegalStateException {
Log.d(TAG, "setDataSource: " + s);
final OkHttpDataSource.Factory httpDataSourceFactory = new OkHttpDataSource.Factory(AntennapodHttpClient.getHttpClient()).setUserAgent(ClientConfig.USER_AGENT);
if (!TextUtils.isEmpty(user) && !TextUtils.isEmpty(password)) {
final HashMap<String, String> requestProperties = new HashMap<>();
requestProperties.put("Authorization", HttpDownloader.encodeCredentials(user, password, "ISO-8859-1"));
httpDataSourceFactory.setDefaultRequestProperties(requestProperties);
}
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, null, httpDataSourceFactory);
DefaultExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
extractorsFactory.setConstantBitrateSeekingEnabled(true);
extractorsFactory.setMp3ExtractorFlags(Mp3Extractor.FLAG_DISABLE_ID3_METADATA);
ProgressiveMediaSource.Factory f = new ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory);
final MediaItem mediaItem = MediaItem.fromUri(Uri.parse(s));
mediaSource = f.createMediaSource(mediaItem);
}
Aggregations