Java Code Examples for com.google.android.exoplayer2.upstream.DefaultHttpDataSource#DEFAULT_CONNECT_TIMEOUT_MILLIS

The following examples show how to use com.google.android.exoplayer2.upstream.DefaultHttpDataSource#DEFAULT_CONNECT_TIMEOUT_MILLIS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoDialogFragment.java    From TDTChannels-APP with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_video_dialog, container, false);

    channelVideoView = rootView.findViewById(R.id.channel_video_detail_exoplayer);

    if (getArguments() != null) {
        String channelUrl = getArguments().getString(CHANNEL_KEY);
        if (getActivity() != null && getContext() != null && channelUrl != null) {
            player = new SimpleExoPlayer.Builder(getContext()).build();

            DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(
                    Util.getUserAgent(getContext(), "laquay.com.open.canalestdt"),
                    DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
                    DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
                    true
            );

            dataSourceFactory = new DefaultDataSourceFactory(getContext(), httpDataSourceFactory);

            getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            loadVideo(channelUrl);
        }
    }
    return rootView;
}
 
Example 2
Source File: ArviHttpDataSourceFactory.java    From ARVI with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an ArviHttpDataSourceFactory. Sets {@link DefaultHttpDataSource#DEFAULT_CONNECT_TIMEOUT_MILLIS} as the connection timeout,
 * {@link DefaultHttpDataSource#DEFAULT_READ_TIMEOUT_MILLIS} as the read timeout and disables cross-protocol redirects.
 *
 * @param userAgent The User-Agent string that should be used.
 * @param listener An optional listener.
 * @see #DefaultHttpDataSourceFactory(String, TransferListener, int, int, boolean)
 */
public ArviHttpDataSourceFactory(String userAgent, TransferListener listener) {
    this(
        userAgent,
        listener,
        null,
        DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
        DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
        false
    );
}
 
Example 3
Source File: MediaSourceFactory.java    From no-player with Apache License 2.0 5 votes vote down vote up
private DefaultDataSourceFactory createDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
    if (dataSourceFactory.isPresent()) {
        return new DefaultDataSourceFactory(context, bandwidthMeter, dataSourceFactory.get());
    } else {
        DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(
                userAgent,
                bandwidthMeter,
                DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
                DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
                allowCrossProtocolRedirects
        );

        return new DefaultDataSourceFactory(context, bandwidthMeter, httpDataSourceFactory);
    }
}
 
Example 4
Source File: ExtendedDefaultDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context A context.
 * @param userAgent The User-Agent to use when requesting remote data.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled when fetching remote data.
 */
public ExtendedDefaultDataSource(Context context, String userAgent, boolean allowCrossProtocolRedirects) {
    this(
            context,
            userAgent,
            DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
            allowCrossProtocolRedirects);
}
 
Example 5
Source File: ExtendedDefaultDataSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context A context.
 * @param userAgent The User-Agent to use when requesting remote data.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled when fetching remote data.
 */
public ExtendedDefaultDataSource(Context context, String userAgent, boolean allowCrossProtocolRedirects) {
    this(
            context,
            userAgent,
            DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
            allowCrossProtocolRedirects);
}
 
Example 6
Source File: VideoExoPlayer.java    From TigerVideo with Apache License 2.0 4 votes vote down vote up
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);
    }
 
Example 7
Source File: ExtendedDefaultDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context A context.
 * @param listener An optional listener.
 * @param userAgent The User-Agent to use when requesting remote data.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled when fetching remote data.
 * @deprecated Use {@link #DefaultDataSource(Context, String, boolean)} and {@link
 *     #addTransferListener(TransferListener)}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public ExtendedDefaultDataSource(
        Context context,
        @Nullable TransferListener listener,
        String userAgent,
        boolean allowCrossProtocolRedirects) {
    this(context, listener, userAgent, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects);
}
 
Example 8
Source File: ExtendedDefaultDataSource.java    From Telegram with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context A context.
 * @param listener An optional listener.
 * @param userAgent The User-Agent to use when requesting remote data.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled when fetching remote data.
 * @deprecated Use {@link #DefaultDataSource(Context, String, boolean)} and {@link
 *     #addTransferListener(TransferListener)}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public ExtendedDefaultDataSource(
        Context context,
        @Nullable TransferListener listener,
        String userAgent,
        boolean allowCrossProtocolRedirects) {
    this(context, listener, userAgent, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects);
}
 
Example 9
Source File: ExtendedDefaultDataSource.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context                     A context.
 * @param listener                    An optional listener.
 * @param userAgent                   The User-Agent string that should be used when requesting remote data.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *                                    to HTTPS and vice versa) are enabled when fetching remote data.
 */
public ExtendedDefaultDataSource(Context context, TransferListener listener,
                                 String userAgent, boolean allowCrossProtocolRedirects) {
    this(context, listener, userAgent, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects);
}
 
Example 10
Source File: ExtendedDefaultDataSource.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new instance, optionally configured to follow cross-protocol redirects.
 *
 * @param context                     A context.
 * @param listener                    An optional listener.
 * @param userAgent                   The User-Agent string that should be used when requesting remote data.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *                                    to HTTPS and vice versa) are enabled when fetching remote data.
 */
public ExtendedDefaultDataSource(Context context, TransferListener listener,
                                 String userAgent, boolean allowCrossProtocolRedirects) {
    this(context, listener, userAgent, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, allowCrossProtocolRedirects);
}