/** * Constructs a new instance. * * @param allocator The {@link DefaultAllocator} used by the loader. * @param minBufferMs The minimum duration of media that the player will attempt to ensure is * buffered at all times, in milliseconds. * @param maxBufferMs The maximum duration of media that the player will attempt buffer, in * milliseconds. * @param bufferForPlaybackMs The duration of media that must be buffered for playback to start or * resume following a user action such as a seek, in milliseconds. * @param bufferForPlaybackAfterRebufferMs The default duration of media that must be buffered for * playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by * buffer depletion rather than a user action. * @param targetBufferBytes The target buffer size in bytes. If set to {@link C#LENGTH_UNSET}, the * target buffer size will be calculated using {@link #calculateTargetBufferSize(Renderer[], * TrackSelectionArray)}. * @param prioritizeTimeOverSizeThresholds Whether the load control prioritizes buffer time */ public DefaultLoadControl( DefaultAllocator allocator, int minBufferMs, int maxBufferMs, int bufferForPlaybackMs, int bufferForPlaybackAfterRebufferMs, int targetBufferBytes, boolean prioritizeTimeOverSizeThresholds) { this( allocator, minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs, targetBufferBytes, prioritizeTimeOverSizeThresholds, null); }
private void createExoPlayer() { if (mExoPlayer != null) { releaseExoPlayer(); } // create default TrackSelector TrackSelector trackSelector = new DefaultTrackSelector(); // create default LoadControl - double the buffer LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE * 2)); // create the player mExoPlayer = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(getApplicationContext()), trackSelector, loadControl); }
private static LoadControl getNewLoadControl() { return new DefaultLoadControl( new DefaultAllocator(false, C.DEFAULT_BUFFER_SEGMENT_SIZE), DefaultLoadControl.DEFAULT_MIN_BUFFER_MS, maxBufferMs.getObject(), DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_MS, DefaultLoadControl.DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS, DefaultLoadControl.DEFAULT_TARGET_BUFFER_BYTES, DefaultLoadControl.DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS); }
/** * Constructs a new instance, using the {@code DEFAULT_*} constants defined in this class. * * @param allocator The {@link DefaultAllocator} used by the loader. */ public DefaultLoadControl(DefaultAllocator allocator) { this( allocator, DEFAULT_MIN_BUFFER_MS, DEFAULT_MAX_BUFFER_MS, DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS, DEFAULT_BUFFER_FOR_PLAYBACK_MS, DEFAULT_TARGET_BUFFER_BYTES, DEFAULT_PRIORITIZE_TIME_OVER_SIZE_THRESHOLDS); }
@Before public void setUp() throws Exception { allocator = new DefaultAllocator(false, ALLOCATION_SIZE); sampleQueue = new SampleQueue(allocator); formatHolder = new FormatHolder(); inputBuffer = new DecoderInputBuffer(DecoderInputBuffer.BUFFER_REPLACEMENT_MODE_NORMAL); }
private void createPlayer() { if (mPlayer != null) { releasePlayer(); } // create default TrackSelector TrackSelector trackSelector = new DefaultTrackSelector(); // create default LoadControl - double the buffer LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE * 2)); // create the player mPlayer = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(getApplicationContext()), trackSelector, loadControl); }
/** * Instantiates a new Buffering load control. */ public BufferingLoadControl() { this(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE)); }
/** * Instantiates a new Buffering load control. * * @param allocator the allocator */ public BufferingLoadControl(DefaultAllocator allocator) { this(allocator, DEFAULT_MIN_BUFFER_MS, DEFAULT_MAX_BUFFER_MS, DEFAULT_BUFFER_FOR_PLAYBACK_MS, DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS); }
public PreviewLoadControl() { allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE); }
/** * Constructs a new instance, using the {@code DEFAULT_*} constants defined in this class. */ public DefaultLoadControl() { this(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE)); }
/** * Constructs a new instance. * * @param allocator The {@link DefaultAllocator} used by the loader. * @param minBufferMs The minimum duration of media that the player will attempt to ensure is * buffered at all times, in milliseconds. * @param maxBufferMs The maximum duration of media that the player will attempt buffer, in * milliseconds. * @param bufferForPlaybackMs The duration of media that must be buffered for playback to start or * resume following a user action such as a seek, in milliseconds. * @param bufferForPlaybackAfterRebufferMs The default duration of media that must be buffered for * playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by * buffer depletion rather than a user action. * @param targetBufferBytes The target buffer size in bytes. If set to {@link C#LENGTH_UNSET}, the * target buffer size will be calculated using {@link #calculateTargetBufferSize(Renderer[], * TrackSelectionArray)}. * @param prioritizeTimeOverSizeThresholds Whether the load control prioritizes buffer time * constraints over buffer size constraints. * @param priorityTaskManager If not null, registers itself as a task with priority {@link * C#PRIORITY_PLAYBACK} during loading periods, and unregisters itself during draining */ public DefaultLoadControl( DefaultAllocator allocator, int minBufferMs, int maxBufferMs, int bufferForPlaybackMs, int bufferForPlaybackAfterRebufferMs, int targetBufferBytes, boolean prioritizeTimeOverSizeThresholds, PriorityTaskManager priorityTaskManager) { this.allocator = allocator; minBufferUs = minBufferMs * 1000L; maxBufferUs = maxBufferMs * 1000L; targetBufferBytesOverwrite = targetBufferBytes; bufferForPlaybackUs = bufferForPlaybackMs * 1000L; bufferForPlaybackAfterRebufferUs = bufferForPlaybackAfterRebufferMs * 1000L; this.prioritizeTimeOverSizeThresholds = prioritizeTimeOverSizeThresholds; this.priorityTaskManager = priorityTaskManager; }
/** * Instantiates a new Buffering load control. * * @param allocator the allocator * @param minBufferMs the min buffer ms * @param maxBufferMs the max buffer ms * @param bufferForPlaybackMs the buffer for playback ms * @param bufferForPlaybackAfterRebufferMs the buffer for playback after rebuffer ms * @param priorityTaskManager the priority task manager */ public BufferingLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs, PriorityTaskManager priorityTaskManager) { this.allocator = allocator; minBufferUs = minBufferMs * 2000L; maxBufferUs = maxBufferMs * 2000L; bufferForPlaybackUs = bufferForPlaybackMs * 2000L; bufferForPlaybackAfterRebufferUs = bufferForPlaybackAfterRebufferMs * 2000L; this.priorityTaskManager = priorityTaskManager; }
/** * Constructs a new instance. * * @param allocator The {@link DefaultAllocator} used by the loader. * @param minBufferMs The minimum duration of media that the player will attempt to ensure is * buffered at all times, in milliseconds. * @param maxBufferMs The maximum duration of media that the player will attempt buffer, in * milliseconds. * @param bufferForPlaybackMs The duration of media that must be buffered for playback to start or * resume following a user action such as a seek, in milliseconds. * @param bufferForPlaybackAfterRebufferMs The default duration of media that must be buffered for * playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by * buffer depletion rather than a user action. * @param priorityTaskManager If not null, registers itself as a task with priority * {@link C#PRIORITY_PLAYBACK} during loading periods, and unregisters itself during draining * periods. */ public DefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs, PriorityTaskManager priorityTaskManager) { this.allocator = allocator; minBufferUs = minBufferMs * 1000L; maxBufferUs = maxBufferMs * 1000L; bufferForPlaybackUs = bufferForPlaybackMs * 1000L; bufferForPlaybackAfterRebufferUs = bufferForPlaybackAfterRebufferMs * 1000L; this.priorityTaskManager = priorityTaskManager; }
private void createExoPlayer() { if (mExoPlayer != null) { releaseExoPlayer(); } DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(this, null, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF); TrackSelector trackSelector = new DefaultTrackSelector(); LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE * 2)); mExoPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl); }
/** * Constructs a new instance. * * @param allocator The {@link DefaultAllocator} used by the loader. * @param minBufferMs The minimum duration of media that the player will attempt to ensure is * buffered at all times, in milliseconds. * @param maxBufferMs The maximum duration of media that the player will attempt buffer, in * milliseconds. * @param bufferForPlaybackMs The duration of media that must be buffered for playback to start or * resume following a user action such as a seek, in milliseconds. * @param bufferForPlaybackAfterRebufferMs The default duration of media that must be buffered for * playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by * buffer depletion rather than a user action. */ public DefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs) { this.allocator = allocator; minBufferUs = minBufferMs * 1000L; maxBufferUs = maxBufferMs * 1000L; bufferForPlaybackUs = bufferForPlaybackMs * 1000L; bufferForPlaybackAfterRebufferUs = bufferForPlaybackAfterRebufferMs * 1000L; }
/** * Instantiates a new Buffering load control. * * @param allocator the allocator * @param minBufferMs the min buffer ms * @param maxBufferMs the max buffer ms * @param bufferForPlaybackMs the buffer for playback ms * @param bufferForPlaybackAfterRebufferMs the buffer for playback after rebuffer ms */ public BufferingLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs) { this(allocator, minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs, null); }
/** * Constructs a new instance, using the {@code DEFAULT_*} constants defined in this class. * * @param allocator The {@link DefaultAllocator} used by the loader. */ public DefaultLoadControl(DefaultAllocator allocator) { this(allocator, DEFAULT_MIN_BUFFER_MS, DEFAULT_MAX_BUFFER_MS, DEFAULT_BUFFER_FOR_PLAYBACK_MS, DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS); }
/** * Constructs a new instance. * * @param allocator The {@link DefaultAllocator} used by the loader. * @param minBufferMs The minimum duration of media that the player will attempt to ensure is * buffered at all times, in milliseconds. * @param maxBufferMs The maximum duration of media that the player will attempt buffer, in * milliseconds. * @param bufferForPlaybackMs The duration of media that must be buffered for playback to start or * resume following a user action such as a seek, in milliseconds. * @param bufferForPlaybackAfterRebufferMs The default duration of media that must be buffered for * playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by * buffer depletion rather than a user action. */ public DefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs) { this(allocator, minBufferMs, maxBufferMs, bufferForPlaybackMs, bufferForPlaybackAfterRebufferMs, null); }