Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js audio stream player

  let context;
  let request;
  let source;

  try {
    context = new AudioContext();
    request = new XMLHttpRequest();
    request.open("GET","http://jplayer.org/audio/mp3/RioMez-01-Sleep_together.mp3",true);
    request.responseType = "arraybuffer";

    request.onload = function() {
      context.decodeAudioData(request.response, function(buffer) {
        source = context.createBufferSource();
        source.buffer = buffer;
        source.connect(context.destination);
        // auto play
        source.start(0); // start was previously noteOn
      });
    };

    request.send();

  } catch(e) {
    alert('web audio api not supported');
  }
Comment

PREVIOUS NEXT
Code Example
Javascript :: js remove li from ul 
Javascript :: how to update the react version in next js app 
Javascript :: hover effect in material ui 
Javascript :: how to check how many strings are in a sentence javascript 
Javascript :: set js 
Javascript :: how to print a line in javascript 
Javascript :: command to delete node modules 
Javascript :: currying javascript sum 
Javascript :: filter array inside array 
Javascript :: javascript get month string 
Javascript :: mongoose get document 
Javascript :: how to convert node list to array in javascript 
Javascript :: how to make @click in router-link vuejs 
Javascript :: eslint ignorel ine 
Javascript :: javascript check if null 
Javascript :: toggle state react 
Javascript :: typed.js 
Javascript :: jquery append table row 
Javascript :: regex is not empty string 
Javascript :: jspdf pdf from html 
Javascript :: reset function javascript 
Javascript :: number constructor js 
Javascript :: nodejs how to send html 
Javascript :: js  
Javascript :: fetch await reactjs 
Javascript :: javascript array 
Javascript :: collapse uncollapse jquery 
Javascript :: js array of objects get a specific key from all objects 
Javascript :: react proxy 
Javascript :: unity javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =