diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json index 26c6aebb29..b52f127f11 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json +++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json @@ -14,12 +14,12 @@ }, "devDependencies": {}, "ignore": [], - "version": "1.4.408", - "_release": "1.4.408", + "version": "1.4.409", + "_release": "1.4.409", "_resolution": { "type": "version", - "tag": "1.4.408", - "commit": "d522bced383a879f2d9f9fdf6344ed8e739d93e0" + "tag": "1.4.409", + "commit": "6a6a35e136f70989be0a63846b02bff62bab6367" }, "_source": "https://github.com/MediaBrowser/emby-webcomponents.git", "_target": "^1.2.1", diff --git a/dashboard-ui/bower_components/emby-webcomponents/inputmanager.js b/dashboard-ui/bower_components/emby-webcomponents/inputmanager.js index 35da6c6717..51504cc32a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/inputmanager.js +++ b/dashboard-ui/bower_components/emby-webcomponents/inputmanager.js @@ -146,10 +146,10 @@ define(['playbackManager', 'focusManager', 'embyRouter', 'dom'], function (playb embyRouter.showLiveTV(); break; case 'mute': - playbackManager.mute(); + playbackManager.setMute(true); break; case 'unmute': - playbackManager.unMute(); + playbackManager.setMute(false); break; case 'togglemute': playbackManager.toggleMute(); diff --git a/dashboard-ui/bower_components/emby-webcomponents/listview/listview.js b/dashboard-ui/bower_components/emby-webcomponents/listview/listview.js index fd6ae9dbd7..af8ed6e2dd 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/listview/listview.js +++ b/dashboard-ui/bower_components/emby-webcomponents/listview/listview.js @@ -234,8 +234,12 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan var imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage'; + if (!clickEntireItem) { + imageClass += ' itemAction'; + } + if (imgUrl) { - html += '
'; + html += '
'; } else { html += '
'; } diff --git a/dashboard-ui/bower_components/emby-webcomponents/playbackmanager.js b/dashboard-ui/bower_components/emby-webcomponents/playbackmanager.js index fa24115ffc..bf885fcc3c 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/playbackmanager.js +++ b/dashboard-ui/bower_components/emby-webcomponents/playbackmanager.js @@ -5,8 +5,12 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g var self = this; + var players = []; var currentPlayer; + var currentTargetInfo; var lastLocalPlayer; + var currentPairingId = null; + var repeatMode = 'RepeatNone'; var playlist = []; var currentPlaylistIndex; @@ -24,6 +28,200 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g return data.streamInfo ? data.streamInfo.mediaSource : null; }; + function triggerPlayerChange(newPlayer, newTarget, previousPlayer) { + + events.trigger(self, 'playerchange', [newPlayer, newTarget, previousPlayer]); + } + + self.setActivePlayer = function (player, targetInfo) { + + if (typeof (player) === 'string') { + player = players.filter(function (p) { + return p.name == player; + })[0]; + } + + if (!player) { + throw new Error('null player'); + } + + var previousPlayer = currentPlayer; + + currentPairingId = null; + currentPlayer = player; + currentTargetInfo = targetInfo; + + console.log('Active player: ' + JSON.stringify(currentTargetInfo)); + + triggerPlayerChange(player, targetInfo, previousPlayer); + }; + + self.trySetActivePlayer = function (player, targetInfo) { + + if (typeof (player) === 'string') { + player = players.filter(function (p) { + return p.name == player; + })[0]; + } + + if (!player) { + throw new Error('null player'); + } + + if (currentPairingId == targetInfo.id) { + return; + } + + currentPairingId = targetInfo.id; + + player.tryPair(targetInfo).then(function () { + + var previousPlayer = currentPlayer; + + currentPlayer = player; + currentTargetInfo = targetInfo; + + console.log('Active player: ' + JSON.stringify(currentTargetInfo)); + + triggerPlayerChange(player, targetInfo, previousPlayer); + }, function () { + + if (currentPairingId == targetInfo.id) { + currentPairingId = null; + } + }); + }; + + self.trySetActiveDeviceName = function (name) { + + function normalizeName(t) { + return t.toLowerCase().replace(' ', ''); + } + + name = normalizeName(name); + + self.getTargets().then(function (result) { + + var target = result.filter(function (p) { + return normalizeName(p.name) == name; + })[0]; + + if (target) { + self.trySetActivePlayer(target.playerName, target); + } + + }); + }; + + self.setDefaultPlayerActive = function () { + + var player = self.getDefaultPlayer(); + + player.getTargets().then(function (targets) { + + self.setActivePlayer(player, targets[0]); + }); + }; + + self.removeActivePlayer = function (name) { + + if (self.getPlayerInfo().name == name) { + self.setDefaultPlayerActive(); + } + + }; + + self.removeActiveTarget = function (id) { + + if (self.getPlayerInfo().id == id) { + self.setDefaultPlayerActive(); + } + }; + + self.disconnectFromPlayer = function () { + + var playerInfo = self.getPlayerInfo(); + + if (playerInfo.supportedCommands.indexOf('EndSession') != -1) { + + require(['dialog'], function (dialog) { + + var menuItems = []; + + menuItems.push({ + name: Globalize.translate('ButtonYes'), + id: 'yes' + }); + menuItems.push({ + name: Globalize.translate('ButtonNo'), + id: 'no' + }); + + dialog({ + buttons: menuItems, + //positionTo: positionTo, + text: Globalize.translate('ConfirmEndPlayerSession') + + }).then(function (id) { + switch (id) { + + case 'yes': + MediaController.getCurrentPlayer().endSession(); + self.setDefaultPlayerActive(); + break; + case 'no': + self.setDefaultPlayerActive(); + break; + default: + break; + } + }); + + }); + + + } else { + + self.setDefaultPlayerActive(); + } + }; + + self.getTargets = function () { + + var promises = players.map(function (p) { + return p.getTargets(); + }); + + return Promise.all(promises).then(function (responses) { + + var targets = []; + + for (var i = 0; i < responses.length; i++) { + + var subTargets = responses[i]; + + for (var j = 0; j < subTargets.length; j++) { + + targets.push(subTargets[j]); + } + + } + + targets = targets.sort(function (a, b) { + + var aVal = a.isLocalPlayer ? 0 : 1; + var bVal = b.isLocalPlayer ? 0 : 1; + + aVal = aVal.toString() + a.name; + bVal = bVal.toString() + b.name; + + return aVal.localeCompare(bVal); + }); + + return targets; + }); + }; + function getCurrentSubtitleStream(player) { var index = getPlayerData(player).subtitleStreamIndex; @@ -101,13 +299,6 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g self.getPlayers = function () { - var players = pluginManager.ofType('mediaplayer'); - - players.sort(function (a, b) { - - return (a.priority || 0) - (b.priority || 0); - }); - return players; }; @@ -175,8 +366,14 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g self.toggleMute = function (mute) { + var player = currentPlayer; if (currentPlayer) { - self.setMute(!self.isMuted()); + + if (player.toggleMute) { + player.toggleMute(); + } else { + player.setMute(!player.isMuted()); + } } }; @@ -1943,6 +2140,17 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g } function initMediaPlayer(plugin) { + + players.push(player); + players.sort(function (a, b) { + + return (a.priority || 0) - (b.priority || 0); + }); + + if (player.isLocalPlayer !== false) { + player.isLocalPlayer = true; + } + plugin.currentState = {}; events.on(plugin, 'error', onPlaybackError);