-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support sharing Docker audio with host
- Loading branch information
Showing
5 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
default-server = unix:/amniotic.socket | ||
# Prevent a server running in the container | ||
autospawn = no | ||
daemon-binary = /bin/true | ||
# Prevent the use of shared memory | ||
enable-shm = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pathlib import Path | ||
import logging | ||
|
||
def start(): | ||
|
||
path_socket=Path('/amniotic.socket') | ||
|
||
if path_socket.exists(): | ||
msg=f'Pulse socket found at "{path_socket}". Using host-shared audio.' | ||
logging.info(msg) | ||
import os | ||
os.environ['PULSE_SERVER'] = "unix://amniotic.socket" | ||
os.environ['PULSE_COOKIE'] = "/amniotic.cookie" | ||
else: | ||
msg = f'No Pulse socket found at "{path_socket}". Using dedicated audio.' | ||
logging.warning(msg) | ||
|
||
from amniotic.mqtt import loop | ||
loop.start() | ||
|
||
if __name__ == '__main__': | ||
start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters