SlideShare a Scribd company logo
1 of 60
Download to read offline
Songbird
                          Integrating Media & The Web




2009-04-19 Stephen Lau
stevel@songbirdnest.com
we        mozilla
     open standards
       open web
      open source
Songbird in One Slide
 • Cross platform media player
 • Built on Mozilla (XULRunner)
 • Customisable
    • Extensions
    • Skins Feathers
 • Open APIs
    • Client side via extensions
    • Web side via Webpage API
 • Desktop client, NOT a web service
What If....
      • You could only read your news from CNN
          • You could only buy Sony laptops
            • You could only buy BMW cars
• You could only browse the web with Internet Explorer

• You could only buy music from Apple’s iTunes Store
      • You could only sync with an Apple iPod
AOL




(The Internet)
CompuServe


                            AOL
(en
   larg
       ed
            100
               x)




                    (The Internet)
Extensions
• Just like Firefox
• Can be easily ported (in most cases)
• Many Firefox extensions already support Songbird
• Full access to all of Songbird’s APIs
• Examples:
   • Service Integration
   • Device Support
   • Media player functionality

• Easily integrate with the web:
  • Pull in web content
  • Push content up to the web
Mozilla Technologies & APIs
         (aka the buzzword & acronym slide)


AJAX, Canvas, CSS, DOM, E4X, HTML, JS, RDF
   RSS, SVG, XBL, XML, XPath, XSLT, XUL

     SpiderMonkey, Gecko, XULRunner
What can I do with it?
  Pros: Pretty much anything
  Cons: Pretty much anything
Media Interaction
• APIs for querying metadata
• Controlling playback
• Creating local and remote media items
• Creating playlists
• Observers/listeners
• AJAX, and anything else “webby”
Songbird Points of Integration
          Display Panes
           Media Views
            Faceplate
          Browser Areas
Demo Time!
        (sorry for anyone viewing the PDF)
just imagine a really compelling and cool demo
       (and then imagine me delivering it)
mashTape Screenies
   (in case the network is teh suck)
Last.fm Screenies
    (#@$()#*@ network)
More Extension Screenies
       (pity about the network)
The Songbird Library
Adding an item
// Get the library manager service
var libraryManager = Components.classes[quot;@songbirdnest.com/Songbird/library/Manager;1quot;]
                             .getService(Components.interfaces.sbILibraryManager);

// Get the user’s main library
var mainLib = libraryManager.mainLibrary;

// Need to construct an IO URI representing the actual resource (e.g. test.mp3)
var ioService = Components.classes[quot;@mozilla.org/network/io-service;1quot;]
                     .getService(Components.interfaces.nsIIOService);
var songURI = ioService.newURI(“http://whacked.net/test.mp3”, null, null);

// Set any properties we may want to set
var props = Components.classes[quot;@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1quot;]
                  .createInstance(Ci.sbIMutablePropertyArray);
props.appendProperty(“http://whacked.net/#myWhizzyProperty, quot;OMG! BEST SONG EVER!quot;);

// Add the song to the user’s library
var mySong = mainLib.createMediaItem(songURI, props);
Finding an item
// If you know the GUID....
var mySong = mainLib.getItemByGuid(“some_guid_here”);

// ... or you can get it by index in the list/library
var mySong = mainLib.getItemByIndex(42);

// ... or you can enumerate it by a property
var myListener = {
   items: [],
   onEnumerationBegin: function() { },
   onEnumeratedItem: function(list, item) {
       this.items.push(item);
   }
   onEnumerationEnd: function() { }
};

mainLib.enumerateItemsByProperty(“http://whacked.net/#myWhizzyProperty”,
    “OMG! BEST SONG EVER!”, myListener,
    Components.interfaces.sbIMediaList.ENUMERATIONTYPE_LOCKING);

alert(myListener.items.length + “ items found with ‘Some Arbitrary Value’”);
Removing an item
// ... from previous slide

// iterate through each item that matched our enumeration
for (mySong in myListener.items) {
    // remove it from the library
    mainLib.remove(mySong);
}
Managing Playback
Media Core APIs
Media Core APIs
Mediacore Manager
  IDL: http://src.songbirdnest.com/source/xref/client/components/mediacore/base/public/sbIMediacoreManager.idl
  API Reference: http://developer.songbirdnest.com/add-on-api/docs/trunk/interfacesb_i_mediacore_manager.html



• Get a reference to the Mediacore Manager:
 var gMM = Components.classes[quot;@songbirdnest.com/Songbird/Mediacore/Manager;1quot;]
                     .getService(Components.interfaces.sbIMediacoreManager);

• The central point for all media playback/event management
• Most playback/sequence/control handled by .playbackControl or .sequencer
Mediacore Manager
• Events:
   • sbIMediacoreEvent
   • http://developer.songbirdnest.com/add-on-api/docs/trunk/interfacesb_i_mediacore_event.html
   • Sample events: Metadata change, Duration change, Track change
   • Stream start, Stream End, etc.
• Add a listener:
           const Ci = Components.interfaces;
           var myListener = {
               onMediacoreEvent: function(ev) {
                   switch (ev.type) {
                       case Ci.sbIMediacoreEvent.TRACK_CHANGE:
                           var mediaItem = ev.data;
                           alert(quot;track changed to: quot; + mediaItem.guid);
                           break;
                       case Ci.sbIMediacoreEvent.STREAM_END:
                           alert(quot;track has endedquot;);
                           break;
                       case Ci.sbIMediacoreEvent.STREAM_STOP:
                           alert(quot;track was stoppedquot;);
                           break;
               }
           }
           gMM.addListener(myListener);
What’s going on?
Data Remotes
Asynchronously observe specific data remotes and trigger
   listeners based on data changes in the player, e.g.
                      • Track change
                    • Play/pause state
                 • Volume change/mute

                    What’s playing?
                    • metadata.title
                   • metadata.artist
                  • metadata.album
Data Remotes
                                          Example:
myObserver = {
  observe: function ( aSubject, aTopic, aData) {
    if (aTopic == “faceplate.playing” && aData == 1) {
         var mediaItem = gMM.sequencer.currentItem;
         var artist = mediaItem.getProperty(SBProperties.artistName);
         alert(artist + “? weren’t they a one-hit wonder?”);
    }
  }
}

Components.utils.import(quot;resource://app/components/sbProperties.jsmquot;);
const SB_NewDataRemote = new Components.Constructor(
          quot;@songbirdnest.com/Songbird/DataRemote;1quot;, quot;sbIDataRemotequot;, quot;initquot;);

var sbDataRemote = SB_NewDataRemote(“faceplate.playing”, null);
sbDataRemote.bindObserver(myObserver, true);
Songbird Audio Codec Architecture


                                                 Songbird



                                                                                       Songbird Media Cores

                                       X

                                                            Windows Media SDK
GStreamer                  Quicktime                                                       ...
                                  M4P*                                    WMA*


                                                                                           GStreamer Plugins



                       X
FLAC         Quicktime         DirectShow                      ACM               MP3             ...



             AAC               WMA                          MP3
                                                                                          ...    Extension points
                     MP3                   ...                      ...                *DRM protected formats
                                                                                           Windows only
              ...
                                                                                       X Mac only
                                                                                           Linux only
                                                             ACM Codecs
              QT Plugins       DShow Codecs
Feathers
• Customise Songbird’s appearance
• CSS, XUL
• Use Web technologies:
   • Flash
   • SVG
   • Canvas
• Simple to customise: You don’t have to
  be a developer to make a Feather
A Picture is Worth A Thousand Words
Sparkle
YABS (Yet Another Black Skin)
Pure Player



Medium Player


 Mini Player
Webpage API
• Javascript’able interactions with Songbird
• Integrate into user’s media player
• Build your site, not a media player
• Observe and interact with Songbird’s
  media functionality
What can I do with it?
• Query what’s currently playing
• Attach asynchronous listeners/observers
  to media player actions
• Enumerate and observe user library
• Build site-local libraries and playlists
• Download playlists and items to the
  user’s main library
What’s happening right this minute
       Metadata on the currently playing track:
          • songbird.currentArtist
          • songbird.currentTrack
          • songbird.currentAlbum

       Current activity and state:
          • songbird.playing
          • songbird.paused
          • songbird.repeat
          • songbird.shuffle
          • songbird.position
          • songbird.volume
          • songbird.mute

       Synchronous and asynchronous observers
List & Library Integration
• Use lists to represent playlists, or conceptual lists:
        • Shopping cart
        • Favourite songs/tracks
        • Recommended tracks (“You might also like...”)
        • Relevant songs (“Other people who bought also bought...”)

• Playback main library (e.g. the user’s) lists
• Playback site library (e.g. local to the website) lists
       • Remote playlists, e.g. .m3u, .pls
       • Playlists built programmatically using the Webpage API

• Download lists and individual media items to the user’s library
WebPlaylist
Can be populated either automatically (i.e. via Songbird’s automatic scraping)
                  or programmatically via Webpage API
Current Media Player Activity

<script type=”text/javascript”>
function onLoad() {
    if (songbird.playing) {
        alert(“I love ” + songbird.currentArtist + “ too”);
    }
}
</script>
Observing Your Media Player
var obs = {
    observe: function ( aSubject, aTopic, aData) {
         if (aTopic == “metadata.artist”) {
              alert(“Current artist:” + aData);
         } else if (aTopic == “metadata.album”) {
              alert(“Current album:” + aData);
         } else if (aTopic == “metadata.title”) {
              alert(“Current track:” + aData);
         }
    }
}

songbird.addListener(quot;metadata.titlequot;, obs);
songbird.addListener(quot;metadata.artistquot;, obs);
songbird.addListener(quot;metadata.albumquot;, obs);
Observing Your Media Player
          More asynchronous events:

              downloadstart
            downloadcomplete

   Fired when Songbird downloads triggered
    by Library integration APIs (covered later)
            are initiated or completed

            beforetrackchange
               trackchange
              playerstopped

    Fired when media track events happen.

   event.item argument is the mediaItem
Enumerate User Libraries
User library:
   • mediaItems (represent items/tracks)
   • mediaLists (ordered lists of mediaItems)
   • mediaLibraries (unordered collection of mediaItems & lists)

   • songbird.mainLibrary
       • .createMediaItem()
       • .createSimpleMediaList()
       • .getPlaylists()
       • .getItemByGuid()
       • .enumerateAllItems()
       • .enumerateItemsByProperty()

       • http://developer.songbirdnest.com/webpage-api/docs/files/
         trunk/sbIRemoteLibrary-idl.html#Library
Enumerate User Libraries
var propArtist = quot;http://songbirdnest.com/data/1.0#artistNamequot;;
var listener = {
    onEnumerationBegin: function() {
        this.artists = new Object();
        return true;
    },
    onEnumeratedItem: function(list, item) {
        metadata = item.getProperty(propArtist);
        if ((metadata != null) && (metadata != '') && (metadata != 'quot;quot;')) {
            if (this.artists[metadata])
                 this.artists[metadata]++;
            else
                 this.artists[metadata] = 1;
        }
        return true;
    },
    onEnumerationEnd: function() {
        return true;
    }
};

var mainlib = songbird.mainLibrary;
songbird.mainLibrary.enumerateAllItems(listener, 0);
for (artist in listener.artists) {
    alert(quot;You have quot; + this.artists[artist] + quot; tracks by quot; + artist);
}
List & Library Integration
// Create a default site-specific library
var library = songbird.siteLibrary;

// Set the scope of the site library
songbird.setSiteScope(quot;whacked.netquot;, quot;/musicquot;);

// Create a media item and put it in the library
var mediaItem = library.createMediaItem(quot;http://whacked.net/music/wired-01.mp3quot;);

// Make a playlist
var mediaList = library.createSimpleMediaList(quot;TheWiredCDquot;);
mediaList.add(mediaItem);

// Let's be obnoxious and play it, whether the user requested it or not
songbird.playMediaList(mediaList);

// I'm sure the user loved it so much - let's integrate it into their library for them
songbird.downloadItem(mediaItem);
Download Event Monitoring
var trackNameProp = quot;http://songbirdnest.com/data/1.0#trackNamequot;
function onDlStart(aEvent) {
    alert(aEvent.item.getProperty(trackNameProp) +
        quot; started downloadingquot;)
}
function onDlComplete(aEvent) {
    alert(aEvent.item.getProperty(trackNameProp) +
        quot; finished downloadingquot;);
    alert(aEvent.status);
}

document.addEventListener(quot;downloadstartquot;, onDlStart, false);
document.addEventListener(quot;downloadcompletequot;, onDlComplete, false);

songbird.downloadItem(mediaItem);
• Get involved in mozilla Taiwan!
         • Localisation
         • Testing/QA
         • Development
         http://moztw.org
Upcoming Events!


• Mozilla Firefox 3.5 New Developer Features: Overview
• 04/28 @ 19:00-21:00                      Tim G.T. Chien
• http://go2.tw/moztwfirefox35

• JavaScript in Firefox (1)
• 05/05 @ 19:00-22:00                              (othree)
• http://go2.tw/moztw5extprea

• JavaScript in Firefox (2)
• 05/07 @ 19:00-22:00                             (othree)
• http:/go2.tw/moztw5extpreb

• Firefox Extension Development (1)
• 05/09 @ 09:00-17:00                             (Littelbtc)
• http:/go2.tw/moztw5exta

• Firefox Extension Development (2)
• 05/23 @ 09:00-17:00                             (Littelbtc)
• http:/go2.tw/moztw5extb
Thanks!
           IRC:
           •irc://irc.mozilla.org/#songbird

           Developer List:
           • http://groups.google.com/group/songbird-dev

           User Support:
           • http://getsatisfaction.com/songbird




Stephen Lau (stevel@songbirdnest.com)
http://whacked.net
Copyright 2009 Pioneers of the Inevitable, Inc. Some rights reserved.

  All trademarks and logos are properties of their respective owners. Any use of non-POTI
trademarks or logos should not be construed as endorsement of or by Songbird or POTI, Inc.

                       This presentation is licensed under the
    Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
                http://creativecommons.org/licenses/by-nc-sa/3.0/




            Cloud photo by saital: http://flickr.com/photos/saital/17949827/

More Related Content

Similar to Songbird

Criando jogos para o windows 8
Criando jogos para o windows 8Criando jogos para o windows 8
Criando jogos para o windows 8José Farias
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Androidnatdefreitas
 
Towards a Framework for the Composition & Performance of Real-Time Notation
Towards a Framework for the Composition & Performance of Real-Time NotationTowards a Framework for the Composition & Performance of Real-Time Notation
Towards a Framework for the Composition & Performance of Real-Time Notationchrismcclelland
 
WebRTC Browsers n Stacks Implementation differences
WebRTC Browsers n Stacks Implementation differencesWebRTC Browsers n Stacks Implementation differences
WebRTC Browsers n Stacks Implementation differencesAlexandre Gouaillard
 
Prasentation Managed DirectX
Prasentation Managed DirectXPrasentation Managed DirectX
Prasentation Managed DirectXA. LE
 
Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222Minko3D
 
Creating Flash Content for Multiple Screens
Creating Flash Content for Multiple ScreensCreating Flash Content for Multiple Screens
Creating Flash Content for Multiple Screenspaultrani
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Audio and Video streaming.ppt
Audio and Video streaming.pptAudio and Video streaming.ppt
Audio and Video streaming.pptVideoguy
 
Web MIDI API - the paster, the present, and the future -
Web MIDI API - the paster, the present, and the future -Web MIDI API - the paster, the present, and the future -
Web MIDI API - the paster, the present, and the future -Takashi Toyoshima
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http acceleratorno no
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAguest4c923d
 
Linux & Open Source - Alternative Software
Linux & Open Source - Alternative SoftwareLinux & Open Source - Alternative Software
Linux & Open Source - Alternative SoftwareSebastiano Merlino (eTr)
 

Similar to Songbird (20)

Criando jogos para o windows 8
Criando jogos para o windows 8Criando jogos para o windows 8
Criando jogos para o windows 8
 
Web &amp; sound
Web &amp; soundWeb &amp; sound
Web &amp; sound
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Towards a Framework for the Composition & Performance of Real-Time Notation
Towards a Framework for the Composition & Performance of Real-Time NotationTowards a Framework for the Composition & Performance of Real-Time Notation
Towards a Framework for the Composition & Performance of Real-Time Notation
 
WebRTC Browsers n Stacks Implementation differences
WebRTC Browsers n Stacks Implementation differencesWebRTC Browsers n Stacks Implementation differences
WebRTC Browsers n Stacks Implementation differences
 
Prasentation Managed DirectX
Prasentation Managed DirectXPrasentation Managed DirectX
Prasentation Managed DirectX
 
Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222
 
Titanium Desktop Intro
Titanium Desktop IntroTitanium Desktop Intro
Titanium Desktop Intro
 
Creating Flash Content for Multiple Screens
Creating Flash Content for Multiple ScreensCreating Flash Content for Multiple Screens
Creating Flash Content for Multiple Screens
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Audio and Video streaming.ppt
Audio and Video streaming.pptAudio and Video streaming.ppt
Audio and Video streaming.ppt
 
Scmad Chapter13
Scmad Chapter13Scmad Chapter13
Scmad Chapter13
 
Flash 101
Flash 101Flash 101
Flash 101
 
Web MIDI API - the paster, the present, and the future -
Web MIDI API - the paster, the present, and the future -Web MIDI API - the paster, the present, and the future -
Web MIDI API - the paster, the present, and the future -
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISA
 
Linux & Open Source - Alternative Software
Linux & Open Source - Alternative SoftwareLinux & Open Source - Alternative Software
Linux & Open Source - Alternative Software
 

Recently uploaded

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

Songbird

  • 1. Songbird Integrating Media & The Web 2009-04-19 Stephen Lau stevel@songbirdnest.com
  • 2. we mozilla open standards open web open source
  • 3. Songbird in One Slide • Cross platform media player • Built on Mozilla (XULRunner) • Customisable • Extensions • Skins Feathers • Open APIs • Client side via extensions • Web side via Webpage API • Desktop client, NOT a web service
  • 4. What If.... • You could only read your news from CNN • You could only buy Sony laptops • You could only buy BMW cars • You could only browse the web with Internet Explorer • You could only buy music from Apple’s iTunes Store • You could only sync with an Apple iPod
  • 6. CompuServe AOL (en larg ed 100 x) (The Internet)
  • 7.
  • 8. Extensions • Just like Firefox • Can be easily ported (in most cases) • Many Firefox extensions already support Songbird • Full access to all of Songbird’s APIs • Examples: • Service Integration • Device Support • Media player functionality • Easily integrate with the web: • Pull in web content • Push content up to the web
  • 9. Mozilla Technologies & APIs (aka the buzzword & acronym slide) AJAX, Canvas, CSS, DOM, E4X, HTML, JS, RDF RSS, SVG, XBL, XML, XPath, XSLT, XUL SpiderMonkey, Gecko, XULRunner
  • 10. What can I do with it? Pros: Pretty much anything Cons: Pretty much anything
  • 11. Media Interaction • APIs for querying metadata • Controlling playback • Creating local and remote media items • Creating playlists • Observers/listeners • AJAX, and anything else “webby”
  • 12. Songbird Points of Integration Display Panes Media Views Faceplate Browser Areas
  • 13. Demo Time! (sorry for anyone viewing the PDF) just imagine a really compelling and cool demo (and then imagine me delivering it)
  • 14. mashTape Screenies (in case the network is teh suck)
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. Last.fm Screenies (#@$()#*@ network)
  • 21.
  • 22.
  • 23. More Extension Screenies (pity about the network)
  • 24.
  • 25.
  • 27. Adding an item // Get the library manager service var libraryManager = Components.classes[quot;@songbirdnest.com/Songbird/library/Manager;1quot;] .getService(Components.interfaces.sbILibraryManager); // Get the user’s main library var mainLib = libraryManager.mainLibrary; // Need to construct an IO URI representing the actual resource (e.g. test.mp3) var ioService = Components.classes[quot;@mozilla.org/network/io-service;1quot;] .getService(Components.interfaces.nsIIOService); var songURI = ioService.newURI(“http://whacked.net/test.mp3”, null, null); // Set any properties we may want to set var props = Components.classes[quot;@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1quot;] .createInstance(Ci.sbIMutablePropertyArray); props.appendProperty(“http://whacked.net/#myWhizzyProperty, quot;OMG! BEST SONG EVER!quot;); // Add the song to the user’s library var mySong = mainLib.createMediaItem(songURI, props);
  • 28. Finding an item // If you know the GUID.... var mySong = mainLib.getItemByGuid(“some_guid_here”); // ... or you can get it by index in the list/library var mySong = mainLib.getItemByIndex(42); // ... or you can enumerate it by a property var myListener = { items: [], onEnumerationBegin: function() { }, onEnumeratedItem: function(list, item) { this.items.push(item); } onEnumerationEnd: function() { } }; mainLib.enumerateItemsByProperty(“http://whacked.net/#myWhizzyProperty”, “OMG! BEST SONG EVER!”, myListener, Components.interfaces.sbIMediaList.ENUMERATIONTYPE_LOCKING); alert(myListener.items.length + “ items found with ‘Some Arbitrary Value’”);
  • 29. Removing an item // ... from previous slide // iterate through each item that matched our enumeration for (mySong in myListener.items) { // remove it from the library mainLib.remove(mySong); }
  • 33. Mediacore Manager IDL: http://src.songbirdnest.com/source/xref/client/components/mediacore/base/public/sbIMediacoreManager.idl API Reference: http://developer.songbirdnest.com/add-on-api/docs/trunk/interfacesb_i_mediacore_manager.html • Get a reference to the Mediacore Manager: var gMM = Components.classes[quot;@songbirdnest.com/Songbird/Mediacore/Manager;1quot;] .getService(Components.interfaces.sbIMediacoreManager); • The central point for all media playback/event management • Most playback/sequence/control handled by .playbackControl or .sequencer
  • 34. Mediacore Manager • Events: • sbIMediacoreEvent • http://developer.songbirdnest.com/add-on-api/docs/trunk/interfacesb_i_mediacore_event.html • Sample events: Metadata change, Duration change, Track change • Stream start, Stream End, etc. • Add a listener: const Ci = Components.interfaces; var myListener = { onMediacoreEvent: function(ev) { switch (ev.type) { case Ci.sbIMediacoreEvent.TRACK_CHANGE: var mediaItem = ev.data; alert(quot;track changed to: quot; + mediaItem.guid); break; case Ci.sbIMediacoreEvent.STREAM_END: alert(quot;track has endedquot;); break; case Ci.sbIMediacoreEvent.STREAM_STOP: alert(quot;track was stoppedquot;); break; } } gMM.addListener(myListener);
  • 36. Data Remotes Asynchronously observe specific data remotes and trigger listeners based on data changes in the player, e.g. • Track change • Play/pause state • Volume change/mute What’s playing? • metadata.title • metadata.artist • metadata.album
  • 37. Data Remotes Example: myObserver = { observe: function ( aSubject, aTopic, aData) { if (aTopic == “faceplate.playing” && aData == 1) { var mediaItem = gMM.sequencer.currentItem; var artist = mediaItem.getProperty(SBProperties.artistName); alert(artist + “? weren’t they a one-hit wonder?”); } } } Components.utils.import(quot;resource://app/components/sbProperties.jsmquot;); const SB_NewDataRemote = new Components.Constructor( quot;@songbirdnest.com/Songbird/DataRemote;1quot;, quot;sbIDataRemotequot;, quot;initquot;); var sbDataRemote = SB_NewDataRemote(“faceplate.playing”, null); sbDataRemote.bindObserver(myObserver, true);
  • 38. Songbird Audio Codec Architecture Songbird Songbird Media Cores X Windows Media SDK GStreamer Quicktime ... M4P* WMA* GStreamer Plugins X FLAC Quicktime DirectShow ACM MP3 ... AAC WMA MP3 ... Extension points MP3 ... ... *DRM protected formats Windows only ... X Mac only Linux only ACM Codecs QT Plugins DShow Codecs
  • 39. Feathers • Customise Songbird’s appearance • CSS, XUL • Use Web technologies: • Flash • SVG • Canvas • Simple to customise: You don’t have to be a developer to make a Feather
  • 40. A Picture is Worth A Thousand Words
  • 42. YABS (Yet Another Black Skin)
  • 44. Webpage API • Javascript’able interactions with Songbird • Integrate into user’s media player • Build your site, not a media player • Observe and interact with Songbird’s media functionality
  • 45. What can I do with it? • Query what’s currently playing • Attach asynchronous listeners/observers to media player actions • Enumerate and observe user library • Build site-local libraries and playlists • Download playlists and items to the user’s main library
  • 46. What’s happening right this minute Metadata on the currently playing track: • songbird.currentArtist • songbird.currentTrack • songbird.currentAlbum Current activity and state: • songbird.playing • songbird.paused • songbird.repeat • songbird.shuffle • songbird.position • songbird.volume • songbird.mute Synchronous and asynchronous observers
  • 47. List & Library Integration • Use lists to represent playlists, or conceptual lists: • Shopping cart • Favourite songs/tracks • Recommended tracks (“You might also like...”) • Relevant songs (“Other people who bought also bought...”) • Playback main library (e.g. the user’s) lists • Playback site library (e.g. local to the website) lists • Remote playlists, e.g. .m3u, .pls • Playlists built programmatically using the Webpage API • Download lists and individual media items to the user’s library
  • 48. WebPlaylist Can be populated either automatically (i.e. via Songbird’s automatic scraping) or programmatically via Webpage API
  • 49.
  • 50. Current Media Player Activity <script type=”text/javascript”> function onLoad() { if (songbird.playing) { alert(“I love ” + songbird.currentArtist + “ too”); } } </script>
  • 51. Observing Your Media Player var obs = { observe: function ( aSubject, aTopic, aData) { if (aTopic == “metadata.artist”) { alert(“Current artist:” + aData); } else if (aTopic == “metadata.album”) { alert(“Current album:” + aData); } else if (aTopic == “metadata.title”) { alert(“Current track:” + aData); } } } songbird.addListener(quot;metadata.titlequot;, obs); songbird.addListener(quot;metadata.artistquot;, obs); songbird.addListener(quot;metadata.albumquot;, obs);
  • 52. Observing Your Media Player More asynchronous events: downloadstart downloadcomplete Fired when Songbird downloads triggered by Library integration APIs (covered later) are initiated or completed beforetrackchange trackchange playerstopped Fired when media track events happen. event.item argument is the mediaItem
  • 53. Enumerate User Libraries User library: • mediaItems (represent items/tracks) • mediaLists (ordered lists of mediaItems) • mediaLibraries (unordered collection of mediaItems & lists) • songbird.mainLibrary • .createMediaItem() • .createSimpleMediaList() • .getPlaylists() • .getItemByGuid() • .enumerateAllItems() • .enumerateItemsByProperty() • http://developer.songbirdnest.com/webpage-api/docs/files/ trunk/sbIRemoteLibrary-idl.html#Library
  • 54. Enumerate User Libraries var propArtist = quot;http://songbirdnest.com/data/1.0#artistNamequot;; var listener = { onEnumerationBegin: function() { this.artists = new Object(); return true; }, onEnumeratedItem: function(list, item) { metadata = item.getProperty(propArtist); if ((metadata != null) && (metadata != '') && (metadata != 'quot;quot;')) { if (this.artists[metadata]) this.artists[metadata]++; else this.artists[metadata] = 1; } return true; }, onEnumerationEnd: function() { return true; } }; var mainlib = songbird.mainLibrary; songbird.mainLibrary.enumerateAllItems(listener, 0); for (artist in listener.artists) { alert(quot;You have quot; + this.artists[artist] + quot; tracks by quot; + artist); }
  • 55. List & Library Integration // Create a default site-specific library var library = songbird.siteLibrary; // Set the scope of the site library songbird.setSiteScope(quot;whacked.netquot;, quot;/musicquot;); // Create a media item and put it in the library var mediaItem = library.createMediaItem(quot;http://whacked.net/music/wired-01.mp3quot;); // Make a playlist var mediaList = library.createSimpleMediaList(quot;TheWiredCDquot;); mediaList.add(mediaItem); // Let's be obnoxious and play it, whether the user requested it or not songbird.playMediaList(mediaList); // I'm sure the user loved it so much - let's integrate it into their library for them songbird.downloadItem(mediaItem);
  • 56. Download Event Monitoring var trackNameProp = quot;http://songbirdnest.com/data/1.0#trackNamequot; function onDlStart(aEvent) { alert(aEvent.item.getProperty(trackNameProp) + quot; started downloadingquot;) } function onDlComplete(aEvent) { alert(aEvent.item.getProperty(trackNameProp) + quot; finished downloadingquot;); alert(aEvent.status); } document.addEventListener(quot;downloadstartquot;, onDlStart, false); document.addEventListener(quot;downloadcompletequot;, onDlComplete, false); songbird.downloadItem(mediaItem);
  • 57. • Get involved in mozilla Taiwan! • Localisation • Testing/QA • Development http://moztw.org
  • 58. Upcoming Events! • Mozilla Firefox 3.5 New Developer Features: Overview • 04/28 @ 19:00-21:00 Tim G.T. Chien • http://go2.tw/moztwfirefox35 • JavaScript in Firefox (1) • 05/05 @ 19:00-22:00 (othree) • http://go2.tw/moztw5extprea • JavaScript in Firefox (2) • 05/07 @ 19:00-22:00 (othree) • http:/go2.tw/moztw5extpreb • Firefox Extension Development (1) • 05/09 @ 09:00-17:00 (Littelbtc) • http:/go2.tw/moztw5exta • Firefox Extension Development (2) • 05/23 @ 09:00-17:00 (Littelbtc) • http:/go2.tw/moztw5extb
  • 59. Thanks! IRC: •irc://irc.mozilla.org/#songbird Developer List: • http://groups.google.com/group/songbird-dev User Support: • http://getsatisfaction.com/songbird Stephen Lau (stevel@songbirdnest.com) http://whacked.net
  • 60. Copyright 2009 Pioneers of the Inevitable, Inc. Some rights reserved. All trademarks and logos are properties of their respective owners. Any use of non-POTI trademarks or logos should not be construed as endorsement of or by Songbird or POTI, Inc. This presentation is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License http://creativecommons.org/licenses/by-nc-sa/3.0/ Cloud photo by saital: http://flickr.com/photos/saital/17949827/