<commit_before>import ThreeSixtyViewer from './three-sixty-viewer';
import THREE from 'threejs360';

export default class Audio extends ThreeSixtyViewer {
  constructor(options) {
    super(options);
  }

  play() {
    this.driver.play();
  }

  pause() {
    this.driver.pause();
  }

  getElement() {
    this.driver = document.createElement('audio');
    this.driver.src = this.source;
    this.driver.loop = this.loop || false;
    this.driver.muted = this.muted || false;
    this.driver.setAttribute('crossorigin', 'anonymous');
    this.driver.autoplay = this.autoplay || true;
    return super.getElement();
  }

  createTexture() {
    let texture = new THREE.VideoTexture(this.element);
    //TODO: we can pass all this info through the constructor
    texture.minFilter = THREE.LinearFilter;
    texture.magFilter = THREE.LinearFilter;
    texture.format = THREE.RGBFormat;
    texture.generateMipmaps = false;
    texture.needsUpdate = true;
    return texture;
  }

  render() {
    let loop = () => {
      this.controls.update();
      this.renderer.render(this.scene, this.camera);
      this.element.currentTime = this.driver.currentTime;
      requestAnimationFrame(loop);
    };
    loop();
  }
}
<commit_msg>fix ios video rendering when not passing a video tag as source<commit_after>import ThreeSixtyViewer from './three-sixty-viewer';
import THREE from 'threejs360';

export default class Audio extends ThreeSixtyViewer {
  constructor(options) {
    super(options);
  }

  play() {
    this.driver.play();
  }

  pause() {
    this.driver.pause();
  }

  getElement() {
    this.driver = document.createElement('audio');
    this.driver.src = this.source;
    this.driver.loop = this.loop || false;
    this.driver.muted = this.muted || false;
    this.driver.setAttribute('crossorigin', 'anonymous');
    this.driver.autoplay = this.autoplay || true;
    let video = super.getElement();
    video.load();
    return video;
  }

  createTexture() {
    let texture = new THREE.VideoTexture(this.element);
    //TODO: we can pass all this info through the constructor
    texture.minFilter = THREE.LinearFilter;
    texture.magFilter = THREE.LinearFilter;
    texture.format = THREE.RGBFormat;
    texture.generateMipmaps = false;
    texture.needsUpdate = true;
    return texture;
  }

  render() {
    let loop = () => {
      this.controls.update();
      this.renderer.render(this.scene, this.camera);
      this.element.currentTime = this.driver.currentTime;
      requestAnimationFrame(loop);
    };
    loop();
  }
}

{'fraction_non_alphanumeric': 0.12872841444270017, 'fraction_numerical': 0.002354788069073783, 'mean_word_length': 3.1514657980456025, 'pattern_counts': {'":': 0, '<': 3, '<?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': '50796', 'n_tokens_mistral': 798, 'n_tokens_neox': 767, 'n_words': 165}