startListner method

dynamic startListner()

Implementation

startListner() {
  try {
    _bufferstream.add(Duration.zero);
    _positionstream.add(Duration.zero);
    _durationstream.add(Duration.zero);
    eventStreamSubScription?.cancel();
    _playbackDurationstreamSubscription?.cancel();
    eventStreamSubScription =
        _channel.eventChannel.receiveBroadcastStream().listen(
      (event) {
        parseEvent(event);
      },
      onError: (value) {
        log(value.toString());
      },
    );
    _playbackDurationstreamSubscription = dart.Rx.combineLatest3<Duration,
        Duration, Duration, PlayBackDurationStream>(
      _durationstream.stream,
      _positionstream.stream,
      _bufferstream.stream,
      (a, b, c) =>
          PlayBackDurationStream(duration: a, position: b, buffered: c),
    ).listen(
      (event) {
        _playbackDurationStream.add(event);
      },
    );
  } catch (e) {
    disposePlayer();
  }
}