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": {}, "devDependencies": {},
"ignore": [], "ignore": [],
"version": "1.4.324", "version": "1.4.325",
"_release": "1.4.324", "_release": "1.4.325",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.4.324", "tag": "1.4.325",
"commit": "65e5d919b19f4b447aee6914ee8c40347c4e98ff" "commit": "f11f822888ef812064c9a2677dc5c639e82cbb9f"
}, },
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1", "_target": "^1.2.1",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -434,26 +434,26 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
Dashboard.getCurrentUser().then(function (user) { return Dashboard.getCurrentUser().then(function (user) {
if (options.items) { 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 { } else {
self.getItemsForPlayback({ return self.getItemsForPlayback({
Ids: options.ids.join(',') Ids: options.ids.join(',')
}).then(function (result) { }).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) { function getOptimalMediaSource(mediaType, versions) {

View file

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

View file

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