I'm using ffmpeg.wasm in my site but it only works if the browser supports SharedArrayBuffer. Is there a simple way to test using javascript (browser js or nodejs) if the browser has support to it? One solution I thought was to compare the user agent with the list offered in this website but this would be too verbose and I'm guessing if there isn't a simpler way?
Asked
Active
Viewed 692 times
3
-
2`if( typeof SharedArrayBuffer !== 'undefined' ) { ` – Dai Oct 10 '21 at 12:54
-
Dare I ask what kind of performance you get from FFmpeg in WASM? Somehow I doubt you'll be able to do much in the way of H.265 encoding with a single JS thread. – Dai Oct 10 '21 at 12:55
-
I'm using to convert mp4 videos to hls format to offload this work from my server to the client, but indeed is kinda slow – Fnr Oct 10 '21 at 13:01
-
MP4 and HLS are orthogonal. You can serve MP4 using HLS. You do not need to transcode files either. – Dai Oct 10 '21 at 13:10
1 Answers
0
You can do all that but the easiest way of finding out is just checking here, but if you want to do it runtime you can add this line of code in your browser
try{
var sab = new SharedArrayBuffer(1024);
if(sab===undefined)throw new Error('not supported')
}
catch(e){
alert('browser doesnot support SharedArrayBuffer: ",e)
}

jainChetan81
- 139
- 10