<commit_before>/*

  This file unifies the API from the cordova and audio5 depending on env

*/


class Audio {

  constructor(src, success, error, status) {

    try {
      this._audio5 = new Audio5({
        ready: function(player) {
          this.load(src);
        }

      });
    } catch (e) {
      error(e);
    }


    this._audio5.one("canplay", success)


    this._audio5.on("timeupdate", () => {
      this.position = this._audio5.position;
    });

    this.position = null;
    this.duration = this._audio5.duration;

  }

  getCurrentPosition = () => { this._audio5.position; }

  timeupdate = (callback) => {
    this._audio5.on("timeupdate", () => {
      callback(this.position);
    })
  }

  getDuration = () => { this._audio5.duration; }

  play = () => { this._audio5.play(); }

  pause = () => { this._audio5.pause(); }
  playPause = () => { this._audio5.playPause(); }
<commit_msg>fix audio error console logging<commit_after>/*

  This file unifies the API from the cordova and audio5 depending on env

*/


class Audio {

  constructor(src, success, error, status) {

    try {
      this._audio5 = new Audio5({
        ready: function(player) {
          this.load(src);
        }

      });
    } catch (e) {
      console.error(e);
    }


    this._audio5.one("canplay", success)


    this._audio5.on("timeupdate", () => {
      this.position = this._audio5.position;
    });

    this.position = null;
    this.duration = this._audio5.duration;

  }

  getCurrentPosition = () => { this._audio5.position; }

  timeupdate = (callback) => {
    this._audio5.on("timeupdate", () => {
      callback(this.position);
    })
  }

  getDuration = () => { this._audio5.duration; }

  play = () => { this._audio5.play(); }

  pause = () => { this._audio5.pause(); }
  playPause = () => { this._audio5.playPause(); }

{'fraction_non_alphanumeric': 0.16775244299674266, 'fraction_numerical': 0.014115092290988056, 'mean_word_length': 2.412962962962963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '134990', 'n_tokens_mistral': 627, 'n_tokens_neox': 594, 'n_words': 110}