1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

chromecast fixes

This commit is contained in:
Luke Pulverenti 2014-08-18 23:25:56 -04:00
parent 952106daa9
commit 2e25b47fb2

View file

@ -270,6 +270,18 @@
return; return;
} }
// Convert the items to smaller stubs to send the minimal amount of information
options.items = options.items.map(function (i) {
return {
Id: i.Id,
Name: i.Name,
Type: i.Type,
MediaType: i.MediaType,
IsFolder: i.IsFolder
};
});
this.sendMessage({ this.sendMessage({
options: options, options: options,
command: command command: command
@ -466,22 +478,22 @@
* @param {Event} e An event object from seek * @param {Event} e An event object from seek
*/ */
CastPlayer.prototype.seekMedia = function (event) { CastPlayer.prototype.seekMedia = function (event) {
var pos = parseInt(event); var pos = parseInt(event);
var curr = pos / 10000000; var curr = pos / 10000000;
if (this.castPlayerState != PLAYER_STATE.PLAYING && this.castPlayerState != PLAYER_STATE.PAUSED) { if (!this.currentMediaSession) {
return; return;
} }
this.currentMediaTime = curr;
console.log('Seeking ' + this.currentMediaSession.sessionId + ':' +
this.currentMediaSession.mediaSessionId + ' to ' + curr);
var request = new chrome.cast.media.SeekRequest(); var request = new chrome.cast.media.SeekRequest();
request.currentTime = this.currentMediaTime; request.currentTime = curr;
this.currentMediaSession.seek(request, this.currentMediaSession.seek(request,
this.onSeekSuccess.bind(this, 'media seek done'), this.onSeekSuccess.bind(this, 'media seek done'),
this.errorHandler); this.errorHandler);
this.castPlayerState = PLAYER_STATE.SEEKING; this.castPlayerState = PLAYER_STATE.SEEKING;
}; };
@ -717,9 +729,17 @@
}; };
self.nextTrack = function () { self.nextTrack = function () {
castPlayer.sendMessage({
options: {},
command: 'NextTrack'
});
}; };
self.previousTrack = function () { self.previousTrack = function () {
castPlayer.sendMessage({
options: {},
command: 'PreviousTrack'
});
}; };
self.beginPlayerUpdates = function () { self.beginPlayerUpdates = function () {