Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

ExoPlayer2/Mediaplayer IllegalStateExeceptions #41

Merged
merged 9 commits into from
Jun 8, 2017

Conversation

ouchadam
Copy link
Contributor

@ouchadam ouchadam commented Jun 8, 2017

Problem

The MediaPlayer Facade/Impl is catching IllegalStateExceptions and returning safe values, this is the opposite to what ExoPlayer is doing.

Solution

Sync up the MediaPlayer with ExoPlayer by no longer catching IllegalStateExceptions when interacting with the MediaPlayer when it's not in a playback state.

This is now a responsibility of clients.

Test(s) added

Yep around the exceptions being thrown.

  • Also added bonus tests around the LoadTimeout

Screenshots

no UI changes

Paired with

@Dorvaryn

@ouchadam ouchadam added this to the ExoPlayer two support milestone Jun 8, 2017
@juankysoriano juankysoriano self-requested a review June 8, 2017 09:54
@juankysoriano juankysoriano self-assigned this Jun 8, 2017
Copy link
Contributor

@juankysoriano juankysoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EZ

@joetimmins joetimmins self-requested a review June 8, 2017 12:39
@joetimmins joetimmins self-assigned this Jun 8, 2017
@@ -27,7 +27,7 @@ boolean isInPlaybackState(MediaPlayer mediaPlayer, PlaybackState playbackState)
PREPARED,
PLAYING,
PAUSED,
COMPLETED;
COMPLETED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

public void givenMediaPlayerIsNotInPlaybackState_whenGettingPosition_thenThrowsIllegalStateException() {
thrown.expect(
ExceptionMatcher.matches(
"Video must be loaded and not in an error state before trying to interact with the player",
Copy link
Contributor

@joetimmins joetimmins Jun 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pull this string out into a field? If it ever changes we'd have to change like five times in the test as it stands

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joetimmins joetimmins merged commit f297202 into exo-player-2 Jun 8, 2017
@joetimmins joetimmins deleted the exoplayer2-mediaplayer-execptions branch June 8, 2017 14:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants