angularjs - SHOUTcast metadata in javascript -


i'm working on front end internet radio station , they're broadcasting shoutcast stream. have audio, need simple , reliable way display metadata on page. i'm using mean stack run whole thing if has answer fits framework preferable.

here's little whipped up. uses json-p results shoutcast, can done client side without cors issues etc

function dosomething(obj) {      document.getelementbyid('shout').textcontent = obj.songtitle;  }    var getshout = (function() {      var script;        return function shout(fn, sc, sid) {          if (script) {              document.body.removechild(script);          }          script = document.createelement('script');          script.src = sc + 'stats?json=1&callback=' + fn + '&sid=' + sid + '&rand=' + math.random();          document.body.appendchild(script);      };  }());    document.getelementbyid('eatme').addeventlistener('click', function() {      getshout('dosomething', 'http://s2.radioboss.fm:8024/', 1)  });
<input id="eatme" type="button" value="press me" />  <div id="shout"></div>


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -