Skip to content

Commit

Permalink
don't use resolution for safari screen share.
Browse files Browse the repository at this point in the history
  • Loading branch information
jibon57 committed Oct 13, 2023
1 parent f715492 commit d80abe2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"i18next": "23.5.1",
"i18next-browser-languagedetector": "7.1.0",
"i18next-http-backend": "2.2.2",
"livekit-client": "1.13.4",
"livekit-client": "^1.13.4",
"lodash": "4.17.21",
"microsoft-cognitiveservices-speech-sdk": "1.32.0",
"mobile-detect": "1.4.5",
Expand Down
27 changes: 21 additions & 6 deletions src/components/footer/icons/screenshare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import React, { useEffect, useState, useCallback } from 'react';
import { createSelector } from '@reduxjs/toolkit';
import { useTranslation } from 'react-i18next';
import { toast } from 'react-toastify';
import { createLocalScreenTracks, Room, Track } from 'livekit-client';
import {
createLocalScreenTracks,
Room,
ScreenShareCaptureOptions,
Track,
} from 'livekit-client';

import {
RootState,
Expand Down Expand Up @@ -116,13 +121,23 @@ const ScrenshareIcon = ({ currentRoom }: IScrenshareIconProps) => {
return;
}

const localTracks = await createLocalScreenTracks({
const option: ScreenShareCaptureOptions = {
audio: true,
resolution: getScreenShareResolution(),
});
localTracks.forEach(async (track) => {
};
// because of one bug we'll disable to set regulation for safari
// https://bugs.webkit.org/show_bug.cgi?id=263015
const isSafari = /^((?!chrome|android).)*safari/i.test(
navigator.userAgent,
);
if (!isSafari) {
option.resolution = getScreenShareResolution();
}

const localTracks = await createLocalScreenTracks(option);
for (let i = 0; i < localTracks.length; i++) {
const track = localTracks[i];
await currentRoom.localParticipant.publishTrack(track);
});
}

dispatch(updateIsActiveScreenshare(true));
dispatch(
Expand Down
5 changes: 4 additions & 1 deletion src/components/main-area/mainComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ const MainComponents = ({
const whiteboardElm = useMemo(() => {
// if we disable whiteboard during that time we should collect elements from parent component
// otherwise if we make it null then we won't be able to get last state
if (!isActiveWhiteboard && excalidrawAPI) {
if (
((isActiveWhiteboard && isActiveScreenShare) || !isActiveWhiteboard) &&
excalidrawAPI
) {
const s = store.getState();
const isPresenter = s.session.currentUser?.metadata?.is_presenter;
// we'll only do it for presenter
Expand Down

0 comments on commit d80abe2

Please sign in to comment.