RSATom / WebChimera.js

[ABANDONED] libvlc binding for Electron
GNU Lesser General Public License v2.1
661 stars 105 forks source link

player stops with no error #142

Closed mattzucker closed 3 years ago

mattzucker commented 3 years ago

Environment: Windows 10 Electron v11.4.3 WebChimera.js v0.3.1

I am able to play https://github.com/RSATom/wcjs-ugly-demo successfully, but when I copy/paste that same example within my own Electron app I start seeing very strange behavior. Each time I try to play a video (tested on a UDP stream and MP4 file), the player gets to a different spot and then just stops/crashes without any errors.

Sometimes the video plays for 20 seconds and then I no longer receive any onFrameReady events. Sometimes the video doesn't get past buffering, or the last thing I see in the logs is "waiting for SPS/PPS". Each time I restart the app without making any code changes it stops at a different point in the process.

Is there anything I can do to help debug the problem?

mattzucker commented 3 years ago

I'm still not sure what I did, but it's working now. It must have been code in my app because I didn't change anything in my environment or any versions. I tried to revert what I did to reproduce the bug and document the specific defect, but I could not.

If this arises again in the future, is there anything more I can do to increase logging? I already added: var vlcPlayer = wc.createPlayer(["-vvv"]); and added a listener to onEncounteredError

RSATom commented 3 years ago

If it crash I'm afraid logs will not help. I will need minimal example with reproducible problem to be able to fix it.

mattzucker commented 3 years ago

For reference, I think this was crashing because I was trying to restrict NodeJS access in my BrowserWindow.

const win = new BrowserWindow({
    webPreferences: {
        contextIsolation: true,
        nodeIntegration: false,
        preload: path.join(__dirname, "preload.js")
    }
});

I used preload.js to access the canvas by id, then used the webchimera.js player there. Apparently Electron doesn't like that and I suppose didn't design the preload script to work like this. Electron seems to kill the preload script after some time. I found this question which highlights the issue https://stackoverflow.com/questions/55643227/electron-preload-javascript-with-persistence.

For now, I will have to set nodeIntegration to true in order for it to work.