mpv.js
mpv.js copied to clipboard
Lags initially and freezes a few moments later on Nw.js 0.46.0+
Hi all,
I'm not sure what is actually responsible for this, if it's the plugin or Nw.js. this worked fine until 0.46.0. The reason I am posting this here first is to make sure it's not some node compatibility issue that's already known. Here is the release notes for 0.46.0. It doesn't throw any errors or anything. If this happens to work perfectly fine in the latest version of Electron (haven't really used it to test it) then I'll link this to the Nw.js issues. Here is a Linux zip (I also re-compiled it, incase it was to do with that, but just check to make sure I compiled it correctly. Either way, it didn't fix the problem).
To run use npm run nw (or just ./nw)
- To see the code: it's in index.html
- Pre-built mpv.js in mpv.js directory. You can replace that with whatever for testing
- The nw.js files in here are from Nw.js 0.46.0. The same applies all the way up to the latest version. I tasted practically every one of them until this point. To test 0.45.5 for example, just download it from the official website here select the sdk build and just replace all files in the zip with the ones from there. Make sure to replace the libffmpeg using
gcc -Wl,--no-as-needed -shared -lavformat -o /path/to/libffmpeg.so
This is rather important for my project so let me know if anyone has any idea how to fix this.
If you are on another platform just grab the index.html and package.json, download the appropriate platform version of Nw.js from the link above, copy those 2 files into that directory (make sure the plugin url links to your platform one's location in package.json) and run Nw in whichever way they say to do it.
Thanks
@Kagami Possibility of porting this to WASM? From the other issue linked above that I reported directly to Nwjs, it seems Pepper plugins are slowly being phased out in favour of WASM
Can you attach a debugger and see where it is stuck inside libmpv or the pepper plugin?
@anesuc Also not sure if you've tried this with your stream, but you might need:
this.mpv.addEventListener('message', msg => {
if (msg.data.type === 'ready') {
//...
this.setProperty('untimed', true);
}
});
(This won't work with RTP or RTSP streams). I had issues with blackmagic hardware where that fixed stuttering.
Other flags to look into maybe also (I've had to use these on some hardware):
this.setProperty('opengl-swapinterval', 0);
this.setProperty('opengl-glfinish', true);
this.setProperty('display-fps', 30);
this.setProperty('ao', 'wasapi');