sbIRemotePlayer.idl
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
31 #include "nsISupports.idl"
32 
33 interface nsISimpleEnumerator;
34 interface nsIURI;
35 interface sbIMediaItem;
36 interface sbIMediaListView;
37 interface sbIRemoteCommands;
38 interface sbIRemoteLibrary;
39 interface sbIRemoteMediaList;
40 interface sbIRemoteObserver;
41 interface sbIRemoteWebPlaylist;
42 
43 /*
44 Class: Songbird
45 
46 The Songbird object provides several pieces of functionality to your web page: playback,
47 download, listener adding and removing and library creation and retrieval.
48 
49 This object provides you with functions that enable you to initiate playback
50 of URL's, <MediaLists> and <WebPlaylists>. Basic playback control functions are also
51 provided.
52 
53 The Songbird object provides download functionality as well. You may use it to download
54 <MediaItems>, <MediaLists> and user selected items present in the <WebPlaylist>.
55 
56 You may listen for download events by adding "downloadstart" or
57 "downloadcomplete" event listeners to the document object. These events will
58 only be sent to handlers within the scope of the page that originated the
59 downloaded items. The event listener is provided the downloaded media item
60 within the main Songbird library. To access the media item properties, the user
61 must have enabled remote access to the main Songbird library.
62 
63 The Songbird object is accessible (from Javascript) using the "songbird" global variable attached
64 to the currently loaded document. See the example below.
65 
66 Example:
67 (start code)
68 <script>
69 //Get the currently playing artist.
70 var artist = songbird.currentArtist;
71 
72 //Create default library with current domain and path automatically guessed.
73 //This is the suggested way to create your site library.
74 var library = songbird.siteLibrary;
75 
76 // Look up the artist in your web service database
77 // ...
78 
79 //Create a media item from a file
80 var mediaItem = library.createMediaItem("http://mirrors.creativecommons.org/ccmixter/contrib/Wired/David%20Byrne%20-%20My%20Fair%20Lady.mp3");
81 
82 //Create a simple media list.
83 var mediaList = library.createSimpleMediaList("PlaylistName");
84 
85 //Add a mediaitem to it.
86 mediaList.add(mediaItem);
87 
88 //Play it.
89 songbird.playMediaList(mediaList, 0);
90 
91 //You may also want to trigger a download to the users machine, for this mediaitem.
92 function onDownloadComplete(aEvent) {
93  // The event item is the one in the user's main library.
94  alert(aEvent.item.guid);
95  alert(aEvent.status);
96 }
97 document.addEventListener("downloadcomplete", onDownloadComplete, false);
98 songbird.downloadItem(mediaItem);
99 </script>
100 (end)
101 
102 See Also:
103  For more information about the <MediaItem> object, see the <MediaItem> reference.
104  For more information about the <MediaList> object, see the <MediaList> reference.
105  For more information about the <WebPlaylist> object, see the <WebPlaylist> reference.
106 */
114 [scriptable, uuid(91a57ebd-65e4-4320-84a1-fa0f6f74af15)]
116 {
117 
118  /*
119  Group: Methods
120  */
121 
127  /*
128  Func: supportsVersion
129 
130  Convenience method to see if the requested API version
131  is supported.
132 
133  Prototype:
134  boolean supportsVersion(String apiVersion)
135 
136  Parameters:
137  apiVersion - A string representing the API version requested (eg. '1.2').
138  */
139  boolean supportsVersion(in AString aAPIVersion);
140 
141  /*
142  Group: Properties
143  */
144 
149  /*
150  Prop: apiVersionMajor
151 
152  The major API version (eg. 1).
153 
154  Type:
155  integer
156  */
157  readonly attribute unsigned long apiVersionMajor;
158 
163  /*
164  Prop: apiVersionMinor
165 
166  The minor API version.
167 
168  Type:
169  integer
170  */
171  readonly attribute unsigned long apiVersionMinor;
172 
177  /*
178  Prop: name
179 
180  The name of the player.
181 
182  Type:
183  String
184  */
185  readonly attribute AString name;
186 
191  /*
192  Prop: currentArtist
193 
194  The name of the artist for the currently playing track.
195 
196  Type:
197  String
198  */
199  readonly attribute AString currentArtist;
200 
205  /*
206  Prop: currentAlbum
207 
208  The name of the album for the currently playing media item.
209 
210  Type:
211  String
212  */
213  readonly attribute AString currentAlbum;
214 
219  /*
220  Prop: currentTrack
221 
222  The track name of the currently playing media item.
223 
224  Type:
225  String
226  */
227  readonly attribute AString currentTrack;
228 
236  /*
237  Prop: playing
238 
239  This is the playing state of the application. If stopped this will be false,
240  otherwise this will be true. If the application is paused this will be true
241  so for a complete status you need to check the paused state as well.
242 
243  Type:
244  boolean
245  */
246  readonly attribute boolean playing;
247 
255  /*
256  Prop: paused
257 
258  This is the pause state of the application. This will be true if the
259  application has been paused during playback. It will be false if not
260  paused or stopped.
261 
262  Type:
263  boolean
264  */
265  readonly attribute boolean paused;
266 
276  /*
277  Prop: repeat
278 
279  The repeat state for playback. This can be one of three values:
280  0 - no repeat
281  1 - repeat the current track forever
282  2 - repeat the current playlist forever
283 
284  Type:
285  integer
286  */
287  readonly attribute long long repeat;
288 
295  /*
296  Prop: shuffle
297 
298  The shuffle state for playback. This will be true if shuffle is enabled,
299  false otherwise.
300 
301  Type:
302  boolean
303  */
304  readonly attribute boolean shuffle;
305 
310  /*
311  Prop: position
312 
313  The location of playback within the current media, in milliseconds. The position
314  will be 0 when there is no media currently playing.
315 
316  Type:
317  integer
318  */
319  attribute long long position;
320 
325  /*
326  Prop: duration
327 
328  The duration of the current media, in milliseconds. The duration may
329  be 0 if it cannot be determined or there is no media currently playing.
330 
331  Type:
332  integer
333  */
334  readonly attribute unsigned long long duration;
335 
340  /*
341  Prop: volume
342 
343  The volume of the application on a range from 0 to 255.
344 
345  Type:
346  integer
347  */
348  readonly attribute long long volume;
349 
356  /*
357  Prop: mute
358 
359  True if muted or the volume is set to 0, false otherwise
360 
361  Type:
362  boolean
363  */
364  readonly attribute boolean mute;
365 
370  /*
371  Prop: commands
372 
373  The collection of <Commands> associated with the current page.
374 
375  Type:
376  <Commands>
377  */
378  readonly attribute sbIRemoteCommands commands;
379 
384  /*
385  Prop: webPlaylist
386 
387  The current <WebPlaylist> object associated with this <Player> instance.
388 
389  Type:
390  <WebPlaylist>
391  */
392  readonly attribute sbIRemoteWebPlaylist webPlaylist;
393 
394 /*
395  Prop: mainLibrary
396 
397  The main <Library> for Songbird. This will contain all the <MediaItem>s the
398  user has on their system.
399 
400  Type:
401  <Library>
402 
403  Example:
404  (start code)
405  var mainLib = songbird.mainLibrary;
406  (end code)
407 
408  See Also:
409  <webLibrary>
410  <libraries()>
411  <siteLibrary>
412  */
413  readonly attribute sbIRemoteLibrary mainLibrary;
414 
415  /*
416  Prop: webLibrary
417 
418  The web <Library> for Songbird. This will contain all the <MediaItem>s that
419  have been discovered on web pages the user has visited.
420 
421  Type:
422  <Library>
423 
424  Example:
425  (start code)
426  var webLib = songbird.webLibrary;
427  (end code)
428 
429  See Also:
430  <mainLibrary>
431  <libraries()>
432  <siteLibrary>
433  */
434  readonly attribute sbIRemoteLibrary webLibrary;
435 
436  /*
437  Prop: siteLibrary
438 
439  Access to a sitelibrary for the current scope (domain and path). If you wish to
440  change the scope, use <setSiteScope()>.
441 
442  If a library was already created for the scope, the existing library will be returned.
443 
444  Type:
445  <Library>
446 
447  Example:
448  (start code)
449  //Access your site library
450  var library = songbird.siteLibrary;
451  (end)
452 
453  See Also:
454  <setSiteScope()>
455  */
456  readonly attribute sbIRemoteLibrary siteLibrary;
457 
458 
462  /*
463  Prop: downloadMediaList
464 
465  This <MediaList> is the list that gets all the <MediaItems>s that get
466  added throught the 3 download methods. If the user has enabled downloading,
467  tracks can be added to this playlist directly in order to begin downloads.
468 
469  Type:
470  <MediaList>
471 
472  Example:
473  (start code)
474  // Get the download media list
475  var dlList = songbird.downloadMediaList;
476  (end)
477 
478  See Also:
479  <downloadItem()>
480  <downloadList()>
481  <downloadSelected()>
482  */
483 
485 
486  /*
487  Group: Methods
488  */
489 
493  /*
494  Method: addListener()
495 
496  Add a listener to get notified of changes to Songbird metadata and state.
497 
498  Prototype:
499  addListener(String key, Object listener)
500 
501  Parameters:
502  key - The key for the metadata or state value.
503  listener - The listener that will get called when the metadata or state value specified by the key changes.
504 
505  Example:
506  (start code)
507  //Make a listener object. The listener must always have at least this function.
508 
509  //You may add any number of functions and properties to it for your own use.
510 
511  //Make sure to save this object somewhere so you may unregister it when you are done
512  //listening for changes.
513  var listener = {
514  observe: function(key, value) {
515  // Key is the metadata key
516  // Value is the current value of the metadata for the registered key
517  }
518  }
519 
520  var key = "metadata.genre";
521 
522  songbird.addListener(key, listener);
523 
524  ...
525 
526  songbird.removeListener(key, listener);
527  (end)
528 
529  See Also:
530  <removeListener()>
531 
532  Visit <Listener Topics> for a list of keys for metadata and state.
533 
534  Visit <http://www.xulplanet.com/references/xpcomref/ifaces/nsIObserver.html> for nsIObserver interface reference.
535  */
536  void addListener( in AString aKey,
537  in sbIRemoteObserver aObserver );
538 
543  /*
544  Method: removeListener()
545 
546  Remove a listener that was previously added using <addListener>.
547 
548  Prototype:
549  removeListener(String key, Object listener)
550 
551  Parameters:
552  key - The key for the metadata or state value.
553  listener - The listener that was previously added using <addListener>.
554 
555  Example:
556  (start code)
557  //This example assumes there was a listener object named 'listener' that was previously
558  //created and added using the key 'metadata.genre'.
559 
560  ...
561 
562  var key = "metadata.genre";
563  songbird.removeListener(key, listener);
564  (end)
565 
566  See Also:
567  <addListener()>
568  */
569  void removeListener( in AString aKey,
570  in sbIRemoteObserver aObserver );
571 
575  /*
576  Method: downloadItem()
577 
578  Download a <MediaItem>. <MediaList>s and <Library>ies not allowed.
579 
580  Prototype:
581  downloadItem(<MediaItem> mediaItem)
582 
583  Parameters:
584  mediaItem - The <MediaItem> to download.
585 
586  Example:
587  (start code)
588  //Create or get library.
589  var library = songbird.siteLibrary("", "");
590 
591  //Create the mediaitem.
592  var mediaItem = library.createMediaItem("http://path/to/item.mp3");
593 
594  //Download the mediaitem to the users local machine.
595  songbird.downloadItem(mediaItem);
596  (end)
597 
598  See Also:
599  <downloadList()>
600  <downloadSelected()>
601  */
602  void downloadItem( in sbIMediaItem aItem );
603 
608  /*
609  Method: downloadList()
610 
611  Download a <MediaList>. As <Library>ies are <MediaList>s they are
612  allowed here.
613 
614  Prototype:
615  downloadList(<MediaList> mediaList)
616 
617  Parameters:
618  mediaList - The <MediaList> to download.
619 
620  Example:
621  (start code)
622  //Create or get site library.
623  var library = songbird.siteLibrary("", "");
624 
625  //Create mediaitem.
626  var mediaItem = library.createMediaItem("http://path/to/item.mp3");
627 
628  //Create medialist to download.
629  var mediaList = library.createSimpleMediaList("Name of List");
630 
631  //Add item to medialist.
632  mediaList.add(mediaItem);
633 
634  //Download the medialist.
635  songbird.downloadList(mediaList);
636  (end)
637 
638  See Also:
639  <downloadItem()>
640  <downloadSelected()>
641  */
642  void downloadList( in sbIRemoteMediaList aList );
643 
648  /*
649  Method: downloadSelected()
650 
651  Download the <MediaItems> selected by the user in a <WebPlaylist>.
652 
653  Prototype:
654  downloadSelected(<WebPlaylist> webPlaylist)
655 
656  Parameters:
657  webPlaylist - The <WebPlaylist> from which to download the selected <MediaItems>.
658 
659  Example:
660  (start code)
661  //Download the mediaitems currently selected by the user in
662  //the current webplaylist.
663 
664  songbird.downloadSelected(songbird.webPlaylist);
665  (end)
666 
667  See Also:
668  <downloadItem()>
669  <downloadList()>
670  */
671  void downloadSelected( in sbIRemoteWebPlaylist aWebPlaylist );
672 
677  /*
678  Method: play()
679 
680  Prototype:
681  play()
682 
683  Begin playback at the current location in the <WebPlaylist>.
684 
685  Example:
686  (start code)
687  songbird.play();
688  (end)
689 
690  Note:
691  Metadata for the <MediaItems> may get updated and overwritten during playback.
692  See <Metadata Updates> for more details about cases where metadata may
693  get updated.
694 
695  See Also:
696  <playURL()>
697  <playMediaList()>
698  <pause()>
699  <stop()>
700  <previous()>
701  <next()>
702  */
703  void play();
704 
705  /*
706  Method: playMediaList()
707 
708  Begin playback of a <MediaList> at the specified index in the list.
709 
710  Prototype:
711  playMediaList(<MediaList> mediaList, Number index)
712 
713  Parameters:
714  mediaList - The <MediaList> to play.
715  index - Where to start playing in the list. Index starts at 0.
716 
717  Example:
718  (start code)
719  //Songbird object implements Player.
720  //Play the media list, starting with item at index 2.
721 
722  player.playMediaList(mediaList, 2);
723  (end)
724 
725  Note:
726  Metadata for <MediaItems> may get updated and overwritten during playback.
727  See <Metadata Updates> for more details about cases where metadata may
728  get updated.
729 
730  See Also:
731  <play()>
732  <playURL()>
733  <pause()>
734  <stop()>
735  <previous()>
736  <next()>
737  */
738  void playMediaList( in sbIRemoteMediaList aList,
739  in PRInt32 aIndex );
740 
745  /*
746  Method: playURL()
747 
748  Begin playback of a URL.
749 
750  Prototype:
751  playURL(String url)
752 
753  Parameters:
754  url - The URL to play.
755 
756  Example:
757  (start code)
758  songbird.playURL("http://path/to/item.mp3");
759  (end)
760 
761  Note:
762  Metadata for the <MediaItem> associated with this URL may get updated
763  and overwritten during playback. See <Metadata Updates> for more details
764  about cases where metadata may get updated.
765 
766  See Also:
767  <play()>
768  <playMediaList()>
769  <pause()>
770  <stop()>
771  <previous()>
772  <next()>
773  */
774  void playURL(in AString aURL);
775 
780  /*
781  Method: stop()
782 
783  Stop playback.
784 
785  Prototype:
786  stop()
787 
788  Example:
789  (start code)
790  songbird.stop();
791  (end)
792 
793  See Also:
794  <play()>
795  <playURL()>
796  <playMediaList()>
797  <pause()>
798  <previous()>
799  <next()>
800  */
801  void stop();
802 
807  /*
808  Method: pause()
809 
810  Pause playback.
811 
812  Prototype:
813  pause()
814 
815  Example:
816  (start code)
817  songbird.pause();
818  (end)
819 
820  See Also:
821  <play()>
822  <playURL()>
823  <playMediaList()>
824  <stop()>
825  <previous()>
826  <next()>
827  */
828  void pause();
829 
834  /*
835  Method: next()
836 
837  Skip to the next item, if there is one, and begin playing.
838 
839  If there is no next item playback will continue until the
840  end of the current item.
841 
842  Prototype:
843  next()
844 
845  Example:
846  (start code)
847  songbird.next();
848  (end)
849 
850  See Also:
851  <play()>
852  <playURL()>
853  <playMediaList()>
854  <pause()>
855  <stop()>
856  <previous()>
857  */
858  void next();
859 
864  /*
865  Method: previous()
866 
867  Skip to the previous item, if there is one, and begin playing.
868 
869  If there is no previous item playback will continue until the of the current item.
870 
871  Prototype:
872  previous()
873 
874  Example:
875  (start code)
876  songbird.previous();
877  (end)
878 
879  See Also:
880  <play()>
881  <playURL()>
882  <playMediaList()>
883  <pause()>
884  <stop()>
885  <next()>
886  */
887  void previous();
888 
889  /*
890  Method: setSiteScope()
891 
892  Set the scope for which to access site-specific privilegs such as the <siteLibrary>.
893  By default, the page's current domain and path is used.
894  Use an empty string for the domain and the path to use the default values.
895 
896  Note:
897  This may not be called more than once, and not after accessing the <siteLibrary>.
898  Accessing <siteLibrary> without calling <setSiteScope()> defaults to the most
899  restrictive scope possible (i.e. full host name, deepest path).
900 
901  Prototype:
902  setSiteScope(String domain, String path)
903 
904  Parameters:
905  domain - The domain name of the library. This may be an empty string.
906  path - The path within the domain for the library. This may be an empty string.
907 
908  Example:
909  (start code)
910  // sets the site scope to TLD+1 (will throw unless the page was on *.example.com)
911  songbird.setSiteScope("example.com", "");
912  // sets the site scope to default values
913  // (will throw because it has already been set once)
914  songbird.setSiteScope("", "");
915  (end)
916 
917  See Also:
918  <siteLibrary>
919  */
920  void setSiteScope(in AUTF8String aDomain, in AUTF8String aPath);
921 
925  nsIURI getSiteScope();
926 
927  /*
928  Method: libraries()
929 
930  Access to any library in the system via path or 'magic' keyword.
931 
932  Prototype:
933  libraries(String libraryID)
934 
935  Parameters:
936  libraryID - Library ID you wish to access, this can be a path or 'magic' keyword.
937  Currently supported keywords are "main" and "web".
938 
939  Example:
940  (start code)
941  var libraryID = "web";
942  var library = songbird.libraries(libraryID);
943  (end)
944 
945  See Also:
946  <siteLibrary>
947  */
948  sbIRemoteLibrary libraries(in AString aLibraryID);
949 
953  [noscript] void fireEventToContent(in AString aClass, in AString aType);
954 
958  [noscript] void fireMediaItemStatusEventToContent(in AString aClass,
959  in AString aType,
960  in sbIMediaItem aMediaItem,
961  in long aStatus);
962 
966  [noscript] void onCommandsChanged();
967 
971  /*
972  Method: hasAccess()
973 
974  Check if the code has access to a category.
975 
976  Prototype:
977  boolean hasAccess( String Category )
978 
979  Parameters:
980  Category - The category to check for access to. See <Security> for a list
981  of valid categories.
982 
983  Example:
984  (start code)
985  ...
986  if (songbird.hasAccess('Read Current'))
987  {
988  var artist = songbird.currentArtist;
989  }
990  ...
991  (end)
992  */
993  boolean hasAccess( in AString aRemotePermCataegory );
994 
995  /* Group: Property Creation
996 
997  Properties define the list of available columns, as well as provide a
998  means of storing data about a <MediaItem>. This section defines and
999  explains the parameters for the various property creation methods below.
1000 
1001  Common Parameters:
1002  ID - A unique text id of the new property. Does not need to be in URL format
1003  but that is a recommended format for ensuring uniqueness.
1004  displayName - The displayed name of the property.
1005  readOnly - If true this property's value can NOT be edited by the user.
1006  viewable - If true this property will be viewable in all locations of Songbird
1007  including the main library.
1008  nullSort - The type of null sorting desired. When sorted will empty values
1009  sort small or large; see below for more detail.
1010 
1011  Specific Parameters:
1012  timeType - Determines the formatting of the datetime string. Present only in
1013  <createDateTimeProperty()>.
1014  buttonLabel - The text displayed on a button. Present only in
1015  <createButtonProperty()> and <createDownloadButtonProperty()>. For
1016  standard button properties the absence of this parameter at property
1017  creation allows buttons to have different text on them by setting
1018  the value of the property on various <MediaItem>s. That is not
1019  possible with download buttons as the value determines the state
1020  and therefore the display of the button. The text for download
1021  buttons MUST be set at creation or the button will not have any
1022  and will not draw properly.
1023 
1024  nullSort values:
1025  0 - Null values are infinitely small. This is the default.
1026  1 - Null values are infinitely large.
1027  2 - Null values are always first (regardless of sort direction)
1028  3 - Null values are always last
1029 
1030  timeType values:
1031  -1 - Unintialized
1032  0 - 2007-03-28 , in localized format
1033  1 - HH:mm:ss.ms, in localized format. Limited to 24 hour days.
1034  2 - Long date format, 2007-03-28 12:33:01 , no milliseconds.
1035  3 - Duration, represented in HH:mm:ss.ms, in localized format. May exceed 24 hours
1036  4 - Timestamp format, respects unix time, microsecond format. Also internal
1037  storage type.
1038 
1039  See:
1040  <createTextProperty()>, <createDateTimeProperty()>, <createURIProperty()>,
1041  <createNumberProperty()>, <createImageProperty()>, <createRatingsProperty()>,
1042  <createButtonProperty()>, <createDownloadButtonProperty()>
1043  */
1044 
1045  /*
1046  Func: createTextProperty()
1047 
1048  Add a text property to the system that will be available for all media items.
1049  Properties define the set of possible columns available to the <WebPlaylist>
1050 
1051  Prototype:
1052  createTextProperty ( in AString ID,
1053  in AString displayName,
1054  [optional] in boolean readOnly = false,
1055  [optional] in boolean viewable = false,
1056  [optional] in unsigned long nullSort = 0 )
1057 
1058  Parameters:
1059  See <Property Creation> for a complete list of parameter types and their values.
1060 
1061  Example:
1062  (start code)
1063  //This example assumes you already have created
1064  //a mediaitem and assigned it to mediaItem.
1065 
1066  // Create a property that indicates what store this item is from.
1067  songbird.createTextProperty("http://example.com/Store",
1068  "Store", true, false, 0);
1069 
1070  // Add the store name to the media item
1071  mediaitem.setProperty("Store", "Amazon");
1072  (end)
1073 
1074  See Also:
1075  <createDateTimeProperty()>
1076  <createURIProperty()>
1077  <createNumberProperty()>
1078  <createImageProperty()>
1079  <createRatingsProperty()>
1080  <createButtonProperty()>
1081  <createDownloadButtonProperty()>
1082  */
1083  void createTextProperty( in AString ID,
1084  in AString displayName,
1085  [optional] in boolean readOnly,
1086  [optional] in boolean viewable,
1087  [optional] in unsigned long nullSort );
1088 
1089  /*
1090  Func: createDateTimeProperty()
1091 
1092  Add a date time property to the system that will be available for all media
1093  items.
1094  Properties define the set of possible columns available to the <WebPlaylist>.
1095  This property accept values for time in microseconds, 5 minutes 52 seconds
1096  would be a value of 352000000. For the date based time types the time is the
1097  number of microseconds from the linux epoch: 1 January 1970 00:00:00 UTC.
1098 
1099  Prototype:
1100  createDateTimeProperty ( in AString ID,
1101  in AString displayName,
1102  in PRInt32 timeType,
1103  [optional] in boolean readOnly = false,
1104  [optional] in boolean viewable = false,
1105  [optional] in unsigned long nullSort = 0 )
1106 
1107  Parameters:
1108  See <Property Creation> for a complete list of parameter types and their values.
1109 
1110  Example:
1111  (start code)
1112  //This example assumes you already have created
1113  //a mediaitem and assigned it to mediaItem.
1114 
1115  // Create a property of when this item was added to the store
1116  songbird.createDateTimeProperty("http://example.com/DateAdded",
1117  "Added", true, false, 0);
1118 
1119  // Add the added date to the media item
1120  mediaitem.setProperty("DateAdded", "4948575738");
1121  (end)
1122 
1123  See Also:
1124  <createTextProperty()>
1125  <createURIProperty()>
1126  <createNumberProperty()>
1127  <createImageProperty()>
1128  <createRatingsProperty()>
1129  <createButtonProperty()>
1130  <createDownloadButtonProperty()>
1131  */
1132  void createDateTimeProperty( in AString ID,
1133  in AString displayName,
1134  in PRInt32 timeType,
1135  [optional] in boolean readOnly,
1136  [optional] in boolean viewable,
1137  [optional] in unsigned long nullSort );
1138 
1139  /*
1140  Func: createURIProperty()
1141 
1142  Add a URI property to the system that will be available for all media items.
1143  Properties define the set of possible columns available to the <WebPlaylist>
1144 
1145  Prototype:
1146  createURIProperty ( in AString ID,
1147  in AString displayName,
1148  [optional] in boolean readOnly = false,
1149  [optional] in boolean viewable = false,
1150  [optional] in unsigned long nullSort = 0 )
1151 
1152  Parameters:
1153  See <Property Creation> for a complete list of parameter types and their values.
1154 
1155  Example:
1156  (start code)
1157  //This example assumes you already have created
1158  //a mediaitem and assigned it to mediaItem.
1159 
1160  // Create a property that links to the store
1161  songbird.createURIProperty("http://example.com/StoreLink",
1162  "Store", true, false, 0);
1163 
1164  // Add a url to the media item
1165  mediaitem.setProperty("StoreLink", "http://www.store.com/item.php?id=1");
1166  (end)
1167 
1168  See Also:
1169  <createTextProperty()>
1170  <createDateTimeProperty()>
1171  <createNumberProperty()>
1172  <createImageProperty()>
1173  <createRatingsProperty()>
1174  <createButtonProperty()>
1175  <createDownloadButtonProperty()>
1176  */
1177  void createURIProperty( in AString ID,
1178  in AString displayName,
1179  [optional] in boolean readOnly,
1180  [optional] in boolean viewable,
1181  [optional] in unsigned long nullSort );
1182 
1183  /*
1184  Func: createNumberProperty()
1185 
1186  Add a number property to the system that will be available for all media
1187  items.
1188  Properties define the set of possible columns available to the <WebPlaylist>
1189 
1190  Prototype:
1191  createNumberProperty ( in AString ID,
1192  in AString displayName,
1193  [optional] in boolean readOnly = false,
1194  [optional] in boolean viewable = false,
1195  [optional] in unsigned long nullSort = 0 )
1196 
1197  Parameters:
1198  See <Property Creation> for a complete list of parameter types and their values.
1199 
1200  Example:
1201  (start code)
1202  //This example assumes you already have created
1203  //a mediaitem and assigned it to mediaItem.
1204 
1205  // Create a property that shows the price of this item
1206  songbird.createNumberProperty("http://example.com/Price", "Price", true);
1207 
1208  // Add a price to the media item
1209  mediaitem.setProperty("Price", "0.99");
1210  (end)
1211 
1212  See Also:
1213  <createTextProperty()>
1214  <createDateTimeProperty()>
1215  <createURIProperty()>
1216  <createImageProperty()>
1217  <createRatingsProperty()>
1218  <createButtonProperty()>
1219  <createDownloadButtonProperty()>
1220  */
1221  void createNumberProperty( in AString ID,
1222  in AString displayName,
1223  [optional] in boolean readOnly,
1224  [optional] in boolean viewable,
1225  [optional] in unsigned long nullSort );
1226 
1227  /*
1228  Func: createImageProperty()
1229 
1230  Add an image property to the system that will be available for all media
1231  items.
1232  Properties define the set of possible columns available to the <WebPlaylist>
1233 
1234  Prototype:
1235  createImageProperty ( in AString ID,
1236  in AString displayName,
1237  [optional] in boolean readOnly = false,
1238  [optional] in boolean viewable = false,
1239  [optional] in unsigned long nullSort = 0 )
1240 
1241  Parameters:
1242  See <Property Creation> for a complete list of parameter types and their values.
1243 
1244  Example:
1245  (start code)
1246  //This example assumes you already have created
1247  //a mediaitem and assigned it to mediaItem.
1248 
1249  // Create a property that shows the logo of the store this item is from
1250  songbird.createImageProperty("http://example.com/Logo",
1251  "Logo", true, false, 0);
1252 
1253  // Add a logo to the media item
1254  mediaitem.setProperty("Logo", "http://www.domain.com/image.jpg");
1255  (end)
1256 
1257  See Also:
1258  <createTextProperty()>
1259  <createDateTimeProperty()>
1260  <createURIProperty()>
1261  <createNumberProperty()>
1262  <createRatingsProperty()>
1263  <createButtonProperty()>
1264  <createDownloadButtonProperty()>
1265  */
1266  void createImageProperty( in AString ID,
1267  in AString displayName,
1268  [optional] in boolean readOnly,
1269  [optional] in boolean viewable,
1270  [optional] in unsigned long nullSort );
1271 
1272  /*
1273  Func: createRatingsProperty()
1274 
1275  Add a ratings property to the system that will be available for all media
1276  items.
1277  Properties define the set of possible columns available to the <WebPlaylist>.
1278 
1279  Prototype:
1280  createRatingsProperty ( in AString ID,
1281  in AString displayName,
1282  [optional] in boolean readOnly = false,
1283  [optional] in boolean viewable = false,
1284  [optional] in unsigned long nullSort = 0 )
1285 
1286  Parameters:
1287  See <Property Creation> for a complete list of parameter types and their values.
1288 
1289  Example:
1290  (start code)
1291  //This example assumes you already have created
1292  //a mediaitem and assigned it to mediaItem.
1293 
1294  // Create a property that shows what the average rating for this item is
1295  songbird.createRatingsProperty("http://example.com/StoreRatings", "Ratings");
1296 
1297  // Add a share button to the media item
1298  mediaitem.setProperty("StoreRatings", "2");
1299  (end)
1300 
1301  See Also:
1302  <createTextProperty()>
1303  <createDateTimeProperty()>
1304  <createURIProperty()>
1305  <createNumberProperty()>
1306  <createImageProperty()>
1307  <createButtonProperty()>
1308  <createDownloadButtonProperty()>
1309  */
1310  void createRatingsProperty( in AString ID,
1311  in AString displayName,
1312  [optional] in boolean readOnly,
1313  [optional] in boolean viewable,
1314  [optional] in unsigned long nullSort );
1315 
1316  /*
1317  Func: createButtonProperty()
1318 
1319  Add a button property to the system that will be available for all media
1320  items.
1321  Properties define the set of possible columns available to the <WebPlaylist>
1322 
1323  Prototype:
1324  createButtonProperty ( in AString ID,
1325  in AString displayName,
1326  in AString buttonLabel,
1327  [optional] in boolean readOnly = false,
1328  [optional] in boolean viewable = false,
1329  [optional] in unsigned long nullSort = 0 )
1330 
1331  Parameters:
1332  See <Property Creation> for a complete list of parameter types and their values.
1333 
1334  Example:
1335  (start code)
1336  //This example assumes you already have created
1337  //a mediaitem and assigned it to mediaItem.
1338 
1339  // Create a property that allows the user to share this item with others
1340  songbird.createButtonProperty("http://example.com/ShareItem",
1341  "Share", "Share Me", true, false, 0);
1342 
1343  // Add a share button to the media item
1344  mediaitem.setProperty("ShareItem", "Share me");
1345  (end)
1346 
1347  See Also:
1348  <createDateTimeProperty()>
1349  <createURIProperty()>
1350  <createNumberProperty()>
1351  <createImageProperty()>
1352  <createRatingsProperty()>
1353  <createButtonProperty()>
1354  <createDownloadButtonProperty()>
1355  */
1356  void createButtonProperty( in AString ID,
1357  in AString displayName,
1358  in AString buttonLabel,
1359  [optional] in boolean readOnly,
1360  [optional] in boolean viewable,
1361  [optional] in unsigned long nullSort );
1362 
1363  /*
1364  Func: createDownloadButtonProperty()
1365 
1366  Add a download button property to the system that will be available for all
1367  media items.
1368  Properties define the set of possible columns available to the <WebPlaylist>.
1369  The value to set on this button is a triple field value that includes the
1370  size of the object and the amount downloaded. The fields are separated by
1371  '|' characters. The format is:
1372  (start code)
1373  <mode>|<total size>|<current size>
1374  (end)
1375 
1376  Prototype:
1377  createDownloadButtonProperty ( in AString ID,
1378  in AString displayName,
1379  in AString buttonLabel,
1380  [optional] in boolean readOnly = false,
1381  [optional] in boolean viewable = false,
1382  [optional] in unsigned long nullSort = 0 )
1383 
1384  Parameters:
1385  See <Property Creation> for a complete list of parameter types and their values.
1386 
1387  Download Mode Types:
1388  0 - none
1389  1 - new
1390  2 - starting
1391  3 - downloading
1392  4 - paused
1393  5 - complete
1394 
1395  Example:
1396  (start code)
1397  //This example assumes you already have created
1398  //a mediaitem and assigned it to mediaItem.
1399 
1400  // Create a property that will allow the user to get the item (Download)
1401  songbird.createDownloadButtonProperty("http://example.com/DownlodButton",
1402  "Download", "Get", true, false, 0);
1403 
1404  // Add a download button to the media item
1405  mediaitem.setProperty("DownloadButton", "1|0|0");
1406 
1407  (end)
1408 
1409  See Also:
1410  <createTextProperty()>
1411  <createDateTimeProperty()>
1412  <createURIProperty()>
1413  <createNumberProperty()>
1414  <createImageProperty()>
1415  <createRatingsProperty()>
1416  <createButtonProperty()>
1417  */
1418  void createDownloadButtonProperty( in AString ID,
1419  in AString displayName,
1420  in AString buttonLabel,
1421  [optional] in boolean readOnly,
1422  [optional] in boolean viewable,
1423  [optional] in unsigned long nullSort );
1424 
1425 };
An interface to control a media list from remote web pages.
readonly attribute sbIRemoteLibrary mainLibrary
readonly attribute unsigned long apiVersionMajor
The major API version.
void stop()
Stop playback. Sets position to beginning.
readonly attribute sbIRemoteMediaList downloadMediaList
void downloadList(in sbIRemoteMediaList aList)
Download all items in a MediaList.
_updateCookies aPath
void fireEventToContent(in AString aClass, in AString aType)
Fires the event to the webpage.
void next()
Skip to the next track and begin playing.
void setSiteScope(in AUTF8String aDomain, in AUTF8String aPath)
readonly attribute boolean mute
The mute state.
nsIURI getSiteScope()
Get the site scope.
readonly attribute long long repeat
The repeat state for playback.
readonly attribute long long volume
The volume on a range from 0 to 255.
attribute long long position
The location of playback within the current media, in milliseconds.
boolean hasAccess(in AString aRemotePermCataegory)
Check if the code has access to a category.
boolean supportsVersion(in AString aAPIVersion)
Convenience method to see if the requested API version is supported.
This interface is a composition of many of our other interfaces with the goal of exposing a more web-...
void playMediaList(in sbIRemoteMediaList aList, in PRInt32 aIndex)
void createTextProperty(in AString ID, in AString displayName, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
readonly attribute unsigned long long duration
The duration of the current media, in milliseconds.
void removeListener(in AString aKey, in sbIRemoteObserver aObserver)
Remove an observer from the metadata key.
var uuid
sbIRemoteLibrary libraries(in AString aLibraryID)
void pause()
Stop playback, leaves position at current location.
A distinct view on a given media list.
readonly attribute AString currentTrack
The name of the currently playing track.
void previous()
Skip to the previous track and begin playing.
void createDownloadButtonProperty(in AString ID, in AString displayName, in AString buttonLabel, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
void onCommandsChanged()
Forces the webplaylist to rescan its commands.
An interface to specify playlist commands from remote web pages.
readonly attribute sbIRemoteLibrary siteLibrary
void addListener(in AString aKey, in sbIRemoteObserver aObserver)
Bind an observer to get called on changes to Songbird metadata/state.
readonly attribute sbIRemoteWebPlaylist webPlaylist
The current web playlist.
readonly attribute AString currentArtist
The name of the artist for the currently playing media item.
An interface to control a media library from remote web pages.
readonly attribute sbIRemoteCommands commands
The collection of commands associated with the current page.
void createURIProperty(in AString ID, in AString displayName, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
void createRatingsProperty(in AString ID, in AString displayName, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
readonly attribute boolean paused
The paused state of the application.
void downloadSelected(in sbIRemoteWebPlaylist aWebPlaylist)
Download only the selected elements from a WebPlaylist.
readonly attribute AString name
The name of the player.
void createButtonProperty(in AString ID, in AString displayName, in AString buttonLabel, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
readonly attribute sbIRemoteLibrary webLibrary
void play()
Begin playback at the current location.
readonly attribute boolean shuffle
Shuffle state for playback.
void createNumberProperty(in AString ID, in AString displayName, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
readonly attribute AString currentAlbum
The name of the album for the currently playing track.
void fireMediaItemStatusEventToContent(in AString aClass, in AString aType, in sbIMediaItem aMediaItem, in long aStatus)
Fires the media item status event to the webpage.
Interface that defines a single item of media in the system.
void playURL(in AString aURL)
Play an media file by URL.
void downloadItem(in sbIMediaItem aItem)
Download the item passed in.
void createImageProperty(in AString ID, in AString displayName, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
readonly attribute boolean playing
The playing state of the application.
void createDateTimeProperty(in AString ID, in AString displayName, in PRInt32 timeType, [optional] in boolean readOnly, [optional] in boolean viewable, [optional] in unsigned long nullSort)
readonly attribute unsigned long apiVersionMinor
The minor API version.
An interface to control a media list from remote web pages.
Lightweight Observer style interface for use with sbIRemotePlayer::addListener.