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

fix remote control stopping playback

This commit is contained in:
Luke Pulverenti 2016-10-27 13:29:40 -04:00
parent 1f1475c2f1
commit 6c735c55a9
11 changed files with 84 additions and 60 deletions

View file

@ -315,7 +315,7 @@
if (!this.session) {
console.log("no session");
return;
return Promise.reject();
}
// Convert the items to smaller stubs to send the minimal amount of information
@ -330,7 +330,7 @@
};
});
this.sendMessage({
return this.sendMessage({
options: options,
command: command
});
@ -359,11 +359,15 @@
message.maxBitrate = bitrateSetting;
}
require(['chromecasthelpers'], function (chromecasthelpers) {
return new Promise(function (resolve, reject) {
chromecasthelpers.getServerAddress(ApiClient).then(function (serverAddress) {
message.serverAddress = serverAddress;
player.sendMessageInternal(message);
require(['chromecasthelpers'], function (chromecasthelpers) {
chromecasthelpers.getServerAddress(ApiClient).then(function (serverAddress) {
message.serverAddress = serverAddress;
player.sendMessageInternal(message).then(resolve, reject);
}, reject);
});
});
};
@ -374,6 +378,7 @@
//console.log(message);
this.session.sendMessage(messageNamespace, message, this.onPlayCommandSuccess.bind(this), this.errorHandler);
return Promise.resolve();
};
CastPlayer.prototype.onPlayCommandSuccess = function () {
@ -541,22 +546,22 @@
self.play = function (options) {
Dashboard.getCurrentUser().then(function (user) {
return Dashboard.getCurrentUser().then(function (user) {
if (options.items) {
self.playWithCommand(options, 'PlayNow');
return self.playWithCommand(options, 'PlayNow');
} else {
self.getItemsForPlayback({
return self.getItemsForPlayback({
Ids: options.ids.join(',')
}).then(function (result) {
options.items = result.Items;
self.playWithCommand(options, 'PlayNow');
return self.playWithCommand(options, 'PlayNow');
});
}
@ -568,16 +573,14 @@
self.playWithCommand = function (options, command) {
if (!options.items) {
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
return ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
options.items = [item];
self.playWithCommand(options, command);
return self.playWithCommand(options, command);
});
return;
}
castPlayer.loadMedia(options, command);
return castPlayer.loadMedia(options, command);
};
self.unpause = function () {