Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sound on the videos #54

Open
sudomax opened this issue Jan 28, 2020 · 10 comments
Open

No sound on the videos #54

sudomax opened this issue Jan 28, 2020 · 10 comments

Comments

@sudomax
Copy link

sudomax commented Jan 28, 2020

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?

@kevinatown
Copy link
Owner

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?

@sudomax
Copy link
Author

sudomax commented Feb 3, 2020

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
}
> magicmirror@2.10.1 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: 
> magicmirror-screencast@0.0.5 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

@kevinatown
Copy link
Owner

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): arkq/bluez-alsa#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
Copy link
Owner

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

@andyb2000
Copy link

andyb2000 commented Mar 15, 2020

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:

magicmirror-screencast@0.0.5 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 (arkq/bluez-alsa#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?

@sudomax
Copy link
Author

sudomax commented Apr 3, 2020

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?

@MaegnusTheBlackMage
Copy link

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

@sudomax
Copy link
Author

sudomax commented Jun 29, 2020

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.

@derkaramma
Copy link

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

@kevinatown
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants