top

How to configure the player for MP3 live streaming?

Published 2014-10-27 | (Compatible with SDK 2.5,3.5,4.5,5.0,5.1 and 2011,2012,2013,2014 models)

MP3 audio live streaming

For applications that implement MP3 live streaming (for example internet radio applications), there is a dedicated API which makes the playback start faster.

There are some limitations to the use of this API:

  • It works only from 2011 devices onwards
  • It supports only MP3 streaming (WMA and other formats are not supported yet).

Here is a sample usage example for comparison:

Source Files

Note

The files needed for the sample application are here.

MP3 streaming example

  1. In index.html file:

    <script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>
    
  2. In Main.js file:

    var gAVplayObj = null;
    
    Main.onLoad = function() {
        widgetAPI.sendReadyEvent();
        window.onShow = onShowEvent;
    }
    
    var onShowEvent = function() {
        try{
            webapis.avplay.getAVPlay(successCB, errorCB);
        }catch(error) {
            console.log(error.name);
        }
    }
    
    function successCB(avplayObj) {
        gAVplayObj = avplayObj;
        gAVplayObj.init();
        gAVplayObj.open(url);
        gAVplayObj.play(playSuccessCB, function(error){console.log(error.name<span class=");});
    }
    
    function errorCB(error) {
        console.log("Cannot get avplay object : " + error.name);
    }
    
    function playSuccessCB() {
        console.log("Playing the video is successfully.");
    }
    

See also

See How to check the firmware version? for more information how to check the device release year.