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

Merge pull request #1909 from iwalton3/auto-cast

Add Auto Cast Feature
This commit is contained in:
dkanada 2020-09-23 16:16:54 +09:00 committed by GitHub
commit ec44723ee6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 71 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;
@ -221,6 +222,14 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
html += '</div>';
if (autocast.supported()) {
html += '<div><label class="checkboxContainer">';
var checkedHtmlAC = autocast.isEnabled() ? ' checked' : '';
html += '<input type="checkbox" is="emby-checkbox" class="chkAutoCast"' + checkedHtmlAC + '/>';
html += '<span>' + globalize.translate('EnableAutoCast') + '</span>';
html += '</label></div>';
}
html += '<div style="margin-top:1em;display:flex;justify-content: flex-end;">';
html += '<button is="emby-button" type="button" class="button-flat btnRemoteControl promptDialogButton">' + globalize.translate('HeaderRemoteControl') + '</button>';
@ -237,6 +246,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 +284,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;