diff --git a/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js b/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js
index cf1b1e1b2b..6ccc16ed51 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/chromecastplayer.js
@@ -840,7 +840,12 @@
};
self.audioTracks = function () {
- return [];
+ var state = self.lastPlayerData || {};
+ state = state.NowPlayingItem || {};
+ var streams = state.MediaStreams || [];
+ return streams.filter(function (s) {
+ return s.Type === 'Audio';
+ });
};
self.setAudioStreamIndex = function (index) {
@@ -859,7 +864,12 @@
};
self.subtitleTracks = function () {
- return [];
+ var state = self.lastPlayerData || {};
+ state = state.NowPlayingItem || {};
+ var streams = state.MediaStreams || [];
+ return streams.filter(function (s) {
+ return s.Type === 'Subtitle';
+ });
};
self.getSubtitleStreamIndex = function () {
@@ -975,8 +985,7 @@
return Promise.resolve([]);
};
- self.getCurrentPlaylistIndex = function () {
- return 0;
+ self.getCurrentPlaylistItemId = function () {
};
self.setCurrentPlaylistItem = function (playlistItemId) {
diff --git a/dashboard-ui/bower_components/emby-webcomponents/listview/listview.css b/dashboard-ui/bower_components/emby-webcomponents/listview/listview.css
index fc2a002a77..880d3b925b 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/listview/listview.css
+++ b/dashboard-ui/bower_components/emby-webcomponents/listview/listview.css
@@ -64,6 +64,7 @@
.listItem-shaded:nth-child(even) {
background: #1c1c1c;
+ background: rgba(30, 30, 30, .9);
}
.three-line {
@@ -112,9 +113,9 @@
color: #fff;
}
-.listItemIcon:not(.listItemIcon-transparent) {
- background-color: #52B54B;
-}
+ .listItemIcon:not(.listItemIcon-transparent) {
+ background-color: #52B54B;
+ }
.listItemProgressBar {
position: absolute;
diff --git a/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js b/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js
index c433d44359..9dffe942c9 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/playback/playbackmanager.js
@@ -1118,9 +1118,8 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
var apiClient = connectionManager.getApiClient(item.ServerId);
if (item.LocalTrailerCount) {
- apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (result) {
-
- self.play({
+ return apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (result) {
+ return self.play({
items: result
});
});
@@ -1128,10 +1127,10 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
var remoteTrailers = item.RemoteTrailers || [];
if (!remoteTrailers.length) {
- return;
+ return Promise.reject();
}
- self.play({
+ return self.play({
items: remoteTrailers.map(function (t) {
return {
Name: t.Name || (item.Name + ' Trailer'),
diff --git a/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js b/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js
index 481284611c..2b926bcb5a 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js
@@ -81,7 +81,6 @@
ids: itemIds.split(',')
});
dialogHelper.close(dlg);
- showToast();
return;
}
@@ -102,13 +101,6 @@
loading.hide();
dialogHelper.close(dlg);
- showToast();
- });
- }
-
- function showToast() {
- require(['toast'], function (toast) {
- toast(globalize.translate('sharedcomponents#MessageItemsAdded'));
});
}
@@ -116,7 +108,7 @@
select.dispatchEvent(new CustomEvent('change', {}));
}
- function populatePlaylists(panel) {
+ function populatePlaylists(editorOptions, panel) {
var select = panel.querySelector('#selectPlaylistToAddTo');
@@ -136,7 +128,7 @@
var html = '';
- if (playbackManager.isPlaying()) {
+ if (editorOptions.enableAddToPlayQueue !== false && playbackManager.isPlaying()) {
html += '';
}
@@ -148,7 +140,12 @@
});
select.innerHTML = html;
- select.value = userSettings.get('playlisteditor-lastplaylistid') || '';
+
+ var defaultValue = editorOptions.defaultValue;
+ if (!defaultValue) {
+ defaultValue = userSettings.get('playlisteditor-lastplaylistid') || '';
+ }
+ select.value = defaultValue === 'new' ? '' : defaultValue;
// If the value is empty set it again, in case we tried to set a lastplaylistid that is no longer valid
if (!select.value) {
@@ -195,7 +192,7 @@
return html;
}
- function initEditor(content, items) {
+ function initEditor(content, options, items) {
content.querySelector('#selectPlaylistToAddTo').addEventListener('change', function () {
if (this.value) {
@@ -213,7 +210,7 @@
if (items.length) {
content.querySelector('.fldSelectPlaylist').classList.remove('hide');
- populatePlaylists(content);
+ populatePlaylists(options, content);
} else {
content.querySelector('.fldSelectPlaylist').classList.add('hide');
@@ -270,7 +267,7 @@
dlg.innerHTML = html;
- initEditor(dlg, items);
+ initEditor(dlg, options, items);
dlg.querySelector('.btnCancel').addEventListener('click', function () {
diff --git a/dashboard-ui/bower_components/emby-webcomponents/sessionplayer.js b/dashboard-ui/bower_components/emby-webcomponents/sessionplayer.js
index 7378e8f0a1..b53f213ede 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/sessionplayer.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/sessionplayer.js
@@ -207,11 +207,18 @@
};
self.audioTracks = function () {
- return [];
+ var state = self.lastPlayerData || {};
+ state = state.NowPlayingItem || {};
+ var streams = state.MediaStreams || [];
+ return streams.filter(function (s) {
+ return s.Type === 'Audio';
+ });
};
self.getAudioStreamIndex = function () {
-
+ var state = self.lastPlayerData || {};
+ state = state.PlayState || {};
+ return state.AudioStreamIndex;
};
self.setAudioStreamIndex = function (index) {
@@ -221,11 +228,18 @@
};
self.subtitleTracks = function () {
- return [];
+ var state = self.lastPlayerData || {};
+ state = state.NowPlayingItem || {};
+ var streams = state.MediaStreams || [];
+ return streams.filter(function (s) {
+ return s.Type === 'Subtitle';
+ });
};
self.getSubtitleStreamIndex = function () {
-
+ var state = self.lastPlayerData || {};
+ state = state.PlayState || {};
+ return state.SubtitleStreamIndex;
};
self.setSubtitleStreamIndex = function (index) {
@@ -287,8 +301,7 @@
return Promise.resolve([]);
};
- self.getCurrentPlaylistIndex = function () {
- return 0;
+ self.getCurrentPlaylistItemId = function () {
};
self.setCurrentPlaylistItem = function (playlistItemId) {
diff --git a/dashboard-ui/components/remotecontrol.js b/dashboard-ui/components/remotecontrol.js
index c64486be66..8bab8ee2bc 100644
--- a/dashboard-ui/components/remotecontrol.js
+++ b/dashboard-ui/components/remotecontrol.js
@@ -7,7 +7,9 @@
});
}
- function showAudioMenu(context, player, button, item, currentIndex) {
+ function showAudioMenu(context, player, button, item) {
+
+ var currentIndex = playbackManager.getAudioStreamIndex(player);
var streams = (item.MediaStreams || []).filter(function (i) {
@@ -42,7 +44,9 @@
});
}
- function showSubtitleMenu(context, player, button, item, currentIndex) {
+ function showSubtitleMenu(context, player, button, item) {
+
+ var currentIndex = playbackManager.getSubtitleStreamIndex(player);
var streams = (item.MediaStreams || []).filter(function (i) {
@@ -490,6 +494,12 @@
dragHandle: true
});
+ if (items.length) {
+ context.querySelector('.playlistSection').classList.remove('hide');
+ } else {
+ context.querySelector('.playlistSection').classList.add('hide');
+ }
+
var itemsContainer = context.querySelector('.playlist');
itemsContainer.innerHTML = html;
@@ -680,6 +690,36 @@
}
}
+ function getSaveablePlaylistItems() {
+
+ return getPlaylistItems(currentPlayer).then(function (items) {
+
+ return items.filter(function (i) {
+ return i.Id && i.ServerId;
+ });
+ });
+ }
+
+ function savePlaylist() {
+
+ require(['playlistEditor'], function (playlistEditor) {
+
+ getSaveablePlaylistItems().then(function (items) {
+
+ var serverId = items.length ? items[0].ServerId : ApiClient.serverId();
+
+ new playlistEditor().show({
+ items: items.map(function(i) {
+ return i.Id;
+ }),
+ serverId: serverId,
+ enableAddToPlayQueue: false,
+ defaultValue: 'new'
+ });
+ });
+ });
+ }
+
function bindEvents(context) {
var btnCommand = context.querySelectorAll('.btnCommand');
@@ -699,19 +739,17 @@
context.querySelector('.btnAudioTracks').addEventListener('click', function (e) {
- if (currentPlayer && lastPlayerState && lastPlayerState.PlayState) {
+ if (currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem) {
- var currentIndex = lastPlayerState.PlayState.AudioStreamIndex;
- showAudioMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem, currentIndex);
+ showAudioMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem);
}
});
context.querySelector('.btnSubtitles').addEventListener('click', function (e) {
- if (currentPlayer && lastPlayerState && lastPlayerState.PlayState) {
+ if (currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem) {
- var currentIndex = lastPlayerState.PlayState.SubtitleStreamIndex;
- showSubtitleMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem, currentIndex);
+ showSubtitleMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem);
}
});
@@ -792,6 +830,8 @@
playbackManager.movePlaylistItem(playlistItemId, newIndex, currentPlayer);
});
+
+ context.querySelector('.btnSavePlaylist').addEventListener('click', savePlaylist);
}
function onPlayerChange() {
diff --git a/dashboard-ui/nowplaying.html b/dashboard-ui/nowplaying.html
index c4c6df8c74..6effae3f48 100644
--- a/dashboard-ui/nowplaying.html
+++ b/dashboard-ui/nowplaying.html
@@ -160,8 +160,13 @@
-