import { isApplePlatform } from "../../reactUtils";
import { NativeModules } from "react-native";

const NativePlayerModule = isApplePlatform()
  ? NativeModules.PlayerModule
  : NativeModules.QuickBrickDefaultPlayerModule;

const PlayerNativeCommandTypes = {
  pause: "pause",
  clearPlayerData: "clearPlayerData",
  removeViewByNativeId: "removeViewByNativeId",
};

const PlayerNativeSendCommand = (
  command: string,
  playerId: string,
  userInfo?: Record<string, any>
) => {
  if (playerId && command) {
    NativePlayerModule?.command?.(command, playerId, userInfo);
  }
};

export { PlayerNativeCommandTypes, PlayerNativeSendCommand };
