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

@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.324",
"_release": "1.4.324",
"version": "1.4.325",
"_release": "1.4.325",
"_resolution": {
"type": "version",
"tag": "1.4.324",
"commit": "65e5d919b19f4b447aee6914ee8c40347c4e98ff"
"tag": "1.4.325",
"commit": "f11f822888ef812064c9a2677dc5c639e82cbb9f"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1",

View file

@ -310,9 +310,11 @@
function setBackdrop(url) {
if (url) {
if (typeof url !== 'string') {
url = getImageUrls([url])[0];
}
}
if (url) {
clearRotation();

View file

@ -71,6 +71,13 @@
dom.addEventListener(this, 'input', function (e) {
this.dragging = true;
updateBubble(this, this.value, sliderBubble);
if (hasHideClass) {
sliderBubble.classList.remove('hide');
hasHideClass = false;
}
}, {
passive: true
});
@ -78,6 +85,10 @@
dom.addEventListener(this, 'change', function () {
this.dragging = false;
updateValues(this, backgroundLower, backgroundUpper);
sliderBubble.classList.add('hide');
hasHideClass = true;
}, {
passive: true
});
@ -86,6 +97,7 @@
if (!browser.firefox) {
dom.addEventListener(this, 'mousemove', function (e) {
if (!this.dragging) {
var rect = this.getBoundingClientRect();
var clientX = e.clientX;
var bubbleValue = (clientX - rect.left) / rect.width;
@ -96,6 +108,8 @@
sliderBubble.classList.remove('hide');
hasHideClass = false;
}
}
}, {
passive: true
});

View file

@ -14,17 +14,17 @@ define(['playbackManager', 'userSettings'], function (playbackManager, userSetti
return;
}
if (enabled(items[0].MediaType)) {
currentThemeIds = items.map(function (i) {
return i.Id;
});
currentOwnerId = ownerId;
if (enabled(items[0].MediaType)) {
playbackManager.play({
items: items,
fullscreen: false,
enableRemotePlayers: false
}).then(function () {
currentOwnerId = ownerId;
});
}

View file

@ -214,6 +214,7 @@
parse: function (text) {
var links = [];
var match;
while (match = linkRegExp.exec(text)) {
// console.log(matches);

View file

@ -1,7 +1,7 @@
<h1>${HeaderSettings}</h1>
<div class="checkboxContainer checkboxContainer-withDescription chkEnableInternetProvidersContainer hide">
<label>
<input is="emby-checkbox" type="checkbox" id="chkEnableInternetProviders" />
<input is="emby-checkbox" type="checkbox" id="chkEnableInternetProviders" checked />
<span>${LabelDownloadInternetMetadata}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${LabelDownloadInternetMetadataHelp}</div>

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;
}
return new Promise(function (resolve, reject) {
require(['chromecasthelpers'], function (chromecasthelpers) {
chromecasthelpers.getServerAddress(ApiClient).then(function (serverAddress) {
message.serverAddress = serverAddress;
player.sendMessageInternal(message);
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 () {

View file

@ -460,22 +460,24 @@
});
};
function doWithPlaybackValidation(player, fn) {
function validatePlayback(player) {
if (!player.isLocalPlayer) {
fn();
return;
return Promise.resolve();
}
return new Promise(function (resolve, reject) {
requirejs(["registrationServices"], function (registrationServices) {
self.playbackTimeLimitMs = null;
registrationServices.validateFeature('playback').then(fn, function () {
registrationServices.validateFeature('playback').then(resolve, function () {
self.playbackTimeLimitMs = lockedTimeLimitMs;
startAutoStopTimer();
fn();
resolve();
});
});
});
}
@ -525,16 +527,16 @@
if (options.enableRemotePlayers === false) {
if (!currentPlayer.isLocalPlayer) {
return;
return Promise.reject();
}
}
doWithPlaybackValidation(currentPlayer, function () {
return validatePlayback(currentPlayer).then(function () {
if (typeof (options) === 'string') {
options = { ids: [options] };
}
currentPlayer.play(options);
return currentPlayer.play(options);
});
};
@ -545,7 +547,7 @@
id = id.Id;
}
doWithPlaybackValidation(currentPlayer, function () {
validatePlayback(currentPlayer).then(function () {
currentPlayer.shuffle(id);
});
};
@ -557,7 +559,7 @@
id = id.Id;
}
doWithPlaybackValidation(currentPlayer, function () {
validatePlayback(currentPlayer).then(function () {
currentPlayer.instantMix(id);
});
};

View file

@ -434,26 +434,26 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
Dashboard.showLoadingMsg();
Dashboard.getCurrentUser().then(function (user) {
return Dashboard.getCurrentUser().then(function (user) {
if (options.items) {
translateItemsForPlayback(options.items, true).then(function (items) {
return translateItemsForPlayback(options.items, true).then(function (items) {
self.playWithIntros(items, options, user);
return self.playWithIntros(items, options, user);
});
} else {
self.getItemsForPlayback({
return self.getItemsForPlayback({
Ids: options.ids.join(',')
}).then(function (result) {
translateItemsForPlayback(result.Items, true).then(function (items) {
return translateItemsForPlayback(result.Items, true).then(function (items) {
self.playWithIntros(items, options, user);
return self.playWithIntros(items, options, user);
});
});
@ -489,6 +489,8 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
});
});
// Todo: rework above methods to use promises
return Promise.resolve();
};
function getOptimalMediaSource(mediaType, versions) {

View file

@ -19,7 +19,7 @@
remoteOptions.startPositionTicks = options.startPositionTicks;
}
ApiClient.sendPlayCommand(sessionId, remoteOptions);
return ApiClient.sendPlayCommand(sessionId, remoteOptions);
}
function sendPlayStateCommand(command, options) {
@ -57,7 +57,7 @@
self.play = function (options) {
sendPlayCommand(options, 'PlayNow');
return sendPlayCommand(options, 'PlayNow');
};
self.shuffle = function (id) {

View file

@ -1441,11 +1441,11 @@ var AppInfo = {};
if (options.fullscreen === false) {
// theme backdrops - not supported
if (!options.items || options.items[0].MediaType == 'Video') {
return;
return Promise.reject();
}
}
MediaController.play(options);
return MediaController.play(options);
},
queue: function (options) {