Skip to content

Commit

Permalink
Merge pull request #386 from cloudastructure/master
Browse files Browse the repository at this point in the history
Add source option to prevent usage of HLS native implementation
  • Loading branch information
SangwonOh authored Oct 13, 2023
2 parents 44599ba + fdec03a commit baa48fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
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

0 comments on commit baa48fb

Please sign in to comment.