<commit_before>import { ParameterType } from "../../modules/plugins";
import { unique } from "../utils";

const preloadParameterTypes = <const>[
  ParameterType.AUDIO,
  ParameterType.IMAGE,
  ParameterType.VIDEO,
];
type PreloadType = typeof preloadParameterTypes[number];

export class MediaAPI {
  constructor(private useWebaudio: boolean, private webaudioContext?: AudioContext) {}

  // video //
  private video_buffers = {};
  getVideoBuffer(videoID) {
    return this.video_buffers[videoID];
  }

  // audio //
  private context = null;
  private audio_buffers = [];

  initAudio() {
    this.context = this.useWebaudio ? this.webaudioContext : null;
  }

  audioContext() {
    if (this.context !== null) {<commit_msg>check if video buffer is already a blob when getting buffer (fixes #2704)<commit_after>import { ParameterType } from "../../modules/plugins";
import { unique } from "../utils";

const preloadParameterTypes = <const>[
  ParameterType.AUDIO,
  ParameterType.IMAGE,
  ParameterType.VIDEO,
];
type PreloadType = typeof preloadParameterTypes[number];

export class MediaAPI {
  constructor(private useWebaudio: boolean, private webaudioContext?: AudioContext) {}

  // video //
  private video_buffers = {};
  getVideoBuffer(videoID: string) {
    if (videoID.startsWith("blob:")) {
      this.video_buffers[videoID] = videoID;
    }
    return this.video_buffers[videoID];
  }

  // audio //
  private context = null;
  private audio_buffers = [];

  initAudio() {
    this.context = this.useWebaudio ? this.webaudioContext : null;
  }

  audioContext() {
    if (this.context !== null) {
{'fraction_non_alphanumeric': 0.1298136645962733, 'fraction_numerical': 0.002484472049689441, 'mean_word_length': 3.867069486404834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6883280', 'n_tokens_mistral': 491, 'n_tokens_neox': 478, 'n_words': 113}