Skip to content

Commit

Permalink
Fix Firefox styling for slider and player alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Lillifee committed Feb 14, 2023
1 parent d68602d commit 297c2b1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/site/components/stream/BroadwayPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Container = styled.div`
const VideoContainer = styled.div`
display: flex;
margin: 0 auto;
justify-content: center;
> canvas {
max-width: 100%;
Expand Down
9 changes: 5 additions & 4 deletions src/site/components/stream/JMuxerPlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import styled from 'styled-components';
// import { abbreviateNumber, roundToSignificant } from '../../../shared/helperFunctions.js';
import { BlurOverlay } from './Common.js';
import { createPlayerOptions, player, Player, PlayerOptions } from './player.js';
import { createInitialPlayerStats, PlayerStats } from './stats.js';
Expand All @@ -16,6 +17,7 @@ const Container = styled.div`
const VideoContainer = styled.div`
display: flex;
margin: 0 auto;
justify-content: center;
`;

const Video = styled.video`
Expand All @@ -37,7 +39,7 @@ const jMuxerPlayer = (playerOptions: PlayerOptions): Player => {
* Player hook
* Creates a JMuxer player instance and append it to the passed container
*
* @param {string} url websocket url without (e.g. 192.168.1.10:8081)
* @param {string} url
*/
const usePlayer = (url: string) => {
const [stats, setStats] = React.useState<PlayerStats>(createInitialPlayerStats());
Expand Down Expand Up @@ -74,9 +76,8 @@ export const JMuxerPlayer: React.FC<PlayerProps> = ({ loading }) => {
$blur={loading || !stats.streamRunning || !stats.playerRunning || stats.droppingFrames}
>
{/* <div>dropped: {stats.totalDroppedFrames}</div>
<div>frames: {stats.framesPerCycle}</div>
<div>avgFps: {stats.avgFps}</div>
<div>avgSize: {abbreviateNumber('bit/s')(roundToSignificant(stats.avgSize, 2))}</div>
<div>frames per second: {stats.avgFps}</div>
<div>average size: {abbreviateNumber('bit/s')(roundToSignificant(stats.avgSize, 2))}</div>
{loading && <div>loading</div>}
{!stats.playerRunning && <div>player not running</div>}
{!stats.streamRunning && <div>stream not running</div>}
Expand Down
1 change: 1 addition & 0 deletions src/site/components/stream/MJPEGPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const Container = styled.div`
const VideoContainer = styled.div`
display: flex;
margin: 0 auto;
justify-content: center;
`;

const Image = styled.img`
Expand Down
45 changes: 30 additions & 15 deletions src/site/components/styled/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import * as React from 'react';
import styled from 'styled-components';
import styled, { css } from 'styled-components';

export interface SliderProps {
$unset?: boolean;
}

const trackCss = css<SliderProps>`
width: 100%;
height: 8px;
cursor: pointer;
background: ${(props) => props.theme.Background};
border-radius: 3px;
`;

const thumbCss = css<SliderProps>`
cursor: pointer;
pointer-events: auto;
appearance: none;
width: 22px;
height: 22px;
background: ${({ $unset, theme }) => ($unset ? theme.Background : theme.PrimaryBackground)};
border: 1px solid ${(props) => props.theme.Border};
border-radius: 15px;
margin-top: -7px;
`;

const SliderStyled = styled.input<SliderProps>`
flex: 1;
min-height: 25px;
Expand All @@ -16,24 +36,19 @@ const SliderStyled = styled.input<SliderProps>`
@media only screen and (max-width: 1000px) {
pointer-events: none;
}
&::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
cursor: pointer;
background: ${(props) => props.theme.Background};
border-radius: 3px;
${trackCss}
}
&::-moz-range-track {
${trackCss}
}
&::-webkit-slider-thumb {
cursor: pointer;
pointer-events: auto;
appearance: none;
width: 22px;
height: 22px;
background: ${({ $unset, theme }) => ($unset ? theme.Background : theme.PrimaryBackground)};
border: 1px solid ${(props) => props.theme.Border};
border-radius: 15px;
margin-top: -7px;
${thumbCss}
}
&::-moz-range-thumb {
${thumbCss}
}
&:disabled {
Expand Down

0 comments on commit 297c2b1

Please sign in to comment.