mirror of
https://github.com/samsonjs/media.git
synced 2026-04-18 13:25:47 +00:00
Default RepeatMode for conversion is NONE/OFF
Current behaviour causes an app to crash if it receives an unrecognized repeat mode send over the wire. In order to avoid the crash, a sensible default had to be chosen.
For `Player.RepeatMode`, it is `Player.REPEAT_MODE_OFF`, which is the same value we use as default when unbundling `PlayerInfo`.
For `PlaybackStateCompat.RepeatMode`, it is `PlaybackStateCompat.REPEAT_MODE_NONE`, which is what we use in the no-arg `LegacyPlayerInfo` constructor.
Issue: androidx/media#448
#minor-release
PiperOrigin-RevId: 540563792
(cherry picked from commit 501da109ce)
This commit is contained in:
parent
3c9831fcb4
commit
2367e7a9e8
1 changed files with 14 additions and 5 deletions
|
|
@ -971,8 +971,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||
case PlaybackStateCompat.REPEAT_MODE_GROUP:
|
||||
return Player.REPEAT_MODE_ALL;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Unrecognized PlaybackStateCompat.RepeatMode: " + playbackStateCompatRepeatMode);
|
||||
Log.w(
|
||||
TAG,
|
||||
"Unrecognized PlaybackStateCompat.RepeatMode: "
|
||||
+ playbackStateCompatRepeatMode
|
||||
+ " was converted to `Player.REPEAT_MODE_OFF`");
|
||||
return Player.REPEAT_MODE_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -987,7 +991,12 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||
case Player.REPEAT_MODE_ALL:
|
||||
return PlaybackStateCompat.REPEAT_MODE_ALL;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized RepeatMode: " + repeatMode);
|
||||
Log.w(
|
||||
TAG,
|
||||
"Unrecognized RepeatMode: "
|
||||
+ repeatMode
|
||||
+ " was converted to `PlaybackStateCompat.REPEAT_MODE_NONE`");
|
||||
return PlaybackStateCompat.REPEAT_MODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1392,9 +1401,9 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
|||
* previousPlayerInfo} and taking into account the passed available commands.
|
||||
*
|
||||
* @param oldPlayerInfo The old {@link PlayerInfo}.
|
||||
* @param oldBundlingExclusions The bundling exlusions in the old {@link PlayerInfo}.
|
||||
* @param oldBundlingExclusions The bundling exclusions in the old {@link PlayerInfo}.
|
||||
* @param newPlayerInfo The new {@link PlayerInfo}.
|
||||
* @param newBundlingExclusions The bundling exlusions in the new {@link PlayerInfo}.
|
||||
* @param newBundlingExclusions The bundling exclusions in the new {@link PlayerInfo}.
|
||||
* @param availablePlayerCommands The available commands to take into account when merging.
|
||||
* @return A pair with the resulting {@link PlayerInfo} and {@link BundlingExclusions}.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue