PlayerEventForwarderWeb constructor

PlayerEventForwarderWeb(
  1. THEOplayerJS _theoplayerJS
)

Implementation

PlayerEventForwarderWeb(this._theoplayerJS) {
  canPlayEventListener = allowInterop((CanPlayEventJS event) {
    _eventManager.dispatchEvent(CanPlayEvent(currentTime: event.currentTime));
  });

  timeUpdateEventListener = allowInterop((TimeUpdateEventJS event) {
    _eventManager.dispatchEvent(TimeUpdateEvent(currentTime: event.currentTime, currentProgramDateTime: event.currentProgramDateTime?.getTime()));
  });

  playEventListener = allowInterop((PlayEventJS event) {
    _eventManager.dispatchEvent(PlayEvent(currentTime: event.currentTime));
  });

  playingEventListener = allowInterop((PlayingEventJS event) {
    _eventManager.dispatchEvent(PlayingEvent(currentTime: event.currentTime));
  });

  pauseEventListener = allowInterop((PauseEventJS event) {
    _eventManager.dispatchEvent(PauseEvent(currentTime: event.currentTime));
  });

  waitingEventListener = allowInterop((WaitingEventJS event) {
    _eventManager.dispatchEvent(WaitingEvent(currentTime: event.currentTime));
  });

  durationChangeEventListener = allowInterop((DurationChangeEventJS event) {
    _eventManager.dispatchEvent(DurationChangeEvent(duration: event.duration));
  });

  progressEventListener = allowInterop((ProgressEventJS event) {
    _eventManager.dispatchEvent(ProgressEvent(currentTime: event.currentTime));
  });

  rateChangeEventListener = allowInterop((RateChangeEventJS event) {
    _eventManager.dispatchEvent(RateChangeEvent(currentTime: event.currentTime, playbackRate: event.playbackRate));
  });

  seekingEventListener = allowInterop((SeekingEventJS event) {
    _eventManager.dispatchEvent(SeekingEvent(currentTime: event.currentTime));
  });

  seekedEventListener = allowInterop((SeekedEventJS event) {
    _eventManager.dispatchEvent(SeekedEvent(currentTime: event.currentTime));
  });

  volumeChangeEventListener = allowInterop((VolumeChangeEventJS event) {
    _eventManager.dispatchEvent(VolumeChangeEvent(currentTime: event.currentTime, volume: event.volume));
  });

  resizeEventListener = allowInterop((ResizeEventJS event) {
    _eventManager.dispatchEvent(ResizeEvent(currentTime: _theoplayerJS.currentTime, width: _theoplayerJS.videoWidth, height: _theoplayerJS.videoHeight));
  });

  endedEventListener = allowInterop((EndedEventJS event) {
    _eventManager.dispatchEvent(EndedEvent(currentTime: event.currentTime));
  });

  errorEventListener = allowInterop((ErrorEventJS event) {
    _eventManager.dispatchEvent(ErrorEvent(error: event.error));
  });

  destroyEventListener = allowInterop((DestroyEventJS event) {
    _eventManager.dispatchEvent(DestroyEvent());
  });

  readyStateChangeEventListener = allowInterop((ReadyStateChangeEventJS event) {
    _eventManager.dispatchEvent(ReadyStateChangeEvent(currentTime: event.currentTime, readyState: toFlutterReadyState(event.readyState)));
  });

  loadStartEventListener = allowInterop((LoadedDataEventJS event) {
    _eventManager.dispatchEvent(LoadStartEvent());
  });

  loadedMetadataEventListener = allowInterop((LoadedMetadataEventJS event) {
    _eventManager.dispatchEvent(LoadedMetadataEvent(currentTime: event.currentTime));
  });

  loadedDataEventListener = allowInterop((LoadedDataEventJS event) {
    _eventManager.dispatchEvent(LoadedDataEvent(currentTime: event.currentTime));
  });

  canPlayThroughEventListener = allowInterop((CanPlayThroughEventJS event) {
    _eventManager.dispatchEvent(CanPlayThroughEvent(currentTime: event.currentTime));
  });

  sourceChangeEventListener = allowInterop((SourceChangeEventJS event) {
    _eventManager.dispatchEvent(SourceChangeEvent(source: toFlutterSourceDescription(event.source)));
  });

  attachEventListeners();
}