import React, { useState } from 'react';
import { ComponentStory } from '@storybook/react';
import { selectPeers, useHMSStore, useVideoList } from '@100mslive/react-sdk';
import { MicOffIcon } from '@100mslive/react-icons';
import { Video } from '../Video/Video';
import { StyledVideoTile } from '../VideoTile';
import { StyledVideoList } from './StyledVideoList';
import { getLeft } from './videoListUtils';
const VideoListMeta = {
title: 'Video/VideoList',
};
export default VideoListMeta;
const VideoTile: React.FC<{ width: number; height: number; trackId: string; name: string }> = ({
width,
height,
trackId,
name,
}) => {
return (
{name}
);
};
interface VideoListProps {
maxTileCount: number;
aspectRatio: {
width: number;
height: number;
};
}
const VideoListStory: React.FC = ({ maxTileCount, aspectRatio }) => {
const peers = useHMSStore(selectPeers);
const [page] = useState(0);
const { ref, pagesWithTiles } = useVideoList({
peers,
offsetY: 50,
maxTileCount,
aspectRatio,
});
return (
{pagesWithTiles && pagesWithTiles.length > 0
? pagesWithTiles.map((tiles, pageNo) => (
{tiles.map((tile, i) =>
tile.track?.source === 'screen' ? null : (
),
)}
))
: null}
);
};
const Template: ComponentStory = args => ;
export const Example = Template.bind({});
Example.args = {
maxTileCount: 2,
aspectRatio: {
width: 2,
height: 1,
},
};