onTimebasedPlayerStateChanged property
Fires whenever the TimebasedNavigator changes state
Implementation
@override
Stream<ReadiumTimebasedState> get onTimebasedPlayerStateChanged {
_onTimebasedPlayerStateChanged ??= timebasedStateChannel.receiveBroadcastStream().map((dynamic event) {
final state = ReadiumTimebasedState.fromJson(json.decode(event) as Map<String, dynamic>);
state.currentLocator?.locations?.let((locations) {
if (locations.position == null) {
debugPrint('Received timebased player state with currentLocator missing position: $state');
} else if (locations.position! <= 0) {
debugPrint('Received timebased player state with currentLocator invalid position: $state');
}
});
return state;
}).asBroadcastStream();
return _onTimebasedPlayerStateChanged!;
}