Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 631_user_login
Browse files Browse the repository at this point in the history
 merage origin main
  • Loading branch information
xdzqyyds committed Dec 6, 2024
2 parents 0b47a10 + 44650eb commit 1b81f48
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/flyio.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Deploy to Fly

on:
branches:
- main
push:
branches:
- main

jobs:
deploy:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ webapp:

.PHONY: webapp-clean
webapp-clean:
rm -r dist
rm -r static/dist

.PHONY: clean
clean: webapp-clean
Expand Down
23 changes: 23 additions & 0 deletions webapp/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@ export default function Layout(props: { meetingId: string }) {
setMeetingJoined(false)
}

useEffect(() => {
const cleanup = () => {
delStream(props.meetingId, localStreamId)
}
// NOTE:
// https://github.com/binbat/woom/pull/27
// https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event
// `unload` event is Deprecated, But Firefox need `unload`
//
// event | Chrome | Firefox | Safari
// ---------------------------- | ------------------------- | ------------------------- | -----
// `beforeunload` | ok | console error, no request | console error, request ok
// `unload` | console error, no request | ok | console no request log, no request
// `beforeunload` + `keepalive` | ok | console error, no request | console error, request ok
// `unload` + `keepalive` | console error, request ok | ok | console no request log, request ok
window.addEventListener('beforeunload', cleanup)
window.addEventListener('unload', cleanup)
return () => {
window.removeEventListener('beforeunload', cleanup)
window.removeEventListener('unload', cleanup)
}
}, [props.meetingId, localStreamId])

//useEffect(() => {
// let shareScreenId = ""
// const setShareScreenId = (id: string) => shareScreenId = id
Expand Down
1 change: 1 addition & 0 deletions webapp/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async function delStream(roomId: string, streamId: string): Promise<any> {
'Authorization': `Bearer ${token}`,
},
method: 'DELETE',
keepalive: true,
})
}

Expand Down
4 changes: 2 additions & 2 deletions webapp/lib/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ async function asyncGetVideoStream(deviceId: string): Promise<MediaStream> {
if (deviceId === 'none') {
/* empty */
} else if (deviceId === 'screen') {
stream = await navigator.mediaDevices.getDisplayMedia({ audio: false, video: { width: 640 } })
stream = await navigator.mediaDevices.getDisplayMedia({ audio: false, video: { height: 720 } })
} else {
stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { width: 320, deviceId: deviceId } })
stream = await navigator.mediaDevices.getUserMedia({ audio: false, video: { height: 480, deviceId: deviceId } })
}
return stream
}
Expand Down

0 comments on commit 1b81f48

Please sign in to comment.