Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main to dev #1625

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import { useMeasure, useMedia } from 'react-use';
import {
getPeersWithTiles,
Expand Down Expand Up @@ -30,6 +30,8 @@ export function EqualProminence() {
const [pagesWithTiles, setPagesWithTiles] = useState([]);
const [page, setPage] = useState(0);
const [ref, { width, height }] = useMeasure();
const peersSorter = useMemo(() => new PeersSorter(vanillaStore), [vanillaStore]);
const pageSize = pagesWithTiles[0]?.length;

useEffect(() => {
// currentPageIndex should not exceed pages length
Expand Down Expand Up @@ -126,17 +128,12 @@ export function EqualProminence() {
if (page !== 0) {
return;
}
const peersSorter = new PeersSorter(vanillaStore);
peersSorter.setPeersAndTilesPerPage({
peers,
tilesPerPage: pagesWithTiles[0]?.length || maxTileCount,
tilesPerPage: pageSize || maxTileCount,
});
peersSorter.onUpdate(setSortedPeers);

return () => {
peersSorter.stop();
};
}, [page, vanillaStore, peers, pagesWithTiles, maxTileCount]);
}, [page, peersSorter, peers, pageSize, maxTileCount]);

return (
<Flex direction="column" css={{ flex: '1 1 0', h: '100%', position: 'relative', minWidth: 0 }}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { useMedia } from 'react-use';
import { HMSRoomState, selectRoomState, useHMSStore } from '@100mslive/react-sdk';
import { config as cssConfig, Flex, VerticalDivider } from '../../../';
import { config as cssConfig, Flex } from '../../../';
import { Logo, SpeakerTag } from './HeaderComponents';
import { StreamActions } from './StreamActions';
import { LiveStatus, RecordingStatus, StreamActions } from './StreamActions';
import { AudioOutputActions, CamaraFlipActions } from './common';

export const ConferencingHeader = () => {
Expand Down Expand Up @@ -32,10 +32,15 @@ export const ConferencingHeader = () => {
}
return (
<Flex justify="between" align="center" css={{ position: 'relative', height: '100%' }}>
<Flex align="center" css={{ position: 'absolute', left: '$10' }}>
<Flex align="center" gap="2" css={{ position: 'absolute', left: '$10' }}>
<Logo />
<VerticalDivider css={{ ml: '$8' }} />
<SpeakerTag />
{isMobile && (
<Flex align="center" css={{ gap: '$4' }}>
<LiveStatus />
<RecordingStatus />
</Flex>
)}
</Flex>
<Flex
align="center"
Expand All @@ -49,7 +54,7 @@ export const ConferencingHeader = () => {
{isMobile && (
<>
<CamaraFlipActions />
<AudioOutputActions />{' '}
<AudioOutputActions />
</>
)}
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@ import React from 'react';
import { useMedia } from 'react-use';
import { selectDominantSpeaker, selectIsConnectedToRoom, useHMSStore } from '@100mslive/react-sdk';
import { VolumeOneIcon } from '@100mslive/react-icons';
import { config as cssConfig, Flex, styled, Text, textEllipsis } from '../../../';
import { config as cssConfig, Flex, styled, Text, textEllipsis, VerticalDivider } from '../../../';
import { useRoomLayout } from '../../provider/roomLayoutProvider';
import { isStreamingKit } from '../../common/utils';

export const SpeakerTag = () => {
const dominantSpeaker = useHMSStore(selectDominantSpeaker);
return dominantSpeaker && dominantSpeaker.name ? (
<Flex
align="center"
justify="center"
css={{ flex: '1 1 0', color: '$on_primary_high', '@md': { display: 'none' } }}
>
<VolumeOneIcon />
<Text variant="md" css={{ ...textEllipsis(200), ml: '$2' }} title={dominantSpeaker.name}>
{dominantSpeaker.name}
</Text>
</Flex>
) : (
<></>
return (
dominantSpeaker &&
dominantSpeaker.name && (
<Flex
align="center"
justify="center"
css={{ flex: '1 1 0', color: '$on_primary_high', '@md': { display: 'none' } }}
>
<VerticalDivider css={{ ml: '$8' }} />
<VolumeOneIcon />
<Text variant="md" css={{ ...textEllipsis(200), ml: '$2' }} title={dominantSpeaker.name}>
{dominantSpeaker.name}
</Text>
</Flex>
)
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const LiveStatus = () => {
}, [hlsState?.running, hlsState?.variants]);

useEffect(() => {
if (hlsState?.running && !isMobile) {
if (hlsState?.running) {
startTimer();
}
if (!hlsState?.running && intervalRef.current) {
Expand All @@ -55,25 +55,20 @@ export const LiveStatus = () => {
return null;
}
return (
<Flex align="center" gap="2">
<Box css={{ w: '$4', h: '$4', r: '$round', bg: '$alert_error_default', mr: '$2', '@md': { display: 'none' } }} />
{isMobile ? (
<Text
css={{
bg: '$alert_error_default',
c: 'on_surface_high',
borderRadius: '$0',
padding: '$2 $4 $2 $4',
}}
>
Live
</Text>
) : (
<Text>LIVE</Text>
)}
<Text variant="caption" css={{ '@md': { display: 'none' } }}>
{hlsState?.variants?.length > 0 ? formatTime(liveTime) : ''}
</Text>
<Flex
align="center"
gap="1"
css={{
border: '1px solid $border_default',
padding: '$4 $6 $4 $6',
borderRadius: '$1',
}}
>
<Box css={{ w: '$4', h: '$4', r: '$round', bg: '$alert_error_default', mr: '$2' }} />
<Flex align="center" gap="2">
<Text variant={!isMobile ? 'button' : 'body2'}>LIVE</Text>
<Text variant="caption">{hlsState?.variants?.length > 0 ? formatTime(liveTime) : ''}</Text>
</Flex>
</Flex>
);
};
Expand Down Expand Up @@ -236,10 +231,12 @@ export const StreamActions = () => {
return (
<Flex align="center" css={{ gap: '$4' }}>
<AdditionalRoomState />
<Flex align="center" css={{ gap: '$4' }}>
<RecordingStatus />
{roomState !== HMSRoomState.Preview ? <LiveStatus /> : null}
</Flex>
{!isMobile && (
<Flex align="center" css={{ gap: '$4' }}>
<RecordingStatus />
{roomState !== HMSRoomState.Preview ? <LiveStatus /> : null}
</Flex>
)}
{isConnected && !isMobile ? <StartRecording /> : null}
</Flex>
);
Expand Down