1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add auto-cast feature.

This commit is contained in:
Ian Walton 2020-09-07 12:54:12 -04:00
parent f31801c85b
commit e9caf5e336
6 changed files with 81 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import playbackManager from 'playbackManager';
import appRouter from 'appRouter';
import globalize from 'globalize';
import appHost from 'apphost';
import * as autocast from 'autocast';
function mirrorItem(info, player) {
var item = info.item;
@ -219,6 +220,16 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
html += '</label>';
}
html += '</div><div>';
if (autocast.supported()) {
html += '<label class="checkboxContainer">';
var checkedHtml = autocast.isEnabled() ? ' checked' : '';
html += '<input type="checkbox" is="emby-checkbox" class="chkAutoCast"' + checkedHtml + '/>';
html += '<span>' + globalize.translate('EnableAutoCast') + '</span>';
html += '</label>';
}
html += '</div>';
html += '<div style="margin-top:1em;display:flex;justify-content: flex-end;">';
@ -237,6 +248,12 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
chkMirror.addEventListener('change', onMirrorChange);
}
var chkAutoCast = dlg.querySelector('.chkAutoCast');
if (chkAutoCast) {
chkAutoCast.addEventListener('change', onAutoCastChange);
}
var destination = '';
var btnRemoteControl = dlg.querySelector('.btnRemoteControl');
@ -269,6 +286,10 @@ function onMirrorChange() {
playbackManager.enableDisplayMirroring(this.checked);
}
function onAutoCastChange() {
autocast.enable(this.checked);
}
document.addEventListener('viewshow', function (e) {
var state = e.detail.state || {};
var item = state.item;