Songbird

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Songbird - Presentation Transcript

    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
    5. AOL (The Internet)
    6. CompuServe AOL (en larg ed 100 x) (The Internet)
    7. 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
    8. 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
    9. What can I do with it? Pros: Pretty much anything Cons: Pretty much anything
    10. Media Interaction • APIs for querying metadata • Controlling playback • Creating local and remote media items • Creating playlists • Observers/listeners • AJAX, and anything else “webby”
    11. Songbird Points of Integration Display Panes Media Views Faceplate Browser Areas
    12. Demo Time! (sorry for anyone viewing the PDF) just imagine a really compelling and cool demo (and then imagine me delivering it)
    13. mashTape Screenies (in case the network is teh suck)
    14. Last.fm Screenies (#@$()#*@ network)
    15. More Extension Screenies (pity about the network)
    16. The Songbird Library
    17. Adding an item // Get the library manager service var libraryManager = Components.classes[\"@songbirdnest.com/Songbird/library/Manager;1\"] .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[\"@mozilla.org/network/io-service;1\"] .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[\"@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1\"] .createInstance(Ci.sbIMutablePropertyArray); props.appendProperty(“http://whacked.net/#myWhizzyProperty, \"OMG! BEST SONG EVER!\"); // Add the song to the user’s library var mySong = mainLib.createMediaItem(songURI, props);
    18. 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’”);
    19. 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); }
    20. Managing Playback
    21. Media Core APIs
    22. Media Core APIs
    23. 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[\"@songbirdnest.com/Songbird/Mediacore/Manager;1\"] .getService(Components.interfaces.sbIMediacoreManager); • The central point for all media playback/event management • Most playback/sequence/control handled by .playbackControl or .sequencer
    24. 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(\"track changed to: \" + mediaItem.guid); break; case Ci.sbIMediacoreEvent.STREAM_END: alert(\"track has ended\"); break; case Ci.sbIMediacoreEvent.STREAM_STOP: alert(\"track was stopped\"); break; } } gMM.addListener(myListener);
    25. What’s going on?
    26. 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
    27. 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(\"resource://app/components/sbProperties.jsm\"); const SB_NewDataRemote = new Components.Constructor( \"@songbirdnest.com/Songbird/DataRemote;1\", \"sbIDataRemote\", \"init\"); var sbDataRemote = SB_NewDataRemote(“faceplate.playing”, null); sbDataRemote.bindObserver(myObserver, true);
    28. 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
    29. 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
    30. A Picture is Worth A Thousand Words
    31. Sparkle
    32. YABS (Yet Another Black Skin)
    33. Pure Player Medium Player Mini Player
    34. 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
    35. 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
    36. 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
    37. 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
    38. WebPlaylist Can be populated either automatically (i.e. via Songbird’s automatic scraping) or programmatically via Webpage API
    39. Current Media Player Activity <script type=”text/javascript”> function onLoad() { if (songbird.playing) { alert(“I love ” + songbird.currentArtist + “ too”); } } </script>
    40. 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(\"metadata.title\", obs); songbird.addListener(\"metadata.artist\", obs); songbird.addListener(\"metadata.album\", obs);
    41. 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
    42. 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
    43. Enumerate User Libraries var propArtist = \"http://songbirdnest.com/data/1.0#artistName\"; var listener = { onEnumerationBegin: function() { this.artists = new Object(); return true; }, onEnumeratedItem: function(list, item) { metadata = item.getProperty(propArtist); if ((metadata != null) && (metadata != '') && (metadata != '\\\"\\\"')) { 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(\"You have \" + this.artists[artist] + \" tracks by \" + artist); }
    44. List & Library Integration // Create a default site-specific library var library = songbird.siteLibrary; // Set the scope of the site library songbird.setSiteScope(\"whacked.net\", \"/music\"); // Create a media item and put it in the library var mediaItem = library.createMediaItem(\"http://whacked.net/music/wired-01.mp3\"); // Make a playlist var mediaList = library.createSimpleMediaList(\"TheWiredCD\"); 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);
    45. Download Event Monitoring var trackNameProp = \"http://songbirdnest.com/data/1.0#trackName\" function onDlStart(aEvent) { alert(aEvent.item.getProperty(trackNameProp) + \" started downloading\") } function onDlComplete(aEvent) { alert(aEvent.item.getProperty(trackNameProp) + \" finished downloading\"); alert(aEvent.status); } document.addEventListener(\"downloadstart\", onDlStart, false); document.addEventListener(\"downloadcomplete\", onDlComplete, false); songbird.downloadItem(mediaItem);
    46. • Get involved in mozilla Taiwan! • Localisation • Testing/QA • Development http://moztw.org
    47. 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
    48. 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
    49. 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/

    + Stephen LauStephen Lau, 7 months ago

    custom

    1286 views, 0 favs, 1 embeds more stats

    Introduction to Songbird, the open source desktop m more

    More info about this document

    CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

    Go to text version

    • Total Views 1286
      • 1285 on SlideShare
      • 1 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 37
    Most viewed embeds
    • 1 views on http://localhost

    more

    All embeds
    • 1 views on http://localhost

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories