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
2f8c8b60
authored
Jun 05, 2019
by
aquilescanta
Committed by
Oliver Woodman
Jun 06, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix detection of current window index in CastPlayer
Issue:#5955 PiperOrigin-RevId: 251616118
parent
83a6d51f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
RELEASENOTES.md
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
RELEASENOTES.md
View file @
2f8c8b60
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
*
Fix bug caused by parallel adaptive track selection using
`Format`
s without
*
Fix bug caused by parallel adaptive track selection using
`Format`
s without
bitrate information
bitrate information
(
[
#5971
](
https://github.com/google/ExoPlayer/issues/5971
)
).
(
[
#5971
](
https://github.com/google/ExoPlayer/issues/5971
)
).
*
Fix bug in
`CastPlayer.getCurrentWindowIndex()`
(
[
#5955
](
https://github.com/google/ExoPlayer/issues/5955
)
).
### 2.10.1 ###
### 2.10.1 ###
...
...
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
View file @
2f8c8b60
...
@@ -551,7 +551,17 @@ public final class CastPlayer extends BasePlayer {
...
@@ -551,7 +551,17 @@ public final class CastPlayer extends BasePlayer {
notificationsBatch
.
add
(
notificationsBatch
.
add
(
new
ListenerNotificationTask
(
listener
->
listener
.
onRepeatModeChanged
(
this
.
repeatMode
)));
new
ListenerNotificationTask
(
listener
->
listener
.
onRepeatModeChanged
(
this
.
repeatMode
)));
}
}
int
currentWindowIndex
=
fetchCurrentWindowIndex
(
getMediaStatus
());
maybeUpdateTimelineAndNotify
();
int
currentWindowIndex
=
C
.
INDEX_UNSET
;
MediaQueueItem
currentItem
=
remoteMediaClient
.
getCurrentItem
();
if
(
currentItem
!=
null
)
{
currentWindowIndex
=
currentTimeline
.
getIndexOfPeriod
(
currentItem
.
getItemId
());
}
if
(
currentWindowIndex
==
C
.
INDEX_UNSET
)
{
// The timeline is empty. Fall back to index 0, which is what ExoPlayer would do.
currentWindowIndex
=
0
;
}
if
(
this
.
currentWindowIndex
!=
currentWindowIndex
&&
pendingSeekCount
==
0
)
{
if
(
this
.
currentWindowIndex
!=
currentWindowIndex
&&
pendingSeekCount
==
0
)
{
this
.
currentWindowIndex
=
currentWindowIndex
;
this
.
currentWindowIndex
=
currentWindowIndex
;
notificationsBatch
.
add
(
notificationsBatch
.
add
(
...
@@ -564,7 +574,6 @@ public final class CastPlayer extends BasePlayer {
...
@@ -564,7 +574,6 @@ public final class CastPlayer extends BasePlayer {
new
ListenerNotificationTask
(
new
ListenerNotificationTask
(
listener
->
listener
.
onTracksChanged
(
currentTrackGroups
,
currentTrackSelection
)));
listener
->
listener
.
onTracksChanged
(
currentTrackGroups
,
currentTrackSelection
)));
}
}
maybeUpdateTimelineAndNotify
();
flushNotifications
();
flushNotifications
();
}
}
...
@@ -714,16 +723,6 @@ public final class CastPlayer extends BasePlayer {
...
@@ -714,16 +723,6 @@ public final class CastPlayer extends BasePlayer {
}
}
}
}
/**
* Retrieves the current item index from {@code mediaStatus} and maps it into a window index. If
* there is no media session, returns 0.
*/
private
static
int
fetchCurrentWindowIndex
(
@Nullable
MediaStatus
mediaStatus
)
{
Integer
currentItemId
=
mediaStatus
!=
null
?
mediaStatus
.
getIndexById
(
mediaStatus
.
getCurrentItemId
())
:
null
;
return
currentItemId
!=
null
?
currentItemId
:
0
;
}
private
static
boolean
isTrackActive
(
long
id
,
long
[]
activeTrackIds
)
{
private
static
boolean
isTrackActive
(
long
id
,
long
[]
activeTrackIds
)
{
for
(
long
activeTrackId
:
activeTrackIds
)
{
for
(
long
activeTrackId
:
activeTrackIds
)
{
if
(
activeTrackId
==
id
)
{
if
(
activeTrackId
==
id
)
{
...
...
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