Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Safari reporting wrong initial track resolution #898

Merged
merged 5 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/late-starfishes-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Fix Safari reporting wrong initial track resolution
6 changes: 6 additions & 0 deletions src/room/track/LocalTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ export default abstract class LocalTrack extends Track {
throw new Error('cannot get dimensions for audio tracks');
}

if (getBrowser()?.os === 'iOS') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow... just.... 🤯

// browsers report wrong initial resolution on iOS.
// when slightly delaying the call to .getSettings(), the correct resolution is being reported
await sleep(10);
}

const started = Date.now();
while (Date.now() - started < timeout) {
const dims = this.dimensions;
Expand Down
Loading