Class CustomSchemes

Class Summary

CustomSchemes()
allows the developer to create shortcuts or custom schemes for common patterns or common Playable objects in-use; NOTE: The main thing to understand about CustomSchemes is that any value set in the scheme_map definition will override anything passed in on Playable creation, if the identifier of the Playable happens to qualify as a registered CustomScheme.

Method Summary

Method Detail

  • init(scheme_map)
    initializes the map of custom schemes -- when a new Playable object is created, a look-up of the identifier on the CustomSchemes object will happen to determine if the Playable matches one of the CustomSchemes. If so, all attributes defined in the scheme_map will override the Playable
    var scheme_map = {
       apm_audio : {
         flash_server_url  : 'rtmp://flash.server.org/music',
         flash_file_prefix : 'mp3:flashprefix',
         http_file_prefix  : 'http://download.org',
         buffer_time : 3,
         type : 'audio'
       },
       live_audio : {
             mpr_news : {
                 flash_server_url : 'rtmp://flash.server.org/news',
                 flash_file_path : 'news.stream',
                 http_file_path : 'http://newsstream1.publicradio.org:80/',
                 buffer_time : 6,
                 type : 'live_audio'
             },
             mpr_current : {
                 flash_server_url : 'rtmp://flash.server.org/kcmp',
                 flash_file_path : 'kcmp.stream',
                 http_file_path : 'http://currentstream1.publicradio.org:80/',
                 buffer_time : 6,
                 type : 'live_audio'
             }
        }
    };
    custom_schemes.init(scheme_map);
    
    ** in this example above,
    ** a Playable w/ identifer 'apm_audio:/marketplace/2012/04/18/morning_report.mp3'
    ** would translate to:
    
    var playable = {
         identifier : 'apm_audio:/marketplace/2012/04/18/morning_report.mp3',
         flash_server_url  : 'rtmp://flash.server.org/music',
         flash_file_path : 'mp3:flashprefix/marketplace/2012/04/18/morning_report.mp3',
         http_file_path  : 'http://download.org/marketplace/2012/04/18/morning_report.mp3',
         buffer_time : 3,
         type : 'audio',
         // + all other attributes in a Playable, with defaults
    };
    
    while a Playable w/ identifer 'live_audio:/mpr_current' would translate to:
    var playable = {
         identifier : 'live_audio:/mpr_current',
         flash_server_url : 'rtmp://flash.server.org/kcmp',
         flash_file_path : 'kcmp.stream',
         http_file_path : 'http://currentstream1.publicradio.org:80/',
         buffer_time : 6,
         type : 'live_audio',
         // + all other attributes in a Playable, with defaults
    };
    Parameters:
    {Object} scheme_map object literal holding configuration, map of schemes-- each scheme can hold any number attributes that exist in Playable .. PLUS, the two below:
    {Object} scheme_map.flash_file_prefix prefix to be pre-pended to flash filepath when the Playable is instantiated.
    {Object} scheme_map.http_file_prefix prefix to be pre-pended to http filepath when the Playable is instantiated.