LIVE loads YouTube only after Play, and stops when its view is hidden

Selecting a station no longer builds the player: the LIVE section and the
Cockpit's LIVE page show a poster with Play under the line that YouTube sees
the viewer's IP address, as SECURITY.md asks of third-party media. The player
goes when the section collapses, Context collapses or closes, the Cockpit
leaves its LIVE page, or the Cockpit is entered or left, so nothing plays
unseen. A selection that moves straight on to another entry of the same
station (the Cockpit stepping between views) keeps the player instead of
rebuilding it. SECURITY.md also lists the ISS telemetry relay.
This commit is contained in:
Denis Groshev committed 2026-11-17 16:25:04 +01:00
1 parent 71d57481b7
commit 1e2332eeb6
14 files changed
+314 -108

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@ function leaveSignals() {
<a class="cockpit-weather-credit" href="https://open-meteo.com/" target="_blank" rel="noopener">{{ t('Weather data by Open-Meteo.com') }}</a>
</section>
<section data-cockpit-brief-page="live" :aria-label="t('Live video')" :hidden="b.pageId !== 'live'">
<CockpitLivePage v-if="live" />
<CockpitLivePage v-if="live" :shown="b.pageId === 'live'" />
</section>
</div>
<footer class="cockpit-signal-footer">
+19 -2
View File
@@ -1,4 +1,5 @@
<script setup>
import { onBeforeUnmount, watch } from 'vue';
import { t } from '../../../i18n/index.js';
import { useLiveScreen } from '../../liveScreen.js';
@@ -6,11 +7,18 @@ import { useLiveScreen } from '../../liveScreen.js';
// card's measure, for the ridden subject's streams. The briefing renders it
// only while a stream is on offer. LiveControls builds the player into
// `#cockpit-live-player-host` while the Cockpit is on (the right rail, and
// the section's screen with it, is hidden there), and the page's controls
// call LiveControls through the live store, as the section's do.
// the section's screen with it, is hidden there), only when the viewer
// presses Play, under the notice that YouTube sees their IP address. The
// page's controls call LiveControls through the live store, as the section's
// do. Leaving the page, or the page going, stops the player.
const props = defineProps({
/** Whether the briefing shows this page now. */
shown: { type: Boolean, default: true },
});
const {
view,
act,
idle,
playing,
loading,
offline,
@@ -18,6 +26,13 @@ const {
badgeText,
statusText,
} = useLiveScreen();
watch(
() => props.shown,
(now) => {
if (!now) act('hideLive', 'cockpit');
},
);
onBeforeUnmount(() => act('hideLive', 'cockpit'));
</script>
<template>
@@ -31,9 +46,11 @@ const {
<span id="cockpit-live-stream-title" class="live-stream-title" aria-live="polite">{{ t(view.current.title) }}<small v-if="view.count > 1"> · {{ view.index + 1 }}/{{ view.count }}</small></span>
<button v-if="view.count > 1" id="cockpit-live-next" type="button" class="live-step" @click="act('cycleLive', 1)" :aria-label="t('Next stream')" :title="t('Next stream')"><span class="material-symbols-outlined" aria-hidden="true">chevron_right</span></button>
</div>
<p class="live-privacy cockpit-live-privacy">{{ t('Video plays from YouTube, which sees your IP address.') }}</p>
<!-- The player's element stays put across re-renders: LiveControls mounts the player in it. -->
<div class="live-screen" :class="{ active: playing || loading }">
<div id="cockpit-live-player-host" class="live-player-host"></div>
<button v-if="idle" id="cockpit-live-play" type="button" class="live-play" @click="act('playLive')"><span class="material-symbols-outlined" aria-hidden="true">play_arrow</span>{{ t('Play') }}</button>
<div v-if="offline || unavailable" class="live-card" :class="{ offline, unavailable }">
<span class="live-card-dot" aria-hidden="true"></span>
<strong>{{ offline ? t('Stream is offline') : t('This stream cannot play here') }}</strong>
+22 -6
View File
@@ -1,20 +1,24 @@
<script setup>
import { computed } from 'vue';
import { storeToRefs } from 'pinia';
import { computed, onBeforeUnmount, watch } from 'vue';
import { t } from '../../../i18n/index.js';
import RailPanel from '../../rail/RailPanel.vue';
import { vClassToggle } from '../../rail/classToggle.js';
import { useLiveScreen } from '../../liveScreen.js';
import { usePanelChromeStore } from '../../stores/panelChrome.js';
// The LIVE section inside Context: the live streams attached to the selected
// object (LiveControls publishes them), one at a time in the platform's own
// player. It is there only while the selection has a stream, and the stream
// starts as soon as one is chosen (useLiveScreen). The section starts
// collapsed; its +/- hides and shows the body, and the player plays on,
// muted, underneath. Its controls call LiveControls through the store.
// player. It is there only while the selection has a stream. The player is
// loaded only when the viewer presses Play, under the notice that YouTube
// sees their IP address; collapsing the section, collapsing Context, or the
// section leaving the page stops it. Its controls call LiveControls through
// the store.
const PANEL_ID = 'live-panel';
const {
view,
act,
idle,
playing,
loading,
offline,
@@ -22,6 +26,17 @@ const {
badgeText,
statusText,
} = useLiveScreen();
// Nothing plays unseen: a hidden section gives up its player.
const { panels } = storeToRefs(usePanelChromeStore());
const hidden = computed(
() =>
(panels.value[PANEL_ID]?.collapsed ?? true) ||
panels.value['global-context-panel']?.collapsed === true,
);
watch(hidden, (now) => {
if (now) act('hideLive', 'section');
});
onBeforeUnmount(() => act('hideLive', 'section'));
const liveWords = computed(() => ({
expandLabel: t('Expand Live section'),
collapseLabel: t('Collapse Live section'),
@@ -40,9 +55,11 @@ const liveWords = computed(() => ({
<span id="live-stream-title" class="live-stream-title" aria-live="polite">{{ t(view.current.title) }}<small v-if="view.count > 1"> · {{ view.index + 1 }}/{{ view.count }}</small></span>
<button v-if="view.count > 1" id="live-next-btn" type="button" class="live-step" @click="act('cycleLive', 1)" :aria-label="t('Next stream')" :title="t('Next stream')"><span class="material-symbols-outlined" aria-hidden="true">chevron_right</span></button>
</div>
<p class="live-privacy">{{ t('Video plays from YouTube, which sees your IP address.') }}</p>
<!-- The player's element stays put across re-renders: LiveControls mounts the player in it. -->
<div class="live-screen" :class="{ active: playing || loading }">
<div id="live-player-host" class="live-player-host"></div>
<button v-if="idle" id="live-play-btn" type="button" class="live-play" @click="act('playLive')"><span class="material-symbols-outlined" aria-hidden="true">play_arrow</span>{{ t('Play') }}</button>
<div v-if="offline || unavailable" class="live-card" :class="{ offline, unavailable }">
<span class="live-card-dot" aria-hidden="true"></span>
<strong>{{ offline ? t('Stream is offline') : t('This stream cannot play here') }}</strong>
@@ -51,7 +68,6 @@ const liveWords = computed(() => ({
</div>
<p id="live-status" class="live-status" role="status" aria-live="polite">{{ statusText }}</p>
<p class="live-credit"><a :href="view.current.ownerUrl" target="_blank" rel="noopener noreferrer">{{ view.current.owner }}</a> · <a id="live-watch-link" :href="view.current.watchUrl" target="_blank" rel="noopener noreferrer">{{ t('Open on YouTube') }}</a></p>
<p class="live-privacy">{{ t('Video plays from YouTube, which sees your IP address.') }}</p>
</template>
</RailPanel>
</template>