Skip to content

Commit

Permalink
Specify more explicit browser targets (#405)
Browse files Browse the repository at this point in the history
* specify more explicit browser targets

* add compatibility note in readme

* rename to isBrowserSupported

* fix typo

* refer to package.json

* changeset
  • Loading branch information
lukasIO committed Aug 19, 2022
1 parent 4bed0e6 commit 2983939
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-experts-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-client': patch
---

Update browserslist
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,12 @@ setLogExtension((level: LogLevel, msg: string, context: object) => {
| Firefox | Windows, macOS, Linux | Android |
| Safari | macOS | iOS |
| Edge (Chromium) | Windows, macOS | |

We aim to support a broad range of browser versions by transpiling the library code with babel.
You can have a look at the `"browerslist"` section of `package.json` for more details.

> Note that the library requires some specific browser APIs to be present.
> You can check general compatibility with the helper function `isBrowserSupported()`.
> Support for more modern features like adaptiveStream and dynacast can be checked for with `supportsAdaptiveStream()` and `supportsDynacast()`.
If you are targeting legacy browsers, but still want adaptiveStream functionality you'll likely need to use polyfills for [ResizeObserver](https://www.npmjs.com/package/resize-observer-polyfill) and [IntersectionObserver](https://www.npmjs.com/package/intersection-observer).
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@
"typescript": "4.7.4"
},
"browserslist": [
"defaults",
"safari >= 11",
"not IE 11"
"ios_saf >= 11",
"chrome >= 56",
"and_chr >= 56",
"android >= 56",
"firefox >= 53",
"edge >= 50",
"Samsung >= 6.0",
"not IE 11",
"not dead"
]
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { TrackPublication } from './room/track/TrackPublication';
import {
getEmptyAudioStreamTrack,
getEmptyVideoStreamTrack,
isDeviceSupported,
isBrowserSupported,
supportsAdaptiveStream,
supportsDynacast,
} from './room/utils';
Expand All @@ -36,7 +36,7 @@ export {
setLogExtension,
getEmptyAudioStreamTrack,
getEmptyVideoStreamTrack,
isDeviceSupported,
isBrowserSupported,
supportsAdaptiveStream,
supportsDynacast,
LogLevel,
Expand Down
2 changes: 1 addition & 1 deletion src/room/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function supportsDynacast() {
return supportsTransceiver();
}

export function isDeviceSupported() {
export function isBrowserSupported() {
return supportsTransceiver() || supportsAddTrack();
}

Expand Down

0 comments on commit 2983939

Please sign in to comment.