async function loadFile(file) {
  const data = await new Promise((resolve, reject) => {
    const reader = new FileReader();

    reader.onload = (event) => resolve(event.target.result);
    reader.onerror = (event) => reject(event);

    reader.readAsArrayBuffer(file);
  });
  return new Promise((resolve) => {
    context.decodeAudioData(data, (buffer) => {
      if (nowPlaying) {
        nowPlaying.clean();
      }
      nowPlaying = new NowPlayingBuffer(buffer);
      resolve(buffer);
    });
  });
}
/**
 * Loads a file as the current playing thing
 */
Loads a file as the current playing thing
Loads a file as the current playing thing
async function loadFile(file) {
  const data = await new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = (event) => resolve(event.target.result);
    reader.onerror = (event) => reject(event);
    reader.readAsArrayBuffer(file);
  });
  return new Promise((resolve) => {
    context.decodeAudioData(data, (buffer) => {
      if (nowPlaying) {
        nowPlaying.clean();
      }
      nowPlaying = new NowPlayingBuffer(buffer);
      resolve(buffer);
    });
  });
}
async function loadFile ( file ) { const data = await new Promise ( ( resolve , reject ) => { const reader = new FileReader ( ) ; reader . onload = ( event ) => resolve ( event . target . result ) ; reader . onerror = ( event ) => reject ( event ) ; reader . readAsArrayBuffer ( file ) ; } ) ; return new Promise ( ( resolve ) => { context . decodeAudioData ( data , ( buffer ) => { if ( nowPlaying ) { nowPlaying . clean ( ) ; } nowPlaying = new NowPlayingBuffer ( buffer ) ; resolve ( buffer ) ; } ) ; } ) ; }
Loads a file as the current playing thing
Loads a file as the current playing thing