The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/webrtc/client/tabBar.tsx

32 lines
962 B

import { useMemo, useCallback } from 'react';
import { useSetting } from '../../../client/contexts/SettingsContext';
import { addAction } from '../../../client/views/room/lib/Toolbox';
import { APIClient } from '../../utils/client';
addAction('webRTCVideo', ({ room }) => {
const enabled = useSetting('WebRTC_Enabled') && useSetting('Omnichannel_call_provider') === 'WebRTC' && room.servedBy;
const handleClick = useCallback(async (): Promise<void> => {
if (!room.callStatus || room.callStatus === 'declined' || room.callStatus === 'ended') {
await APIClient.v1.get('livechat/webrtc.call', { rid: room._id });
}
window.open(`/meet/${room._id}`, room._id);
}, [room._id, room.callStatus]);
return useMemo(
() =>
enabled
? {
groups: ['live'],
id: 'webRTCVideo',
title: 'WebRTC_Call',
icon: 'phone',
action: handleClick,
full: true,
order: 4,
}
: null,
[enabled, handleClick],
);
});