Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cc7f011e
authored
Jul 25, 2018
by
GiuseppePiscopo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(playlist): stick to list.subList API
parent
2c801ca2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
28 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java
View file @
cc7f011e
...
...
@@ -312,16 +312,11 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
* is thrown.
*
* @param fromIndex The initial range index, pointing to the first media source that will be
* removed. This index must be in the range of 0 <= index < {@link #getSize()}.
* removed. This index must be in the range of 0 <= index <
=
{@link #getSize()}.
* @param toIndex The final range index, pointing to the first media source that will be left
* untouched. The last media source to be removed is at index {@code toIndex} - 1.
* This index must be in the range of 0 <= index < {@link #getSize()}.
*
* @throws IndexOutOfBoundsException when either index is out of playlist bounds, i.e. {@code
* fromIndex} < 0 or >= {@link #getSize()}, {@code toIndex} < 0 or > {@link
* #getSize()}
* @throws IndexOutOfBoundsException when range is malformed, i.e. {@code fromIndex} >
* {@code toIndex}
* untouched. This index must be in the range of 0 <= index <= {@link #getSize()}.
* @throws IndexOutOfBoundsException When the range is malformed, i.e. {@code fromIndex} <
* 0, {@code toIndex} > {@link #getSize()}, {@code fromIndex} > {@code toIndex}
*/
public
final
synchronized
void
removeMediaSourceRange
(
int
fromIndex
,
int
toIndex
)
{
removeMediaSourceRange
(
fromIndex
,
toIndex
,
null
);
...
...
@@ -335,37 +330,23 @@ public class ConcatenatingMediaSource extends CompositeMediaSource<MediaSourceHo
* is thrown.
*
* @param fromIndex The initial range index, pointing to the first media source that will be
* removed. This index must be in the range of 0 <= index < {@link #getSize()}.
* removed. This index must be in the range of 0 <= index <
=
{@link #getSize()}.
* @param toIndex The final range index, pointing to the first media source that will be left
* untouched. The last media source to be removed is at index {@code toIndex} - 1.
* This index must be in the range of 0 <= index < {@link #getSize()}.
*
* @throws IndexOutOfBoundsException when either index is out of playlist bounds, i.e. {@code
* fromIndex} < 0 or >= {@link #getSize()}, {@code toIndex} < 0 or > {@link
* #getSize()}
* @throws IndexOutOfBoundsException when range is malformed, i.e. {@code fromIndex} >
* {@code toIndex}
* untouched. This index must be in the range of 0 <= index <= {@link #getSize()}.
* @param actionOnCompletion A {@link Runnable} which is executed immediately after the media
* source range has been removed from the playlist.
* @throws IndexOutOfBoundsException When the range is malformed, i.e. {@code fromIndex} <
* 0, {@code toIndex} > {@link #getSize()}, {@code fromIndex} > {@code toIndex}
*/
public
final
synchronized
void
removeMediaSourceRange
(
int
fromIndex
,
int
toIndex
,
@Nullable
Runnable
actionOnCompletion
)
{
if
(
fromIndex
<
0
||
fromIndex
>=
mediaSourcesPublic
.
size
())
{
throw
new
IndexOutOfBoundsException
(
String
.
format
(
"Cannot remove source range: initial index (%d) out of bounds"
,
fromIndex
));
}
if
(
toIndex
<
0
||
toIndex
>
mediaSourcesPublic
.
size
())
{
throw
new
IndexOutOfBoundsException
(
String
.
format
(
"Cannot remove source range: final index (%d) out of bounds"
,
toIndex
));
}
if
(
fromIndex
>
toIndex
)
{
throw
new
IndexOutOfBoundsException
(
String
.
format
(
"Cannot remove source range: range malformed (%d, %d)"
,
fromIndex
,
toIndex
));
}
Util
.
removeRange
(
mediaSourcesPublic
,
fromIndex
,
toIndex
);
if
(
fromIndex
==
toIndex
)
{
if
(
actionOnCompletion
!=
null
)
{
actionOnCompletion
.
run
();
}
return
;
}
mediaSourcesPublic
.
subList
(
fromIndex
,
toIndex
).
clear
();
if
(
player
!=
null
)
{
player
.
createMessage
(
this
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment