【问题标题】:Executing a script when pipewire opens a stream当 pipewire 打开流时执行脚本
【发布时间】:2022-06-24 22:43:10
【问题描述】:

我在 Ubuntu 21.10 上使用 Wireplumber 运行 Pipewire。我想在任何应用程序开始录制时执行一个脚本(例如,当我进入会议并且应用程序打开麦克风时)这不仅适用于 Zoom,它应该适用于任何应用程序,包括基于浏览器的应用程序。我的用例是在开会时通过 OpenHAB 打开灯。目前我们使用 Zoom、Gather、Slack 和 Discord,谁知道未来会发生什么。

我的想法是监视 Pipewire/Wireplumber 以查看应用程序何时打开源流,但我找不到如何连接它。有什么想法吗?

【问题讨论】:

    标签: linux pipewire


    【解决方案1】:

    这是我想出的,利用pactl 也适用于 PipeWire 的事实:

    #!/bin/bash
    
    source_number=""
    
    pactl subscribe | while read x event y type num; do
        if [ $event == "'new'" -a $type == 'source-output' ]; then
            source_number=$num
            notify-send -u normal -a "Microphone Monitor" "Microphone ON" "Microphone has been turned ON"
            echo "$(date -Is) Microphone on"
        fi
    
        if [ $event == "'remove'" -a $type == 'source-output' -a $num == "$source_number" ]; then
            source_number=""
            notify-send -u normal -a "Microphone Monitor" "Microphone OFF" "Microphone has been turned OFF"
            echo "$(date -Is) Microphone off"
        fi
    done
    

    【讨论】:

      猜你喜欢
      • 2019-08-17
      • 2015-06-10
      • 2015-07-04
      • 2017-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多