Documentation

API Methods


start

If autoStart is set to false, this function allows you to manually start the plugin. If necessary, you can pass configuration parameters to this function

    
    var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

    boulevard.start(layoutParams);
    

hasStarted

This function allows you to check if the boulevard instance has started

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        if(boulevard.hasStarted()){
            //do something is the instance has started
        }
        else{
            //the instance hasn't started. Do something else
        }
    

destroy

This function allows you to destroy a boulevard instance, removing it from the page

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.destroy();
    

setLayout

This function allows you to set the current layout

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.setLayout({
            layout:'single-album-cover',
            styleType:'blur'
        });
    

manageLayout

This function will set the layout based on the container size. If the container is bigger than smallScreenSize then this function will load the layout specified in the 'layout' parameter. If the container is smaller than smallScreenSize it will load the layout specified in the 'smallScreenLayout' parameter. Normally, the plugin will resize itself if the size of the window changes, but if you manually resize the container size, this function becomes very useful.

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.manageLayout();
    

on

Attach an event handler function for one or more events.

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.on('playlistInit', function(){
            //do something when the playlist initializes
        });
    

once

Just like on, but causes the bound callback to only fire once before being removed. Handy for saying "the next time that X happens, do this".

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.once('playlistAdvance', function(){
            //do something when the playlist initializes
        });
    

off

Unbind an event handler. This works similarly to the jQuery off function.

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        //EXAMPLE 1
        //unbind all handlers for an event
        boulevard.on('playlistAdvance', function(){
            //do something
        });

        boulevard.off('playlistAdvance');


        //EXAMPLE 2
        //unbind a specific handler
        var someHandler = function(){
            //do stuff
        }

        boulevard.on('playlistAdvance', someHandler);

        boulevard.off('playlistAdvance', someHandler);
    

getOptions

Returns the current options object.

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist),
            options = boulevard.getOptions();
    

redraw

Redraws the current layout and background

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.redraw();
    

play

Starts playback

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.play();
    

pause

Pauses playback

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.pause();
    

next

Advances to the next song in the playlist

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.next();
    

prev

Plays the previous song in the playlist

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.prev();
    

togglePlay

Pauses if Boulevard is currently playing. Starts playing if it's currently paused.

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.togglePlay();
    

setOptions

Allows you to set options after the plugin has already initialized

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        boulevard.setOptions({
            smallScreenLayout:'info'
        });
    

swapPlaylist

Allows you to swap the playlist after the plugin has already initialized

    
        var boulevard = $('#myPlayer').ttwBoulevard(myPlaylist);

        //new playlist should be an array
        boulevard.swapPlaylist(newPlaylist);
    
You can download fully functional examples that work out of the box by purchasing a developer license. Download Examples Now