fix linting errors

This commit is contained in:
DispatchCommit 2021-01-25 15:50:11 -08:00 committed by Sean Yesmunt
parent ee28648852
commit 52f883be4e

View file

@ -354,7 +354,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
if (!player) { if (!player) {
return; return;
} }
// Add various event listeners to player // Add various event listeners to player
player.one('play', onInitialPlay); player.one('play', onInitialPlay);
player.on('volumechange', onVolumeChange); player.on('volumechange', onVolumeChange);
@ -363,7 +363,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// Replace volume bar with custom LBRY volume bar // Replace volume bar with custom LBRY volume bar
LbryVolumeBarClass.replaceExisting(player); LbryVolumeBarClass.replaceExisting(player);
// initialize mobile UI // initialize mobile UI
player.mobileUi(); // Inits mobile version. No-op if Desktop. player.mobileUi(); // Inits mobile version. No-op if Desktop.
@ -376,9 +376,6 @@ export default React.memo<Props>(function VideoJs(props: Props) {
displayCurrentQuality: true, displayCurrentQuality: true,
}); });
// Add reference to player to global scope
window.player = player;
// fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498) // fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498)
// summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar // summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar
player.on('fullscreenchange', () => document.activeElement && document.activeElement.blur()); player.on('fullscreenchange', () => document.activeElement && document.activeElement.blur());
@ -391,6 +388,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
const vjsElement = createVideoPlayerDOM(containerRef.current); const vjsElement = createVideoPlayerDOM(containerRef.current);
const vjsPlayer = initializeVideoPlayer(vjsElement); const vjsPlayer = initializeVideoPlayer(vjsElement);
// Add reference to player to global scope
window.player = vjsPlayer;
// Add event listener for keyboard shortcuts // Add event listener for keyboard shortcuts
window.addEventListener('keydown', handleKeyDown); window.addEventListener('keydown', handleKeyDown);
@ -402,7 +402,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
player.dispose(); player.dispose();
window.player = undefined; window.player = undefined;
} }
} };
}, []); }, []);
// Update video player and reload when source URL changes // Update video player and reload when source URL changes
@ -419,9 +419,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// override type if we receive an .m3u8 (transcoded mp4) // override type if we receive an .m3u8 (transcoded mp4)
if ( if (
response && response &&
response.redirected && response.redirected &&
response.url && response.url &&
response.url.endsWith('m3u8') response.url.endsWith('m3u8')
) { ) {
type = 'application/x-mpegURL'; type = 'application/x-mpegURL';
@ -429,7 +429,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// Update player poster // Update player poster
// note: the poster prop seems to return null usually. // note: the poster prop seems to return null usually.
if ( poster ) player.poster(poster); if (poster) player.poster(poster);
// Update player source // Update player source
player.src({ player.src({