MMM-Screencast icon indicating copy to clipboard operation
MMM-Screencast copied to clipboard

No sound on the videos

Open sudomax opened this issue 5 years ago • 10 comments

This module does not work for me. I did a fresh install but it didn't solve my issues.

  • First, the youtube screen would show "Something went wrong". By updating electron to version 6.0.0, it solved this issue. The latest version of electron does not work at all and brings an error when attempting to open the youtube window.
  • The sound of the video is not working. I get the sounds from the youtube app when I move around the menus but the sound of the videos is not coming. The sound level is set to the max, both on the software and the hardware, no result.

Would anyone have a solution to fix the sound for the videos?

sudomax avatar Jan 28 '20 07:01 sudomax

Hey @sudomax sorry to hear about the issues. Have some questions for ya:

  • What other modules are you using? (I know there are some issues with some other modules that I need to fix)
  • Can you run you MM and log the output when you connect, play the video, and then close the cast? You can do it like:
display=:0 npm start >> log.log

then paste the log.log in here?

kevinatown avatar Feb 02 '20 22:02 kevinatown

Hey @kevinatown,

  • I tried from a clean MM install, with no other module installed. The only thing I installed on this RP is the google assistant sdk. Below is a copy of my .asoundrc file if that can help.
  • Here is the log below. I installed the PIR-sensor module in the meantime, it doesn't look like it affected this module. I confirm that I can hear the sounds of the youtube menu when I use my phone as a remote. Looks like only the video is having a bad time.
pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
pcm.speaker {
  type plug
  slave {
    pcm "hw:0,1"
  }
}
pcm.output {
	type hw
	card 0
}
ctl.!default {
	type hw
	card 0
}
pcm.input {
	type hw
	card 0
}
> [email protected] start /home/pi/MagicMirror
> ./run-start.sh
[19:44:06.351] [LOG]    Starting MagicMirror: v2.10.1
[19:44:06.359] [LOG]    Loading config ...
[19:44:06.366] [LOG]    Loading module helpers ...
[19:44:06.367] [LOG]    No helper found for module: alert.
[19:44:06.429] [LOG]    Initializing new module helper ...
[19:44:06.430] [LOG]    Module helper loaded: updatenotification
[19:44:06.431] [LOG]    No helper found for module: clock.
[19:44:07.025] [LOG]    Initializing new module helper ...
[19:44:07.025] [LOG]    Module helper loaded: calendar
[19:44:07.026] [LOG]    No helper found for module: currentweather.
[19:44:07.026] [LOG]    No helper found for module: weatherforecast.
[19:44:07.069] [LOG]    Initializing new module helper ...
[19:44:07.069] [LOG]    Module helper loaded: newsfeed
[19:44:07.473] [LOG]    Initializing new module helper ...
[19:44:07.474] [LOG]    Module helper loaded: MMM-Screencast
[19:44:07.506] [LOG]    Initializing new module helper ...
[19:44:07.506] [LOG]    Module helper loaded: MMM-PIR-Sensor
[19:44:07.506] [LOG]    All module helpers loaded.
[19:44:07.507] [LOG]    Starting server on port 8080 ... 
[19:44:07.523] [LOG]    Server started ...
[19:44:07.524] [LOG]    Connecting socket for: updatenotification
[19:44:07.524] [LOG]    Connecting socket for: calendar
[19:44:07.525] [LOG]    Starting node helper for: calendar
[19:44:07.525] [LOG]    Connecting socket for: newsfeed
[19:44:07.526] [LOG]    Starting module: newsfeed
[19:44:07.526] [LOG]    Connecting socket for: MMM-Screencast
[19:44:07.527] [LOG]    Connecting socket for: MMM-PIR-Sensor
[19:44:07.527] [LOG]    Sockets connected & modules started ...
[19:44:07.688] [LOG]    Launching application.
[19:44:10.032] [LOG]    Create new calendar fetcher for url: xxx - Interval: 300000
[19:44:10.105] [LOG]    Create new news fetcher for url: xxx - Interval: 300000
[19:44:42.399] [LOG]    screencast stdout: 
> [email protected] start /home/pi/MagicMirror/modules/MMM-Screencast
> electron app.js
[19:45:25.577] [LOG]    Got request to stop YouTube  with pid:  run
[19:45:26.115] [LOG]    closing code: 0
[19:45:34.164] [LOG]    Shutting down server...
[19:45:34.176] [LOG]    Stopping module helper: updatenotification
[19:45:34.176] [LOG]    Stopping module helper: calendar
[19:45:34.177] [LOG]    Stopping module helper: newsfeed
[19:45:34.178] [LOG]    Stopping module helper: MMM-Screencast
[19:45:34.179] [LOG]    Stopping module helper: MMM-PIR-Sensor

sudomax avatar Feb 03 '20 18:02 sudomax

Oh man, thanks for this. I think that this may have an issue with chromium and bluetooth ASLA this looks like it might work (or someone got it working): https://github.com/Arkq/bluez-alsa/issues/88 but it's def an issue with chromium and bluetooth, I need to get and configure one for myself so that I will have a better understanding on what's going on.

I hope this helps. Also let me know if this fix works or you found another!

kevinatown avatar Mar 03 '20 01:03 kevinatown

Also @sudomax is the sound the only issue that you noticed?

kevinatown avatar Mar 03 '20 01:03 kevinatown

Hi, I'm currently having similar problems and think I've identified the issue: Using bluetooth and Alsa, only one playback window can 'grab' the audio output device at any one time (Limitation of bluez-alsa). When MMM-Screencast receives a request it spawns a new electron/Chrome window: `[17:42:20.281] [LOG] screencast stdout:

[email protected] start /home/pi/MagicMirror/modules/MMM-Screencast electron app.js And so the second browser window cannot grab the audio device.[17:42:49.772] [LOG] screencast stderr: ALSA lib pcm.c:8599:(snd_pcm_set_params) Unable to set hw params for PLAYBACK: Device or resource busy

[17:42:49.809] [LOG] screencast stderr: ALSA lib pcm.c:8599:(snd_pcm_set_params) Unable to set hw params for PLAYBACK: Device or resource busy `

The problem, this is a known limitation of Alsa with bluetooth output devices. If you use a 'regular' USB or built in device you can use dmix on Alsa which will allow multiple electron/chrome windows to send audio. A simple .asoundrc would look like:

pcm.dmixed { type dmix ipc_key 1024 ipc_key_add_uid 0 slave.pcm "hw:0,0" } pcm.dsnooped { type dsnoop ipc_key 1025 slave.pcm "hw:1,0" } pcm.duplex { type asym playback.pcm "dmixed" capture.pcm "dsnooped" } pcm.!default { type asym playback.pcm { type plug slave.pcm "dmixed" } capture.pcm { type plug slave.pcm "dsnooped" } } pcm.input { type hw card 1 }

Which sets default to use the dmix and dsnoop method to share the physical output device (in my case my usb speakers). Unfortunately bluez-alsa doesn't support dmix options and looking at the issue logged (https://github.com/Arkq/bluez-alsa/issues/48) it's not a simple one to fix. But this appears to confirm it's a lower-layer issue rather than MMM-Screencast itself. Is there a way of doing MMM-Screencast into an iframe perhaps?

andyb2000 avatar Mar 15 '20 17:03 andyb2000

Interesting, thanks for your answer @andyb2000. I'm not using Bluetooth anymore, it was just a test while I was waiting for my usb speakers. Now that they're in, how should my .asoundrc file should look like?

sudomax avatar Apr 03 '20 15:04 sudomax

I am using USB speakers and still appear to be getting no sound

MaegnusTheBlackMage avatar Jun 27 '20 18:06 MaegnusTheBlackMage

Sorry for the delay, was busy building the mirror itself. I used bluetooth for testing purpose, my final project will use speakers over the headphone jack. I'll reconfigure that soon and post result here.

sudomax avatar Jun 29 '20 15:06 sudomax

Sorry for the delay, was busy building the mirror itself. I used bluetooth for testing purpose, my final project will use speakers over the headphone jack. I'll reconfigure that soon and post result here.

I'm working on setting my mirror up and I also don't have Audi through headphone jack. thank you guys for any help

derkaramma avatar Jul 12 '20 02:07 derkaramma

Hi y'all, sorry I haven't had much time to look into audio issues, but can y'all start with just checking the audio settings on the pi. I hope this is at least some help.

kevinatown avatar Aug 26 '20 17:08 kevinatown