MediaStatus handling flutter

This commit is contained in:
gianlucaparadise 2021-12-25 11:03:15 +01:00
parent 1ae9006756
commit bae07bda32
2 changed files with 3 additions and 19 deletions

View file

@ -85,19 +85,3 @@ class RemoteMediaClient {
this._playerStateNotifier.value = playerState;
}
}
/// State of the remote media player
enum PlayerState {
/// Constant indicating unknown player state.
unknown, // 0
/// Constant indicating that the media player is idle.
idle, // 1
/// Constant indicating that the media player is playing.
playing, // 2
/// Constant indicating that the media player is paused.
paused, // 3
/// Constant indicating that the media player is buffering.
buffering, // 4
/// Constant indicating that the media player is loading.
loading, // 5
}

View file

@ -110,7 +110,7 @@ class _CastFlutterApiImplementor extends CastFlutterApi {
//region RemoteMediaClient
@override
void onAdBreakStatusUpdated() {
void onAdBreakStatusUpdated(MediaStatus mediaStatus) {
remoteMediaClient.onAdBreakStatusUpdated?.call();
}
@ -140,8 +140,8 @@ class _CastFlutterApiImplementor extends CastFlutterApi {
}
@override
void onStatusUpdated(int playerStateRaw) {
final playerState = PlayerState.values[playerStateRaw];
void onStatusUpdated(MediaStatus mediaStatus) {
final playerState = mediaStatus.playerState ?? PlayerState.unknown;
remoteMediaClient.dispatchPlayerStateUpdate(playerState);
}