mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 04:58:01 +01:00
Small tweak to the player service
This commit is contained in:
parent
7a0cf5a921
commit
94643e3674
1 changed files with 14 additions and 2 deletions
|
@ -15,8 +15,8 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module.exports = angular.module('ponyfm').factory('player', [
|
module.exports = angular.module('ponyfm').factory('player', [
|
||||||
'$rootScope'
|
'$rootScope', '$http'
|
||||||
($rootScope) ->
|
($rootScope, $http) ->
|
||||||
readyDef = new $.Deferred()
|
readyDef = new $.Deferred()
|
||||||
|
|
||||||
play = (track) ->
|
play = (track) ->
|
||||||
|
@ -168,6 +168,18 @@ module.exports = angular.module('ponyfm').factory('player', [
|
||||||
pfm.soundManager.done () ->
|
pfm.soundManager.done () ->
|
||||||
self.ready = true
|
self.ready = true
|
||||||
self.setVolume($.cookie('pfm-volume') || 100)
|
self.setVolume($.cookie('pfm-volume') || 100)
|
||||||
|
|
||||||
|
codeArray = []
|
||||||
|
codeKey = '38,38,40,40,37,39,37,39,66,65'
|
||||||
|
$(document).keydown (e) ->
|
||||||
|
codeArray.push e.keyCode
|
||||||
|
if codeArray.toString().indexOf(codeKey) >= 0
|
||||||
|
$http.get('https://pony.fm/api/web/tracks/23453').success (trackResponse) =>
|
||||||
|
toPlay = trackResponse.track
|
||||||
|
play(toPlay)
|
||||||
|
codeArray = []
|
||||||
|
return
|
||||||
|
|
||||||
readyDef.resolve()
|
readyDef.resolve()
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|
Loading…
Reference in a new issue