Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong currentWindowIndex onPlayerError #5407

Closed
Khang-NT opened this issue Jan 19, 2019 · 5 comments
Closed

Wrong currentWindowIndex onPlayerError #5407

Khang-NT opened this issue Jan 19, 2019 · 5 comments

Comments

@Khang-NT
Copy link
Contributor

Issue description & Reproduction steps

When using ConcatenatingMediaSource to play a playlist of media, let say I'm playing at position i, and position i + 1 failed to load. Then within onPlayerError callback, I expectcurrentWindowIndex should return i + 1 but actually it return i. Is it intended behavior?

Version of ExoPlayer being used

2.9.3

@tonihei tonihei self-assigned this Jan 21, 2019
@tonihei tonihei added the bug label Jan 21, 2019
@tonihei
Copy link
Collaborator

tonihei commented Jan 21, 2019

Is it intended behavior?

That's not exactly intended behaviour and for load errors specifically we should report the loading source window index. Note that the non-fatal onLoadError callbacks already have the correct window index. However, the fatal onPlayerError always gets assigned to the currently playing window index. As we can't switch to the next window if there is a load error, you still see the previous window index in onPlayerError as the "playing" one.

@tonihei
Copy link
Collaborator

tonihei commented Jan 21, 2019

Probably wasn't clear from my previous comment:

  • player.getCurrentWindowIndex will still return the previous window index in all cases because we can't switch to the next item we don't get any samples.
  • EventTime.windowIndex in the AnalyticsListener callbacks will contain the correct association from error to window.

ojw28 pushed a commit that referenced this issue Jan 21, 2019
ExoPlaybackExceptions of type SOURCE are always associated with the loading
period and thus we can use the event time for the loading period in
onPlayerError. Renderer and unexpected exceptions are still associated with the
currently playing period.

Issue:#5407
PiperOrigin-RevId: 230216253
ojw28 pushed a commit that referenced this issue Jan 21, 2019
ExoPlaybackExceptions of type SOURCE are always associated with the loading
period and thus we can use the event time for the loading period in
onPlayerError. Renderer and unexpected exceptions are still associated with the
currently playing period.

Issue:#5407
PiperOrigin-RevId: 230216253
@ojw28 ojw28 closed this as completed Jan 21, 2019
@Khang-NT
Copy link
Contributor Author

This behavior will lead to:

  • PlayerView display last video frame or thumbnail of item i while showing error message of item i + 1. When shuffle is enabled, it will confuse user because next item is unknown random position.
  • I can't call skip() within onPlayerError. Because it actually set the window index to i + 1 where the media item can't play. Then somehow I need to call skip "twice".

@tonihei
Copy link
Collaborator

tonihei commented Jan 22, 2019

Fixing it in the way you describe would require some changes in how we progress internally through the playlist. Right now, we don't change the playing source to the next item until the next source is fully prepared. I agree that this not ideal, but it requires moving around some code in our core player. And a lot of care not to break things in the process. :)

I'll re-open as an enhancement, but also mark it as low priority for now for the reason given above.

@tonihei tonihei reopened this Jan 22, 2019
ojw28 pushed a commit that referenced this issue Jul 26, 2019
Creating a period in MaskingMediaSource may result in delayed event reporting
depending on when the actual period gets created. To avoid event reporting
inaccuracies, report the mediaPeriodCreated and mediaPeriodReleased events
directly.

Issue:#5407
PiperOrigin-RevId: 259737170
ojw28 pushed a commit that referenced this issue Jul 26, 2019
We keep track of the last publicly known playing period to report it as part
of events happening after the period has been released.

In cases where a period briefly becomes the playing one and is released
immediately afterwards, we currently don't save it as the "last known playing
one". Improve that by saving an explicit reference.

Issue:#5407
PiperOrigin-RevId: 259737218
@tonihei
Copy link
Collaborator

tonihei commented Aug 21, 2019

We fixed this issue with the two commits below.

@tonihei tonihei closed this as completed Aug 21, 2019
tonihei added a commit that referenced this issue Aug 23, 2019
This solves various issues around event association for buffering and
error throwing around period discontinuities.

The main changes are:
 - Logic around being "ready" at the end of a period no longer checks if the
   next period is prepared.
 - Advancing the playing period no longer checks if the next one is prepared.
 - Prepare errors are always thrown for the playing period.

This changes the semantics and assumptions about the "playing" period:
 1. The playing period can no longer assumed to be prepared.
 2. We no longer have a case where the queue is non-empty and the playing or
    reading periods are unassigned (=null).
Most other code changes ensure that these changed assumptions are handled.

Issue:#5407
PiperOrigin-RevId: 263776304
tonihei added a commit that referenced this issue Aug 23, 2019
The error is closely related to the playback state IDLE and should be updated
in sync with the state to prevent unexpected event ordering and/or keeping the
error after re-preparation.

Issue:#5407
PiperOrigin-RevId: 265014630
@google google locked and limited conversation to collaborators Oct 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants