nuvola-player-devel team mailing list archive
-
nuvola-player-devel team
-
Mailing list archive
-
Message #00068
[Merge] lp:~mims-michael/nuvola-player/bugfix1049253 into lp:nuvola-player
Michael Mims has proposed merging lp:~mims-michael/nuvola-player/bugfix1049253 into lp:nuvola-player.
Requested reviews:
Jiří Janoušek (fenryxo)
Related bugs:
Bug #1049253 in Nuvola Player: "Rdio: sound is muted at startup and doesn't match per-application system volume"
https://bugs.launchpad.net/nuvola-player/+bug/1049253
For more details, see:
https://code.launchpad.net/~mims-michael/nuvola-player/bugfix1049253/+merge/157699
Updated integration to JSApi 2. Added a hack/fix to toggle playback on the first play to address initial muted playback. The problem appears to be with the AudioFactory of the Rdio client side js and not with WebkitGTK.
--
https://code.launchpad.net/~mims-michael/nuvola-player/bugfix1049253/+merge/157699
Your team Nuvola Player Development is subscribed to branch lp:nuvola-player.
=== modified file 'data/nuvolaplayer/services/rdio/integration.js'
--- data/nuvolaplayer/services/rdio/integration.js 2012-08-17 17:50:56 +0000
+++ data/nuvolaplayer/services/rdio/integration.js 2013-04-08 17:10:34 +0000
@@ -6,7 +6,7 @@
loaded.
- Copyright 2012 Stefan Lohmaier <stefan.lohmaier@xxxxxxxxxxxxxx>
+ Copyright 2012 Michael Mims <mims.michael@xxxxxxxxx>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3, as published
@@ -27,18 +27,43 @@
* Creates Rdio integration binded to Nuvola JS API
*/
var Integration = function(){
- /* Overwrite default commnad function */
- Nuvola.command = Nuvola.bind(this, this.command);
+ /* Overwrite default command function */
+ Nuvola.onMessageReceived = Nuvola.bind(this, this.messageHandler);
/* For debug output */
this.name = "Rdio";
/* Let's run */
this.state = Nuvola.STATE_NONE;
+ this.firstPlayToggled = false;
this.update();
- this.timeout = setInterval(Nuvola.bind(this, this.update), 500);
};
+ /**
+ * Toggles playback the first time a play action is received
+ * This is a temporary hack to try to work around a known issue with WebkitGTK
+ * initial volume levels (although testing seems to indicate it might be on rdio
+ * client js side). See Nuvola bug #1049253.
+ */
+ Integration.prototype.firstPlayToggle = function () {
+ if(this.firstPlayToggled != true) {
+ try {
+ var player = R.Services.Player;
+ player.playPause();
+
+ setTimeout(function () {
+ player.playPause();
+ console.debug("[firstPlayToggle] First play toggle completed");
+ }, 750);
+
+ console.debug("[firstPlayToggle] First play toggle began");
+ this.firstPlayToggled = true;
+ }
+ catch(e) {
+ console.debug("[firstPlayToggle] Player service not available");
+ }
+ }
+ }
/**
* Updates current playback state
@@ -52,10 +77,7 @@
var song = null;
var can_prev;
var can_next;
- var can_thumbs_up = false;
- var can_thumbs_down = false;
- var can_favorite = false;
-
+
try{
var playingTrack = R.Services.Player.model.get("playingTrack").attributes;
album_art = playingTrack.icon;
@@ -64,17 +86,22 @@
song = playingTrack.name;
}
catch(e){
- //~ console.debug("Unable to obtain song info: " + e.message);
+ console.debug("Unable to obtain song info: " + e.message);
}
try{
var state = Nuvola.STATE_NONE;
- var rdiostate = R.Services.Player.model.attributes.playState;//new
+ var rdiostate = R.Services.Player.model.attributes.playState;
switch (rdiostate){
- case 0: state = Nuvola.STATE_PAUSED; break;
- case 1: state = Nuvola.STATE_PLAYING; break;
+ case 0:
+ state = Nuvola.STATE_PAUSED;
+ break;
+ case 1:
+ state = Nuvola.STATE_PLAYING;
+ this.firstPlayToggle();
+ break;
}
if(state != Nuvola.STATE_NONE){
@@ -86,38 +113,47 @@
}
catch(e){
+ // console.debug("Unable to obtain state info: " + e.message);
can_prev = can_next = false;
}
this.state = state;
// Submit data to Nuvola backend
- Nuvola.dataChanged(
- song, artist, album, album_art,
- state, can_prev, can_next,
- can_thumbs_up, can_thumbs_down, can_favorite);
+ Nuvola.updateSong(song, artist, album, album_art, state);
+
+ if(this.can_next !== can_next){
+ this.can_next = can_next;
+ Nuvola.updateAction(Nuvola.ACTION_NEXT_SONG, can_next);
+ }
+ if(this.can_prev !== can_prev){
+ this.can_prev = can_prev;
+ Nuvola.updateAction(Nuvola.ACTION_PREV_SONG, can_prev);
+ }
+
+ setTimeout(Nuvola.bind(this, this.update), 500);
}
/**
* Command handler
* @param cmd command to execute
*/
- Integration.prototype.command = function(cmd){
+ Integration.prototype.messageHandler = function(cmd){
try{
switch(cmd){
- case Nuvola.CMD_PLAY:
+ case Nuvola.ACTION_PLAY:
if(this.state != Nuvola.STATE_PLAYING) R.Services.Player.playPause();
break;
- case Nuvola.CMD_PAUSE:
+ case Nuvola.ACTION_PAUSE:
if(this.state == Nuvola.STATE_PLAYING) R.Services.Player.playPause();
break;
- case Nuvola.CMD_TOGGLE:
+ case Nuvola.ACTION_TOGGLE_PLAY:
R.Services.Player.playPause();
break;
- case Nuvola.CMD_PREV_SONG:
+ case Nuvola.ACTION_PREV_SONG:
R.Services.Player.previous();
break;
- case Nuvola.CMD_NEXT_SONG:
+ case Nuvola.ACTION_NEXT_SONG:
R.Services.Player.next();
break;
default:
@@ -135,5 +171,5 @@
/* Store reference */
Nuvola.integration = new Integration(); // Singleton
-// Call anonymous function with Nuvola object as an argument
-})(window._Nuvola);
+// Call anonymous function with JS API object as an argument
+})(this);
\ No newline at end of file
=== modified file 'data/nuvolaplayer/services/rdio/metadata.conf'
--- data/nuvolaplayer/services/rdio/metadata.conf 2013-04-06 12:42:57 +0000
+++ data/nuvolaplayer/services/rdio/metadata.conf 2013-04-08 17:10:34 +0000
@@ -1,8 +1,9 @@
name = Rdio
home_page = http://www.rdio.com/
sandbox_pattern = https?://((www\.)?rdio\.com/|ak.rdio\.com|)
-maintainer_name = Orphaned service
-maintainer_link = https://answers.launchpad.net/nuvola-player/+faq/2012
+maintainer_name = Michael Mims
+maintainer_link = https://launchpad.net/~mims-michael
version = 2
-version_minor = 4
-flash_plugin = no
+version_minor = 5
+api_major = 2
+flash_plugin = yes
Follow ups