kevinatown / MMM-Screencast

A module to cast to the magic mirror
MIT License
166 stars 34 forks source link

Stuck on connecting #131

Open JustinTomerlin opened 2 years ago

JustinTomerlin commented 2 years ago

I've added the module and add the config code in the config file. I tried launching the magic mirror and it worked it showed up under the devices but when I clicked on the screen to play the video it just says "connecting..." for a few mins and then times out. but when it times out and I try to connect to the device the device is no longer there until I restart magic mirror.

Any help would be greatly appreciated.

Egnos87 commented 2 years ago

Similar problem for me too: it often happens that it is no longer possible to reconnect after a disconnection. It also happens when, after the disconnecting, you try to reconnect with a new user. Below is the message that appears on the MM terminal when it is no longer possible to connect:

[30.09.2022 20:48.26.469] [LOG]   screencast stdout: 
> magicmirror-screencast@0.0.5 start
> electron app.js

Please @kevinatown help us!

Thanks.

kevinatown commented 2 years ago

@Egnos87 @JustinTomerlin could y’all send me the entire boot up log? A copy of your config with any API keys removed? Also what model of pi are you running it on?

Egnos87 commented 2 years ago

Hi @kevinatown, I am happy that you have taken care of our issue.

The module runs on an RPI 4 4gb. The module starts correctly, but randomly (after a long time it is active, or when a user other than the first one tries to connect ...), when it is no longer possible to connect, the last thing that prints the module is this:

[30.09.2022 20:48.26.469] [LOG]   screencast stdout: 
> magicmirror-screencast@0.0.5 start
> electron app.js

after which the module is no longer visible from the YouTube app and therefore it is no longer possible to try further connections.

This is my configuration:

{
        module: 'MMM-Screencast',
        position: 'bottom_right', // This position is for a hidden <div /> and not the screencast window
        config: {
            position: 'center',
            height: 300,
            width: 500,
            x:720,
            y: 220,  //200
            castName: 'MagicMirror'
        }
        },

Another problem, when you disconnect the cast the YouTube window remains open as described in the issue "Screen is still visible after disconnecting? # 128".

Thank you for your fantastic module which I hope will be able to work as it once was!

Greetings.

peternguy3n commented 2 years ago

@kevinatown @JustinTomerlin @Egnos87 First time setting up Magic Mirror and I resolved all my issues by basing my build off of the Raspberry Pi Buster image. Spent too much time trying to make Bullseye work. Loaded Buster and all is working well out the box.

Egnos87 commented 2 years ago

Hi @peternguy3n I stayed on Buster just to avoid Bullseye's various problems.
But unfortunately MMM-Screencast also with Buster has the problems described above.

Hopefully @kevinatown can solve.
For any test or information I am available.

Thanks.

Egnos87 commented 2 years ago

Hi @kevinatown the problem has happened again. Now I try to start the MM with npm start >> log.log and when it happens again I will send you the log.

Please @kevinatown don't let this beautiful module die! ;-)

Thank you.

Tom-Hirschberger commented 2 years ago

Hi,

cause of @Egnos87 i tried installing the module. It looks like the problem only exists with Raspberry OS Buster but not with Bullseye.

First i need to say that i use the Branch of smartgic which fixes the not closing window of ticket #128

On Buster the connection fails and the log shows the following error

> electron app.js

[06.11.2022 14:32.30.345] [LOG]   screencast stderr: [20584:1106/143230.345216:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/pi/MagicMirror/modules/MMM-Screencast/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.

[06.11.2022 14:32.30.350] [LOG]   screencast stderr: /home/pi/MagicMirror/modules/MMM-Screencast/node_modules/electron/dist/electron exited with signal SIGTRAP

I followed the suggestions with:

cd ~/MagicMirror/modules/MMM-Screencast/node_modules/electron/dist
sudo chown root:root chrome-sandbox 
sudo chmod 4755 chrome-sandbox

And after this everything works well.

Tom-Hirschberger commented 2 years ago

On Bullseye i get the following warning

> magicmirror-screencast@0.0.5 start
> electron app.js

[05.11.2022 17:41.26.364] [LOG]   screencast stderr: (node:3143) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron.  See https://github.com/electron/electron/issues/23506 for more information

but everything works well

Tom-Hirschberger commented 2 years ago

Played a little bit with two clients connecting to the Buster instance today.

The log shows the following error in this moment:

[07.11.2022 08:29.12.416] [ERROR] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at new NodeError (node:internal/errors:371:5)
    at ServerResponse.setHeader (node:_http_outgoing:573:11)
    at ServerResponse.header (/home/pi/MagicMirror/node_modules/express/lib/response.js:794:10)
    at ServerResponse.contentType (/home/pi/MagicMirror/node_modules/express/lib/response.js:624:15)
    at ServerResponse.sendStatus (/home/pi/MagicMirror/node_modules/express/lib/response.js:373:8)
    at /home/pi/MagicMirror/modules/MMM-Screencast/node_modules/peer-dial/lib/peer-dial.js:110:25
    at /home/pi/MagicMirror/modules/MMM-Screencast/DialServer.js:85:15
    at Client.<anonymous> (/home/pi/MagicMirror/modules/MMM-Screencast/ipc.js:70:36)
    at Client.emit (/home/pi/MagicMirror/modules/MMM-Screencast/node_modules/event-pubsub/es5.js:74:21)
    at Socket.<anonymous> (/home/pi/MagicMirror/modules/MMM-Screencast/node_modules/node-ipc/dao/client.js:241:24) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
Wdave40 commented 2 years ago

I am having the same issue, the endless spinner. Below are my logs from PM2 and my OS info. Screenshot 2022-11-21 at 10 45 29 AM Screenshot 2022-11-21 at 10 46 35 AM