-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration.js
40 lines (38 loc) · 1.2 KB
/
integration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var ahfm_start = true
function update() {
return {
"playbackStatus": getPlaybackStatus(),
"canSeek": false,
"canGoNext": false,
"canGoPrevious": false,
"canAddToFavorites": false,
"volume": getVolume(),
"duration": 0,
"position": 0,
"songId": 0,
"songTitle": getTitle(),
"artistName": '',
"albumTitle": '',
"artUrl": '',
"isFavorite": false
};
}
function getPlaybackStatus() {
if ($('#jp_jplayer_0').data().jPlayer.status.paused) return MellowPlayer.PlaybackStatus.PAUSED;
else return MellowPlayer.PlaybackStatus.PLAYING;
}
function getTitle() {return document.getElementsByClassName('ng-binding')[0].text;}
function play() {$("#jp_jplayer_0").jPlayer("play")}
function pause() {$("#jp_jplayer_0").jPlayer("pause")}
function goNext() {}
function goPrevious() {}
function setVolume(volume) {$("#jp_jplayer_0").jPlayer("volume", volume)}
function getVolume() {
if (ahfm_start) {
setVolume(1.0);
ahfm_start = false;
} else return $("#jp_jplayer_0").jPlayer("option","volume");
}
function addToFavorites() {}
function removeFromFavorites() {}
function seekToPosition(position) {}