Search in sources :

Example 1 with DefaultBandwidthMeter

use of com.google.android.exoplayer2.upstream.DefaultBandwidthMeter in project ExoPlayer by google.

the class ExoHostedTest method onStart.

// HostedTest implementation
@Override
public final void onStart(HostActivity host, Surface surface) {
    // Build the player.
    DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
    trackSelector = buildTrackSelector(host, bandwidthMeter);
    String userAgent = "ExoPlayerPlaybackTests";
    DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = buildDrmSessionManager(userAgent);
    player = buildExoPlayer(host, surface, trackSelector, drmSessionManager);
    player.prepare(buildSource(host, Util.getUserAgent(host, userAgent), bandwidthMeter));
    player.addListener(this);
    player.setAudioDebugListener(this);
    player.setVideoDebugListener(this);
    player.setPlayWhenReady(true);
    actionHandler = new Handler();
    // Schedule any pending actions.
    if (pendingSchedule != null) {
        pendingSchedule.start(player, trackSelector, actionHandler);
        pendingSchedule = null;
    }
}
Also used : DefaultBandwidthMeter(com.google.android.exoplayer2.upstream.DefaultBandwidthMeter) FrameworkMediaCrypto(com.google.android.exoplayer2.drm.FrameworkMediaCrypto) Handler(android.os.Handler)

Example 2 with DefaultBandwidthMeter

use of com.google.android.exoplayer2.upstream.DefaultBandwidthMeter in project PreviewSeekBar by rubensousa.

the class ExoPlayerManager method createFullPlayer.

private SimpleExoPlayer createFullPlayer() {
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveVideoTrackSelection.Factory(new DefaultBandwidthMeter());
    TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
    LoadControl loadControl = new DefaultLoadControl();
    SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(playerView.getContext(), trackSelector, loadControl);
    player.setPlayWhenReady(true);
    player.prepare(mediaSourceBuilder.getMediaSource(false));
    player.addListener(this);
    return player;
}
Also used : SimpleExoPlayer(com.google.android.exoplayer2.SimpleExoPlayer) DefaultBandwidthMeter(com.google.android.exoplayer2.upstream.DefaultBandwidthMeter) LoadControl(com.google.android.exoplayer2.LoadControl) DefaultLoadControl(com.google.android.exoplayer2.DefaultLoadControl) TrackSelector(com.google.android.exoplayer2.trackselection.TrackSelector) DefaultTrackSelector(com.google.android.exoplayer2.trackselection.DefaultTrackSelector) ExoPlayerFactory(com.google.android.exoplayer2.ExoPlayerFactory) DefaultTrackSelector(com.google.android.exoplayer2.trackselection.DefaultTrackSelector) TrackSelection(com.google.android.exoplayer2.trackselection.TrackSelection) AdaptiveVideoTrackSelection(com.google.android.exoplayer2.trackselection.AdaptiveVideoTrackSelection) DefaultLoadControl(com.google.android.exoplayer2.DefaultLoadControl)

Aggregations

DefaultBandwidthMeter (com.google.android.exoplayer2.upstream.DefaultBandwidthMeter)2 Handler (android.os.Handler)1 DefaultLoadControl (com.google.android.exoplayer2.DefaultLoadControl)1 ExoPlayerFactory (com.google.android.exoplayer2.ExoPlayerFactory)1 LoadControl (com.google.android.exoplayer2.LoadControl)1 SimpleExoPlayer (com.google.android.exoplayer2.SimpleExoPlayer)1 FrameworkMediaCrypto (com.google.android.exoplayer2.drm.FrameworkMediaCrypto)1 AdaptiveVideoTrackSelection (com.google.android.exoplayer2.trackselection.AdaptiveVideoTrackSelection)1 DefaultTrackSelector (com.google.android.exoplayer2.trackselection.DefaultTrackSelector)1 TrackSelection (com.google.android.exoplayer2.trackselection.TrackSelection)1 TrackSelector (com.google.android.exoplayer2.trackselection.TrackSelector)1