-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use bitmovin-player-react instead of custom made
* refactor channel switcher button to separate component * set channel switcher button component based on stream selected / hovered Signed-off-by: eXhumer <[email protected]>
- Loading branch information
Showing
27 changed files
with
126 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { F1TV } from '@exhumer/f1tv-api'; | ||
import { useState } from 'react'; | ||
import { usePlayerSelector } from '../Hook'; | ||
|
||
type StreamType = F1TV.ContentVideoContainer['metadata']['additionalStreams'][number]; | ||
|
||
type StreamSwitcherButtonProps = { | ||
onClick: (stream: StreamType) => void; | ||
stream: StreamType; | ||
}; | ||
|
||
const StreamSwitcherButton = ({ onClick, stream }: StreamSwitcherButtonProps) => { | ||
const currentPlayResult = usePlayerSelector(state => state.player.currentPlayResult); | ||
|
||
const [hovered, setHovered] = useState(false); | ||
|
||
return ( | ||
<button | ||
style={{ | ||
backgroundColor: stream.hex, | ||
opacity: currentPlayResult !== null && currentPlayResult.channelId === stream.channelId ? | ||
1 : | ||
hovered ? | ||
0.8 : | ||
0.5, | ||
}} | ||
onClick={() => onClick(stream)} | ||
onMouseEnter={() => setHovered(true)} | ||
onMouseLeave={() => setHovered(false)} | ||
> | ||
{stream.reportingName} | ||
</button> | ||
); | ||
}; | ||
|
||
export default StreamSwitcherButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.