remember display mirroring

This commit is contained in:
Luke Pulverenti 2014-08-25 22:30:52 -04:00
parent 29afe3348c
commit 6350971623
7 changed files with 76 additions and 45 deletions

View File

@ -77,62 +77,62 @@
</thead>
<tbody>
<tr>
<td>${LabelSeriesName}</td>
<td>${LabelSeriesNamePlain}</td>
<td>%sn</td>
<td>${LabelSeriesName}</td>
<td>${LabelSeriesNamePlain}</td>
</tr>
<tr>
<td>${LabelSeriesName}</td>
<td>${LabelSeriesNamePlain}</td>
<td>%s.n</td>
<td>${ValueSeriesNamePeriod}</td>
</tr>
<tr>
<td>${LabelSeriesName}</td>
<td>${LabelSeriesNamePlain}</td>
<td>%s_n</td>
<td>${ValueSeriesNameUnderscore}</td>
</tr>
<tr>
<td>${LabelSeasonNumber}</td>
<td>${LabelSeasonNumberPlain}</td>
<td>%s</td>
<td>1</td>
</tr>
<tr>
<td>${LabelSeasonNumber}</td>
<td>${LabelSeasonNumberPlain}</td>
<td>%0s</td>
<td>01</td>
</tr>
<tr>
<td>${LabelEpisodeNumber}</td>
<td>${LabelEpisodeNumberPlain}</td>
<td>%e</td>
<td>4</td>
</tr>
<tr>
<td>${LabelEpisodeNumber}</td>
<td>${LabelEpisodeNumberPlain}</td>
<td>%0e</td>
<td>04</td>
</tr>
<tr>
<td>${LabelEndingEpisodeNumber}</td>
<td>${LabelEndingEpisodeNumberPlain}</td>
<td>%ed</td>
<td>5</td>
</tr>
<tr>
<td>${LabelEndingEpisodeNumber}</td>
<td>${LabelEndingEpisodeNumberPlain}</td>
<td>%0ed</td>
<td>05</td>
</tr>
<tr>
<td>${LabelEpisodeName}</td>
<td>${LabelEpisodeNamePlain}</td>
<td>%en</td>
<td>${LabelEpisodeName}</td>
<td>${LabelEpisodeNamePlain}</td>
</tr>
<tr>
<td>${LabelEpisodeName}</td>
<td>${LabelEpisodeNamePlain}</td>
<td>%e.n</td>
<td>${ValueEpisodeNamePeriod}</td>
</tr>
<tr>
<td>${LabelEpisodeName}</td>
<td>${LabelEpisodeNamePlain}</td>
<td>%e_n</td>
<td>${ValueEpisodeNameUnderscore}</td>
</tr>

View File

@ -31,7 +31,6 @@
<label>${LabelMonitorUsers}</label>
<div class="monitorUsersList">
</div>
<div class="fieldDescription">${UsersNotNotifiedAboutSelfActivity}</div>
<br />
<br />
</div>

View File

@ -316,12 +316,19 @@
var bitrateSetting = MediaPlayer.getBitrateSetting();
bitrateSetting = Math.min(bitrateSetting, 10000000);
var receiverName = null;
if (castPlayer.session && castPlayer.session.receiver && castPlayer.session.receiver.friendlyName) {
receiverName = castPlayer.session.receiver.friendlyName;
}
message = $.extend(message, {
userId: Dashboard.getCurrentUserId(),
deviceId: ApiClient.deviceId(),
accessToken: ApiClient.accessToken(),
serverAddress: ApiClient.serverAddress(),
maxBitrate: bitrateSetting
maxBitrate: bitrateSetting,
receiverName: receiverName
});
getEndpointInfo().done(function (endpoint) {

View File

@ -1,8 +1,17 @@
(function ($, window) {
(function ($, window, store) {
function setMirrorModeEnabled(enabled) {
var val = enabled ? '1' : '';
store.setItem('displaymirror', val);
}
function isMirrorModeEnabled() {
return (store.getItem('displaymirror') || '') == '1';
}
var enableMirrorMode;
var currentDisplayInfo;
function mirrorItem(info) {
var item = info.item;
@ -16,6 +25,18 @@
});
}
function mirrorIfEnabled(info) {
if (isMirrorModeEnabled()) {
var player = MediaController.getPlayerInfo();
if (!player.isLocalPlayer && player.supportedCommands.indexOf('DisplayContent') != -1) {
mirrorItem(info);
}
}
}
function monitorPlayer(player) {
$(player).on('playbackstart.mediacontroller', function (e, state) {
@ -455,7 +476,7 @@
html += '<p class="fieldDescription">' + Globalize.translate('LabelAllPlaysSentToPlayer') + '</p>';
checkedHtml = enableMirrorMode ? ' checked="checked"' : '';
checkedHtml = isMirrorModeEnabled() ? ' checked="checked"' : '';
html += '<div style="margin-top:1.5em;" class="fldMirrorMode"><label for="chkEnableMirrorMode">Enable display mirroring</label><input type="checkbox" class="chkEnableMirrorMode" id="chkEnableMirrorMode" data-mini="true"' + checkedHtml + ' /></div>';
html += '</form>';
@ -488,7 +509,7 @@
$('.players', elem).html(getTargetsHtml(targets)).trigger('create');
$('.chkEnableMirrorMode', elem).on().on('change', function () {
enableMirrorMode = this.checked;
setMirrorModeEnabled(this.checked);
if (this.checked && currentDisplayInfo) {
@ -506,7 +527,6 @@
$('.fldMirrorMode', elem).show();
} else {
$('.fldMirrorMode', elem).hide();
$('.chkEnableMirrorMode', elem).checked(false).trigger('change').checkboxradio('refresh');
}
}).each(function () {
@ -532,6 +552,12 @@
deviceName: deviceName
});
if (currentDisplayInfo) {
mirrorIfEnabled(currentDisplayInfo);
}
});
});
}
@ -610,9 +636,7 @@
currentDisplayInfo = info;
if (enableMirrorMode) {
mirrorItem(info);
}
mirrorIfEnabled(info);
});
})(jQuery, window);
})(jQuery, window, window.store);

View File

@ -200,6 +200,8 @@
self.setCurrentTrackElement = function (index) {
var modes = ['disabled', 'showing', 'hidden'];
var textStreams = self.currentMediaSource.MediaStreams.filter(function (s) {
return s.Type == 'Subtitle' && s.IsTextSubtitleStream;
});
@ -219,13 +221,26 @@
var mode;
if (trackIndex == i) {
mode = "showing"; // show this track
mode = 1; // show this track
} else {
mode = "disabled"; // hide all other tracks
mode = 0; // hide all other tracks
}
console.log('Setting track ' + i + ' mode to: ' + mode);
allTracks[i].mode = mode;
// Safari uses integers for the mode property
// http://www.jwplayer.com/html5/scripting/
var useNumericMode = false;
if (!isNaN(allTracks[i].mode)) {
useNumericMode = true;
}
if (useNumericMode) {
allTracks[i].mode = mode;
} else {
allTracks[i].mode = modes[mode];
}
}
};

View File

@ -555,14 +555,7 @@
self.displayContent = function (options) {
// Handle it the same as a remote control command
Dashboard.onBrowseCommand({
ItemName: options.itemName,
ItemType: options.itemType,
ItemId: options.itemId,
Context: options.context
});
Dashboard.onBrowseCommand(options);
};
self.getItemsForPlayback = function (query) {

View File

@ -157,14 +157,7 @@
self.displayContent = function (options) {
sendCommandByName('DisplayContent', {
ItemName: options.itemName,
ItemType: options.itemType,
ItemId: options.itemId,
Context: options.context
});
sendCommandByName('DisplayContent', options);
};
self.getPlayerState = function () {