Add aria-title attribute to video player. For #1826
This commit is contained in:
@@ -335,7 +335,13 @@ export const Content: FC = () => {
|
|||||||
<div className={styles.mainSection}>
|
<div className={styles.mainSection}>
|
||||||
<div className={styles.topSection}>
|
<div className={styles.topSection}>
|
||||||
{appState.appLoading && <Skeleton loading active paragraph={{ rows: 7 }} />}
|
{appState.appLoading && <Skeleton loading active paragraph={{ rows: 7 }} />}
|
||||||
{online && <OwncastPlayer source="/hls/stream.m3u8" online={online} />}
|
{online && (
|
||||||
|
<OwncastPlayer
|
||||||
|
source="/hls/stream.m3u8"
|
||||||
|
online={online}
|
||||||
|
title={streamTitle || name}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{!online && !appState.appLoading && (
|
{!online && !appState.appLoading && (
|
||||||
<OfflineBanner
|
<OfflineBanner
|
||||||
streamName={name}
|
streamName={name}
|
||||||
|
|||||||
@@ -34,4 +34,5 @@ export const LiveDemo = Template.bind({});
|
|||||||
LiveDemo.args = {
|
LiveDemo.args = {
|
||||||
online: true,
|
online: true,
|
||||||
source: 'https://watch.owncast.online/hls/stream.m3u8',
|
source: 'https://watch.owncast.online/hls/stream.m3u8',
|
||||||
|
title: 'Stream title',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { isVideoPlayingAtom, clockSkewAtom } from '../../stores/ClientConfigStor
|
|||||||
import PlaybackMetrics from '../metrics/playback';
|
import PlaybackMetrics from '../metrics/playback';
|
||||||
import createVideoSettingsMenuButton from '../settings-menu';
|
import createVideoSettingsMenuButton from '../settings-menu';
|
||||||
import LatencyCompensator from '../latencyCompensator';
|
import LatencyCompensator from '../latencyCompensator';
|
||||||
|
|
||||||
import styles from './OwncastPlayer.module.scss';
|
import styles from './OwncastPlayer.module.scss';
|
||||||
|
|
||||||
const VIDEO_CONFIG_URL = '/api/video/variants';
|
const VIDEO_CONFIG_URL = '/api/video/variants';
|
||||||
@@ -26,6 +25,7 @@ export type OwncastPlayerProps = {
|
|||||||
source: string;
|
source: string;
|
||||||
online: boolean;
|
online: boolean;
|
||||||
initiallyMuted?: boolean;
|
initiallyMuted?: boolean;
|
||||||
|
title: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function getVideoSettings() {
|
async function getVideoSettings() {
|
||||||
@@ -44,6 +44,7 @@ export const OwncastPlayer: FC<OwncastPlayerProps> = ({
|
|||||||
source,
|
source,
|
||||||
online,
|
online,
|
||||||
initiallyMuted = false,
|
initiallyMuted = false,
|
||||||
|
title,
|
||||||
}) => {
|
}) => {
|
||||||
const playerRef = React.useRef(null);
|
const playerRef = React.useRef(null);
|
||||||
const [videoPlaying, setVideoPlaying] = useRecoilState<boolean>(isVideoPlayingAtom);
|
const [videoPlaying, setVideoPlaying] = useRecoilState<boolean>(isVideoPlayingAtom);
|
||||||
@@ -85,13 +86,13 @@ export const OwncastPlayer: FC<OwncastPlayerProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const setLatencyCompensatorItemTitle = title => {
|
const setLatencyCompensatorItemTitle = t => {
|
||||||
const item = document.querySelector('.latency-toggle-item > .vjs-menu-item-text');
|
const item = document.querySelector('.latency-toggle-item > .vjs-menu-item-text');
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.innerHTML = title;
|
item.innerHTML = t;
|
||||||
};
|
};
|
||||||
|
|
||||||
const startLatencyCompensator = () => {
|
const startLatencyCompensator = () => {
|
||||||
@@ -310,7 +311,7 @@ export const OwncastPlayer: FC<OwncastPlayerProps> = ({
|
|||||||
<div className={styles.container} id="player">
|
<div className={styles.container} id="player">
|
||||||
{online && (
|
{online && (
|
||||||
<div className={styles.player}>
|
<div className={styles.player}>
|
||||||
<VideoJS options={videoJsOptions} onReady={handlePlayerReady} />
|
<VideoJS options={videoJsOptions} onReady={handlePlayerReady} aria-label={title} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className={styles.poster}>
|
<div className={styles.poster}>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function VideoEmbed() {
|
|||||||
const { name } = clientConfig;
|
const { name } = clientConfig;
|
||||||
|
|
||||||
const { offlineMessage } = clientConfig;
|
const { offlineMessage } = clientConfig;
|
||||||
const { viewerCount, lastConnectTime, lastDisconnectTime } = status;
|
const { viewerCount, lastConnectTime, lastDisconnectTime, streamTitle } = status;
|
||||||
const online = useRecoilValue<boolean>(isOnlineSelector);
|
const online = useRecoilValue<boolean>(isOnlineSelector);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -48,6 +48,7 @@ export default function VideoEmbed() {
|
|||||||
source="/hls/stream.m3u8"
|
source="/hls/stream.m3u8"
|
||||||
online={online}
|
online={online}
|
||||||
initiallyMuted={initiallyMuted}
|
initiallyMuted={initiallyMuted}
|
||||||
|
title={streamTitle || name}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!online && (
|
{!online && (
|
||||||
|
|||||||
Reference in New Issue
Block a user