onTimebasedPlayerStateChanged property

  1. @override
Stream<ReadiumTimebasedState> get onTimebasedPlayerStateChanged
override

Fires whenever the TimebasedNavigator changes state.

Undecodable events are logged and dropped, as for onTextLocatorChanged.

Implementation

@override
Stream<ReadiumTimebasedState> get onTimebasedPlayerStateChanged {
  _onTimebasedPlayerStateChanged ??= timebasedStateChannel
      .receiveBroadcastStream()
      .map(ReadiumTimebasedState.fromJsonDynamic)
      .where((state) => state != null)
      .cast<ReadiumTimebasedState>()
      .map(_warnOnSuspiciousPosition)
      .asBroadcastStream();

  return _onTimebasedPlayerStateChanged!;
}