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

Add source option to prevent usage of HLS native implementation #386

Merged
merged 2 commits into from
Oct 13, 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
16 changes: 16 additions & 0 deletions docs/initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,22 @@ sources: [
]
```

### **overrideNative**

You can prevent the use of some browser's native HLS capabilities by setting the flag
`overrideNative` to the video source. This forces the use of Media Source Extensions
to provide a more consistent experience between browsers.

```
sources: [
{
type: 'hls',
file: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
overrideNative: true,
}
]
```

### **volume**

| **Type** | Default | Required |
Expand Down
8 changes: 6 additions & 2 deletions src/js/api/SupportChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,26 @@ const SupportChecker = function(){

const file = source.file;
const type = source.type;
const overrideNative = source.overrideNative;

if(!type){return false;}
const mimeType = source.mimeType || MimeTypes[type];

// Latest Edge browser returns "Chrome" from userAgentObject.browser
// Make sure to use hls.js Android devices
if(isHls(file, type) && (userAgentObject.browser === "Microsoft Edge" || userAgentObject.os === "Android")) {
if (isHls(file, type) && (userAgentObject.browser === "Microsoft Edge" || userAgentObject.os === "Android")) {
return false;
}

if (isHls(file, type) && overrideNative) {
return false;
}

if (isRtmp(file, type)) {
return false;
}

if(isWebRTC(file, type)){
if (isWebRTC(file, type)) {
return false;
}

Expand Down