examples/radio/radio.js
function(index) {
    var self = this;
    var sound;

    index = typeof index === 'number' ? index : self.index;
    var data = self.stations[index];

    // If we already loaded this track, use the current one.
    // Otherwise, setup and load a new Howl.
    if (data.howl) {
      sound = data.howl;
    } else {
      sound = data.howl = new Howl({
        src: data.src,
        html5: true, // A live stream can only be played through HTML5 Audio.
        format: ['mp3', 'aac']
      });
    }

    // Begin playing the sound.
    sound.play();

    // Toggle the display.
    self.toggleStationDisplay(index, true);

    // Keep track of the index we are currently playing.
    self.index = index;
  }
function(index) {
    var self = this;
    var sound;

    index = typeof index === 'number' ? index : self.index;
    var data = self.stations[index];

    // If we already loaded this track, use the current one.
    // Otherwise, setup and load a new Howl.
    if (data.howl) {
      sound = data.howl;
    } else {
      sound = data.howl = new Howl({
        src: data.src,
        html5: true, // A live stream can only be played through HTML5 Audio.
        format: ['mp3', 'aac']
      });
    }

    // Begin playing the sound.
    sound.play();

    // Toggle the display.
    self.toggleStationDisplay(index, true);

    // Keep track of the index we are currently playing.
    self.index = index;
  }
function ( index ) { var self = this ; var sound ; index = typeof index === 'number' ? index : self . index ; var data = self . stations [ index ] ; // If we already loaded this track, use the current one. // Otherwise, setup and load a new Howl. if ( data . howl ) { sound = data . howl ; } else { sound = data . howl = new Howl ( { src : data . src , html5 : true , // A live stream can only be played through HTML5 Audio. format : [ 'mp3' , 'aac' ] } ) ; } // Begin playing the sound. sound . play ( ) ; // Toggle the display. self . toggleStationDisplay ( index , true ) ; // Keep track of the index we are currently playing. self . index = index ; }
Play a station with a specific index.
@param  {Number} index Index in the array of stations.
Play a station with a specific index .