diff --git a/dashboard-ui/scripts/mediacontroller.js b/dashboard-ui/scripts/mediacontroller.js
index 47e3ef4d75..11fd603142 100644
--- a/dashboard-ui/scripts/mediacontroller.js
+++ b/dashboard-ui/scripts/mediacontroller.js
@@ -1,16 +1,5 @@
(function ($, window) {
- function setMirrorModeEnabled(enabled) {
-
- var val = enabled ? '1' : '0';
-
- appStorage.setItem('displaymirror--' + Dashboard.getCurrentUserId(), val);
-
- }
- function isMirrorModeEnabled() {
- return (appStorage.getItem('displaymirror--' + Dashboard.getCurrentUserId()) || '') != '0';
- }
-
var currentDisplayInfo;
function mirrorItem(info) {
@@ -25,9 +14,11 @@
});
}
- function mirrorIfEnabled(info) {
+ function mirrorIfEnabled() {
- if (isMirrorModeEnabled()) {
+ var info = currentDisplayInfo;
+
+ if (info && MediaController.enableDisplayMirroring()) {
var player = MediaController.getPlayerInfo();
@@ -110,9 +101,9 @@
html += '
' + Globalize.translate('LabelAllPlaysSentToPlayer') + '
';
- checkedHtml = isMirrorModeEnabled() ? ' checked="checked"' : '';
+ checkedHtml = MediaController.enableDisplayMirroring() ? ' checked="checked"' : '';
- html += '
';
+ html += '
';
html += '';
@@ -146,13 +137,7 @@
$('.players', elem).html(getTargetsHtml(targets)).trigger('create');
$('.chkEnableMirrorMode', elem).on('change', function () {
- setMirrorModeEnabled(this.checked);
-
- if (this.checked && currentDisplayInfo) {
-
- mirrorItem(currentDisplayInfo);
-
- }
+ MediaController.enableDisplayMirroring(this.checked);
});
@@ -182,10 +167,7 @@
});
- if (currentDisplayInfo) {
-
- mirrorIfEnabled(currentDisplayInfo);
- }
+ mirrorIfEnabled();
});
@@ -343,6 +325,27 @@
});
};
+ self.trySetActiveDeviceName = function (name) {
+
+ function normalizeName(t) {
+ return t.toLowerCase().replace(' ', '');
+ }
+
+ name = normalizeName(name);
+
+ self.getTargets().done(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();
@@ -417,6 +420,26 @@
});
}
+ self.toggleDisplayMirroring = function () {
+ self.enableDisplayMirroring(!self.enableDisplayMirroring());
+ };
+
+ self.enableDisplayMirroring = function (enabled) {
+
+ if (enabled != null) {
+
+ var val = enabled ? '1' : '0';
+ appStorage.setItem('displaymirror--' + Dashboard.getCurrentUserId(), val);
+
+ if (enabled) {
+ mirrorIfEnabled();
+ }
+ return;
+ }
+
+ return (appStorage.getItem('displaymirror--' + Dashboard.getCurrentUserId()) || '') != '0';
+ };
+
self.play = function (options) {
doWithPlaybackValidation(function () {
diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js
index c3cbbf9550..42138b5586 100644
--- a/dashboard-ui/scripts/mediaplayer.js
+++ b/dashboard-ui/scripts/mediaplayer.js
@@ -123,13 +123,6 @@
var isVlc = AppInfo.isNativeApp && $.browser.android;
var bitrateSetting = AppSettings.maxStreamingBitrate();
- if (isVlc) {
- // Work around vlc 1080p stutter for now
- if ((maxHeight || 1080) >= 1080) {
- bitrateSetting = Math.min(bitrateSetting, 4000002);
- }
- }
-
var canPlayWebm = self.canPlayWebm();
var profile = {};
diff --git a/dashboard-ui/scripts/nowplayingpage.js b/dashboard-ui/scripts/nowplayingpage.js
index d0673b7321..fc8e12f8a3 100644
--- a/dashboard-ui/scripts/nowplayingpage.js
+++ b/dashboard-ui/scripts/nowplayingpage.js
@@ -521,10 +521,8 @@
if (item && item.MediaType == 'Audio') {
$('.buttonsRow2', page).hide();
- $('.buttonsRow3', page).hide();
} else {
$('.buttonsRow2', page).show();
- $('.buttonsRow3', page).show();
}
var toggleRepeatButton = page.querySelector('.repeatToggleButton');
@@ -751,7 +749,7 @@
$('.requiresJqmCreate', this).trigger('create');
- var tabs = page.querySelectorAll('paper-tabs')[0];
+ var tabs = page.querySelector('paper-tabs');
tabs.alignBottom = true;
LibraryBrowser.configureSwipeTabs(page, tabs, page.querySelectorAll('neon-animated-pages')[0]);
diff --git a/dashboard-ui/voice/voice.js b/dashboard-ui/voice/voice.js
index e51464a099..eb5ef1bbfd 100644
--- a/dashboard-ui/voice/voice.js
+++ b/dashboard-ui/voice/voice.js
@@ -36,6 +36,11 @@
commands.push('show my tv guide');
commands.push('pull up my recordings');
+ commands.push('control chromecast');
+ commands.push('control [device name]');
+ commands.push('turn on display mirroring');
+ commands.push('turn off display mirroring');
+ commands.push('toggle display mirroring');
deferred.resolveWith(null, [shuffleArray(commands)]);
@@ -75,6 +80,8 @@
}
}
+ result.what = text;
+
text = text.trim();
var words = text.toLowerCase().split(' ');
@@ -146,9 +153,18 @@
userId: Dashboard.getCurrentUserId()
};
+ var textLower = text.toLowerCase();
var words = text.toLowerCase().split(' ');
- if (words.indexOf('show') != -1 || words.indexOf('pull') != -1 || words.indexOf('display') != -1 || words.indexOf('go') != -1) {
+ var displayWords = [
+ 'show',
+ 'pull up',
+ 'display',
+ 'go to',
+ 'view'
+ ];
+
+ if (displayWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
if (words.indexOf('guide') != -1) {
result.action = 'show';
@@ -160,31 +176,92 @@
result.category = 'recordings';
}
- result.removeWords.push('show');
- result.removeWords.push('pull up');
- result.removeWords.push('pull');
- result.removeWords.push('display');
- result.removeWords.push('go to');
+ result.removeWords = displayWords;
return result;
}
- if (words.indexOf('search') != -1 || words.indexOf('find') != -1) {
+ var searchWords = [
+ 'search',
+ 'search for',
+ 'find',
+ 'query'
+ ];
+
+ if (searchWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Search
result.action = 'search';
- result.removeWords.push('search for');
- result.removeWords.push('search');
- result.removeWords.push('find');
+ result.removeWords = searchWords;
return result;
}
- if (words.indexOf('play') != -1) {
+ var playWords = [
+ 'play',
+ 'watch'
+ ];
+
+ if (playWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
// Play
result.action = 'play';
- result.removeWords.push('play');
+ result.removeWords = playWords;
+ return result;
+ }
+
+ var controlWords = [
+ 'use',
+ 'control'
+ ];
+
+ if (controlWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
+
+ // Play
+ result.action = 'control';
+
+ result.removeWords = controlWords;
+ return result;
+ }
+
+ var enableWords = [
+ 'enable',
+ 'turn on'
+ ];
+
+ if (enableWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
+
+ // Play
+ result.action = 'enable';
+
+ result.removeWords = enableWords;
+ return result;
+ }
+
+ var disableWords = [
+ 'disable',
+ 'turn off'
+ ];
+
+ if (disableWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
+
+ // Play
+ result.action = 'disable';
+
+ result.removeWords = disableWords;
+ return result;
+ }
+
+ var toggleWords = [
+ 'toggle'
+ ];
+
+ if (toggleWords.filter(function (w) { return textLower.indexOf(w) == 0; }).length) {
+
+ // Play
+ result.action = 'toggle';
+
+ result.removeWords = toggleWords;
return result;
}
@@ -237,6 +314,22 @@
parseContext(text, result);
playCommand(result);
break;
+ case 'control':
+ parseContext(text, result);
+ controlCommand(result);
+ break;
+ case 'enable':
+ parseContext(text, result);
+ enableCommand(result);
+ break;
+ case 'disable':
+ parseContext(text, result);
+ disableCommand(result);
+ break;
+ case 'toggle':
+ parseContext(text, result);
+ toggleCommand(result);
+ break;
default:
deferred.reject();
return;
@@ -258,6 +351,38 @@
}
}
+ function enableCommand(result) {
+
+ var what = result.what.toLowerCase();
+
+ if (what.indexOf('mirror') != -1) {
+ MediaController.enableDisplayMirroring(true);
+ }
+ }
+
+ function disableCommand(result) {
+
+ var what = result.what.toLowerCase();
+
+ if (what.indexOf('mirror') != -1) {
+ MediaController.enableDisplayMirroring(false);
+ }
+ }
+
+ function toggleCommand(result) {
+
+ var what = result.what.toLowerCase();
+
+ if (what.indexOf('mirror') != -1) {
+ MediaController.toggleDisplayMirroring();
+ }
+ }
+
+ function controlCommand(result) {
+
+ MediaController.trySetActiveDeviceName(result.what);
+ }
+
function playCommand(result, shuffle) {
var query = {
@@ -379,12 +504,12 @@
html += '
' + Globalize.translate('MessageWeDidntRecognizeCommand') + '
';
html += '
';
- html += '
';
+ html += '
' + Globalize.translate('ButtonTryAgain') + '';
html += '
' + Globalize.translate('MessageIfYouBlockedVoice') + '
';
html += '