33 useParticipants ,
44} from "@livekit/components-react" ;
55import { motion } from "framer-motion" ;
6- import { useCallback , useEffect , useRef , useState , MouseEvent } from "react" ;
6+ import { useCallback , useEffect , useRef , useState , MouseEvent as ReactMouseEvent } from "react" ;
77
88export function PushToTalkButton ( ) {
99 const { localParticipant } = useLocalParticipant ( ) ;
@@ -25,7 +25,7 @@ export function PushToTalkButton() {
2525 } , [ localParticipant , agent ] ) ;
2626
2727 // when user presses the button
28- const handleMouseDown = useCallback ( async ( e : MouseEvent < HTMLButtonElement > ) => {
28+ const handleMouseDown = useCallback ( async ( e : ReactMouseEvent < HTMLButtonElement > ) => {
2929 e . preventDefault ( ) ; // prevent default browser behavior
3030
3131 if ( ! agent || ! localParticipant ) return ;
@@ -87,7 +87,7 @@ export function PushToTalkButton() {
8787 } , [ agent , localParticipant , isPressed ] ) ;
8888
8989 // when user releases the mouse anywhere
90- const handleMouseUp = useCallback ( ( e : MouseEvent ) => {
90+ const handleMouseUp = useCallback ( ( e : ReactMouseEvent ) => {
9191 e . preventDefault ( ) ; // prevent default browser behavior
9292
9393 if ( ! isPressed ) return ;
@@ -111,12 +111,12 @@ export function PushToTalkButton() {
111111 useEffect ( ( ) => {
112112 if ( isPressed ) {
113113 const handleGlobalMouseUp = ( e : MouseEvent ) => {
114- handleMouseUp ( e ) ;
114+ handleMouseUp ( e as unknown as ReactMouseEvent ) ;
115115 } ;
116116
117- window . addEventListener ( 'mouseup' , handleGlobalMouseUp as any ) ;
117+ window . addEventListener ( 'mouseup' , handleGlobalMouseUp ) ;
118118 return ( ) => {
119- window . removeEventListener ( 'mouseup' , handleGlobalMouseUp as any ) ;
119+ window . removeEventListener ( 'mouseup' , handleGlobalMouseUp ) ;
120120 } ;
121121 }
122122 } , [ isPressed , handleMouseUp ] ) ;
0 commit comments