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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>Daily - Circle Integration Test</title> | |
<link rel="stylesheet" href="/style.css" /> | |
<script src="/script.js" defer></script> | |
</head> |
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
// In Tray.js | |
function toggleCamera() { | |
callObject.setLocalVideo(isCameraMuted); | |
} | |
function toggleMic() { | |
callObject.setLocalAudio(isMicMuted); | |
} |
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
// In Tray.js | |
function getStreamStates(callObject) { | |
let isCameraMuted, | |
isMicMuted, | |
isSharingScreen = false; | |
if ( | |
callObject && | |
callObject.participants() && | |
callObject.participants().local |
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
// In Tile.js | |
export default function Tile(props) { | |
const videoEl = useRef(null); | |
const audioEl = useRef(null); | |
// ... | |
function getVideoComponent() { | |
return videoTrack && <video autoPlay muted playsInline ref={videoEl} />; |
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
function getTiles() { | |
let largeTiles = []; | |
let smallTiles = []; | |
Object.entries(callState.callItems).forEach(([id, callItem]) => { | |
const isLarge = | |
isScreenShare(id) || | |
(!isLocal(id) && !containsScreenShare(callState.callItems)); | |
const tile = ( | |
<Tile | |
key={id} |
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
// In callState.js | |
function getCallItems(participants) { | |
let callItems = { ...initialCallState.callItems }; // Ensure we *always* have a local participant | |
for (const [id, participant] of Object.entries(participants)) { | |
callItems[id] = { | |
videoTrackState: participant.tracks.video, | |
audioTrackState: participant.tracks.audio, | |
}; | |
if (shouldIncludeScreenCallItem(participant)) { |
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
{ | |
local: { | |
videoTrackState: null, | |
audioTrackState: null, | |
}, | |
<other-participant-1>: { | |
/*...*/ | |
}, | |
<other-participant-1>-screen: { | |
/*...*/ |
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
// In Call.js | |
useEffect(() => { | |
if (!callObject) return; | |
const events = [ | |
"participant-joined", | |
"participant-updated", | |
"participant-left" | |
]; |
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
// In App.js | |
/** | |
* Starts leaving the current call. | |
*/ | |
const startLeavingCall = useCallback(() => { | |
if (!callObject) return; | |
// update component state to a "leaving" state... | |
callObject.leave(); | |
}, [callObject]); |
NewerOlder