|
|
@ -206,17 +206,16 @@ |
|
|
|
* FIXME: Only works for the Web player for now |
|
|
|
* FIXME: Only works for the Web player for now |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function onToggleStartStop() { |
|
|
|
function onToggleStartStop() { |
|
|
|
var playing = false; |
|
|
|
|
|
|
|
if (CastPlayer.castSession) { |
|
|
|
if (CastPlayer.castSession) { |
|
|
|
playing = CastPlayer.mediaSession && CastPlayer.mediaSession.playerState == chrome.cast.media.PlayerState.PLAYING; |
|
|
|
var playing = CastPlayer.mediaSession && CastPlayer.mediaSession.playerState == chrome.cast.media.PlayerState.PLAYING; |
|
|
|
|
|
|
|
if (playing) onStop(); |
|
|
|
|
|
|
|
else onStart(); |
|
|
|
} else if (jwplayer()) { |
|
|
|
} else if (jwplayer()) { |
|
|
|
playing = jwplayer().getState() == "PLAYING"; |
|
|
|
if (jwplayer().getState() == "PLAYING") onStop(); |
|
|
|
|
|
|
|
else onStart(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// FIXME for playQueueService |
|
|
|
playQueueService.toggleStartStop(playQueueCallback); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (playing) onStop(); |
|
|
|
|
|
|
|
else onStart(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onGain(gain) { |
|
|
|
function onGain(gain) { |
|
|
@ -239,13 +238,21 @@ |
|
|
|
function onGainAdd(gain) { |
|
|
|
function onGainAdd(gain) { |
|
|
|
if (CastPlayer.castSession) { |
|
|
|
if (CastPlayer.castSession) { |
|
|
|
var volume = parseInt($("#castVolume").slider("option", "value")) + gain; |
|
|
|
var volume = parseInt($("#castVolume").slider("option", "value")) + gain; |
|
|
|
$("#castVolume").slider("option", "value", volume); |
|
|
|
if (volume > 100) volume = 100; |
|
|
|
|
|
|
|
if (volume < 0) volume = 0; |
|
|
|
|
|
|
|
CastPlayer.setCastVolume(volume / 100, false); |
|
|
|
|
|
|
|
$("#castVolume").slider("option", "value", volume); // Need to update UI |
|
|
|
} else if (jwplayer()) { |
|
|
|
} else if (jwplayer()) { |
|
|
|
var volume = parseInt(jwplayer().getVolume()); |
|
|
|
var volume = parseInt(jwplayer().getVolume()) + gain; |
|
|
|
jwplayer().setVolume(volume + gain); |
|
|
|
if (volume > 100) volume = 100; |
|
|
|
|
|
|
|
if (volume < 0) volume = 0; |
|
|
|
|
|
|
|
jwplayer().setVolume(volume); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var value = parseInt($("#jukeboxVolume").slider("option", "value")); |
|
|
|
var volume = parseInt($("#jukeboxVolume").slider("option", "value")) + gain; |
|
|
|
$("#jukeboxVolume").slider("option", "value", volume); |
|
|
|
if (volume > 100) volume = 100; |
|
|
|
|
|
|
|
if (volume < 0) volume = 0; |
|
|
|
|
|
|
|
onGain(volume / 100); |
|
|
|
|
|
|
|
$("#jukeboxVolume").slider("option", "value", volume); // Need to update UI |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|