execute method

void execute(
  1. GreenVideoCommand command
)

Implementation

void execute(GreenVideoCommand command) {
  if (viewId == null) {
    return;
  }

  if (!connected) {
    if (command is PlayCommand) {
      startCommand = command;
    } else if (command is StartContentCommand) {
      startCommand = command;
    }
    return;
  }

  if (command is PlayCommand) {
    _channels.play(viewId!);
    isPlaying = true;
  } else if (command is PauseCommand) {
    _channels.pause(viewId!);
    isPlaying = false;
  } else if (command is SeekCommand) {
    _channels.seek(viewId!, command.position);
    position = command.position;
  } else if (command is MuteCommand) {
    _channels.mute(viewId!);
    isMuted = true;
  } else if (command is UnmuteCommand) {
    _channels.unmute(viewId!);
    isMuted = false;
  } else if (command is EnterFullscreenCommand) {
    _channels.enterFullscreen(viewId!);
    isFullscreen = true;
  } else if (command is ExitFullscreenCommand) {
    _channels.exitFullscreen(viewId!);
    isFullscreen = false;
  } else if (command is StartNextContentCommand) {
    _channels.startNextContent(viewId!);
  } else if (command is StartPreviousContentCommand) {
    _channels.startPreviousContent(viewId!);
  } else if (command is SeekForwardCommand) {
    _channels.seekForward(viewId!, command.time);
    position = command.time;
  } else if (command is SeekBackwardCommand) {
    _channels.seekBackward(viewId!, command.time);
    position = command.time;
  } else if (command is ShowUiCommand) {
    _channels.showUi(viewId!);
    showsUi = true;
  } else if (command is HideUiCommand) {
    _channels.hideUi(viewId!);
    showsUi = false;
  } else if (command is StartContentCommand) {
    _channels.startContent(viewId!);
  }
}